【发布时间】:2019-01-06 17:59:11
【问题描述】:
默认标头为空,我必须向 Soap 请求添加安全标头,如下所示:
<soapenv:Envelope xmlns:end="http://endpoint.soap.esb.steg.com.tn/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-633D8322A7C327A0D5153295320052614">
<wsse:Username>website</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">7MyXmdbbBuyiHQwGCAY2+NxYRH8=</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">sdc+Kcgj/aghCxpUCACCxQ==</wsse:Nonce>
<wsu:Created>2018-07-30T12:20:00.526Z</wsu:Created>
</wsse:UsernameToken></wsse:Security>
</soapenv:Header>
<soapenv:Body>
<end:consultInfoAboBT>
<reference>00095013</reference>
</end:consultInfoAboBT>
</soapenv:Body>
</soapenv:Envelope>
这是我的代码
request = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:end='http://endpoint.soap.esb.steg.com.tn/'>"+ "<soapenv:Header/>"+"<soapenv:Body>" + "<end:consultInfoAboBT>"
+ "<reference>"+reference+"</reference>" + "</end:consultInfoAboBT>" + "</soapenv:Body>"+ "</soapenv:Envelope>";
StringEntity param = new StringEntity(request);
response = json.makeHttpRequestSteg(URLSWSTEG1, "POST", param, message);
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(response)));
【问题讨论】:
-
什么平台?什么语言?
-
@kiran Biradar 我正在使用 java
-
通过使用登录/密码对对 Web 服务服务器进行身份验证来使用此服务。此外,客户端(网站)和服务器之间的消息是在 HTTPS 中的,也就是说保护(加密)消息是由传输层在 https 中进行的。
-
你能发布一下你是如何构建和发送soap消息的吗?
-
我添加我的代码看看@kiran Biradar
标签: java web-services soap soap-client webservices-client