0

有谁知道如何在 IOS 中使用 Sabre SOAP Web 服务?有人做过吗?我正在使用AFNetworking进行网络调用。

我正在使用 AFHTTPRequestOperation 调用 Web 服务,但该 Web 服务需要身份验证。

身份验证参数是usernamepasswordIPCC。我可以设置用户名和密码

NSURLCredential *credential = [NSURLCredential credentialWithUser:@"aaaaa" password:@"aaaaaa" persistence:NSURLCredentialPersistenceNone]; 
[operation setCredential:credential]; 

但是如何设置 IPCC 参数呢?

4

2 回答 2

0

当我尝试上面的片段时,它返回给我这个

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://www.opentravel.org/OTA/2002/11" xmlns:tns="https://webservices.sabre.com/websvc" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" targetNamespace="https://webservices.sabre.com/websvc">
    <types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://www.opentravel.org/OTA/2002/11" schemaLocation="SessionCreateRQRS.xsd"/>
            <xsd:import namespace="http://www.ebxml.org/namespaces/messageHeader" schemaLocation="msg-header-2_0.xsd"/>
            <xsd:import namespace="http://schemas.xmlsoap.org/ws/2002/12/secext" schemaLocation="wsse.xsd"/>
        </xsd:schema>
    </types>
    <message name="GetSessionCreateInput">
        <part name="header" element="eb:MessageHeader"/>
        <part name="header2" element="wsse:Security"/>
        <part name="body" element="xsd1:SessionCreateRQ"/>
    </message>
    <message name="GetSessionCreateOutput">
        <part name="header" element="eb:MessageHeader"/>
        <part name="header2" element="wsse:Security"/>
        <part name="body" element="xsd1:SessionCreateRS"/>
    </message>
    <portType name="SessionCreatePortType">
        <operation name="SessionCreateRQ">
            <input message="tns:GetSessionCreateInput"/>
            <output message="tns:GetSessionCreateOutput"/>
        </operation>
    </portType>
    <binding name="SessionCreateSoapBinding" type="tns:SessionCreatePortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="SessionCreateRQ">
            <soap:operation soapAction="OTA"/>
            <input>
                <soap:header message="tns:GetSessionCreateInput" part="header" use="literal"/>
                <soap:header message="tns:GetSessionCreateInput" part="header2" use="literal"/>
                <soap:body parts="body" use="literal"/>
            </input>
            <output>
                <soap:header message="tns:GetSessionCreateOutput" part="header" use="literal"/>
                <soap:header message="tns:GetSessionCreateOutput" part="header2" use="literal"/>
                <soap:body parts="body" use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="SessionCreateRQService">
        <port name="SessionCreatePortType" binding="tns:SessionCreateSoapBinding">
            <soap:address location="https://webservices.sabre.com"/>
        </port>
    </service>
</definitions>
于 2015-12-30T14:58:54.353 回答
0

像(又快又脏)的东西:

NSString *soapMessage = [NSString stringWithFormat:
                     @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
                      "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:eb=\"http://www.ebxml.org/namespaces/messageHeader\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">"
                    "    <SOAP-ENV:Header>"
                    "        <eb:MessageHeader SOAP-ENV:mustUnderstand=\"1\" eb:version=\"1.0\">"
                    "            <eb:ConversationId/>"
                    "            <eb:From>"
                    "                <eb:PartyId type=\"urn:x12.org:IO5:01\">999999</eb:PartyId>"
                    "            </eb:From>"
                    "            <eb:To>"
                    "                <eb:PartyId type=\"urn:x12.org:IO5:01\">123123</eb:PartyId>"
                    "            </eb:To>"
                    "            <eb:CPAId>IPCC</eb:CPAId>"
                    "            <eb:Service eb:type=\"OTA\">SessionCreateRQ</eb:Service>"
                    "            <eb:Action>SessionCreateRQ</eb:Action>"
                    "            <eb:MessageData>"
                    "                <eb:MessageId>1000</eb:MessageId>"
                    "                <eb:Timestamp>2001-02-15T11:15:12Z</eb:Timestamp>"
                    "                <eb:TimeToLive>2001-02-15T11:15:12Z</eb:TimeToLive>"
                    "            </eb:MessageData>"
                    "        </eb:MessageHeader>"
                    "        <wsse:Security xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/12/secext\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/12/utility\">"
                    "            <wsse:UsernameToken>"
                    "                <wsse:Username>%@</wsse:Username>"
                    "                <wsse:Password>%@</wsse:Password>"
                    "                <Organization>%@</Organization>"
                    "                <Domain>DEFAULT</Domain>"
                    "            </wsse:UsernameToken>"
                    "        </wsse:Security>"
                    "    </SOAP-ENV:Header>"
                    "    <SOAP-ENV:Body>"
                    "        <eb:Manifest SOAP-ENV:mustUnderstand=\"1\" eb:version=\"1.0\">"
                    "            <eb:Reference xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"cid:rootelement\" xlink:type=\"simple\"/>"
                    "        </eb:Manifest>"
                    "    </SOAP-ENV:Body>"
                    "</SOAP-ENV:Envelope>"      
                     ,username
                     ,password
                     ,ipccValue

                     ];

我假设您的意思是组织块中的 ipccValue,而不是 eb:CPAId 块

来自https://developer.sabre.com/docs/read/soap_basics/Authentication 和信用在 ios 的肥皂网络服务中发送参数

于 2015-12-30T14:09:19.023 回答