我试图向SABRE发出一个TOken请求,我使用了它们的例子,但是最后我得到了这个错误:
<faultstring>Unable to create envelope from given source: Error on line 19 of document : The prefix "wsse" for element "wsse:Security" is not bound. Nested exception: The prefix "wsse" for element "wsse:Security" is not bound.</faultstring>这是我的要求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:mes="http://www.ebxml.org/namespaces/messageHeader" xmlns:web="http://webservices.sabre.com">
<soapenv:Header>
<mes:MessageHeader mes:version="1">
<mes:From>
<mes:PartyId>Client</mes:PartyId>
</mes:From>
<mes:To>
<mes:PartyId>SWS</mes:PartyId>
</mes:To>
<mes:CPAId>DCG</mes:CPAId>
<mes:ConversationId>123</mes:ConversationId>
<mes:Service>Session</mes:Service>
<mes:Action>TokenCreateRQ</mes:Action>
<mes:MessageData>
<mes:MessageId>1234</mes:MessageId>
<mes:Timestamp>2015-01-01T00:00:00</mes:Timestamp>
</mes:MessageData>
</mes:MessageHeader>
<wsse:Security>
<wsse:UsernameToken>
<wsse:Username>USER</wsse:Username>
<wsse:Password>PASSWORD</wsse:Password>
<Organization>PCC</Organization>
<Domain>DOMAIN</Domain>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<web:TokenCreateRQ Version="1.0.0"/>
</soapenv:Body>
</soapenv:Envelope>这是WSDL文件:http://files.developer.sabre.com/wsdl/sabreXML1.0.00/usg/TokenCreateRQ.wsdl
知道是怎么回事吗?
发布于 2020-04-20 05:58:01
试试这个结构。不同之处在于安全性下的命名空间。
<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>${#TestCase#Username}</wsse:Username>
<wsse:Password>${#TestCase#Password}</wsse:Password>
<Organization>${#TestCase#CPAId}</Organization>
<Domain>${#TestCase#Domain}</Domain>
</wsse:UsernameToken>
</wsse:Security>发布于 2020-04-20 11:41:28
错误出现在名称空间声明上,它被声明为sec,但随后使用了wsse。
替换:xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"
与:xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext"
作为查看名称空间的简单建议,您可以将WSDL导入到SoapUI中,并检查自动生成的空白示例以及请求的所有可能元素。
https://stackoverflow.com/questions/61306718
复制相似问题