Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sabre SOAP-wsse:安全性-未绑定_Soap_Sabre - Fatal编程技术网

Sabre SOAP-wsse:安全性-未绑定

Sabre SOAP-wsse:安全性-未绑定,soap,sabre,Soap,Sabre,我试图向SABRE SOAP发出令牌请求,我使用了他们的示例,但最后我得到了以下错误: <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

我试图向SABRE SOAP发出令牌请求,我使用了他们的示例,但最后我得到了以下错误:

  <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>
无法从给定源创建信封:文档第19行错误:元素“wsse:Security”的前缀“wsse”未绑定。嵌套异常:元素“wsse:Security”的前缀“wsse”未绑定。
这是我的要求:

    <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>

客户
SWS
DCG
123
一场
TokenCreateRQ
1234
2015-01-01T00:00:00
使用者
密码
PCC
领域
这是WSDL文件:


知道怎么回事吗?

试试这个结构。不同之处在于安全性下的名称空间

<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>

${#测试用例#用户名}
${#TestCase#Password}
${#TestCase#CPAId}
${#TestCase#Domain}

试试这个结构。不同之处在于安全性下的名称空间

<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>

${#测试用例#用户名}
${#TestCase#Password}
${#TestCase#CPAId}
${#TestCase#Domain}

错误出现在命名空间声明上,声明为
sec
,但随后使用
wsse

替换:
xmlns:sec=”http://schemas.xmlsoap.org/ws/2002/12/secext“

使用:
xmlns:wsse=”http://schemas.xmlsoap.org/ws/2002/12/secext“


作为查找命名空间的简单建议,您可以将WSDL导入到SoAPUI中,并检查所有请求的所有可能元素生成的空示例。

错误是在命名空间声明中,声明为“代码> SEC”,然后使用“<代码> WSSE < < /P> 替换:

xmlns:sec=”http://schemas.xmlsoap.org/ws/2002/12/secext“

使用:
xmlns:wsse=”http://schemas.xmlsoap.org/ws/2002/12/secext“


作为查找命名空间的简单建议,您可以将WSDL导入SOAPUI,并检查所有请求的所有可能元素生成的空示例。看起来更正确。请看@Wisdoom的帖子。它看起来更正确。