-4

我正在尝试配置 SOAP 请求以使用 Web 服务

这是预期的 SOAP 请求

    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://xmlns.oracle.com/ABCS/Industry/Telco/ChannelLayer/ProcessPaymentChannelLayerReqABCSImpl" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<env:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">test123</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</env:Header>

我设法带来了这样的 SOAP 请求。

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:mustUnderstand="1" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:must
Understand="0">
<wsse:UsernameToken xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Username>test</wsse:Username>
<wsse:password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">test123</wsse:password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>

它们都是一样的,唯一的区别是来自soapenv的Envelop标签的前缀,需要将其更改为env

在我尝试配置 SOAPRequest 的方法中,我可以访问org.apache.axis.client.Stub

注意:我尝试访问 SOAPEnvelop 来设置前缀,它返回为 null :(

提前致谢

4

1 回答 1

1

上述两个 XML 片段不相同,请检查以下差异:

env:mustUnderstand="1" 发送soapenv:mustUnderstand="0"

实际上,您的第二个 XML 两次覆盖了 mustUnserstand 标头?

同样正如@kdgregory 提到的,前缀实际上并不重要,只需确保名称空间和标头值正确即可。

于 2013-01-01T14:26:14.617 回答