使用用户名和密码构建soap headr [英] construct soap headr using username and password
问题描述
以下应该是肥皂信封格式。
< soap:Envelope xmlns:soap =http://www.w3.org/2003/ 05 / soap-envelopexmlns:urn =urn:nz.govt.ird.eservices.types.account.transaction:0-6>
< soap:Header>
< wsse:Security xmlns:wsse =http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsdxmlns:wsu =http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd>
< wsu:时间戳>
< wsu:创建>
< / wsu:时间戳>
< wsse:UsernameToken>
< wsse:用户名>用户名
< wsse:密码类型=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username- token-profile-1.0#PasswordText>密码
< wsu:创建/>
< / wsse:UsernameToken>
< / wsse:安全>
< / soap:标题>
< soap:Body> ;
< / soap:Body>
< / soap:Envelope>
当我添加用户名令牌使用以下代码
UsernameToken userToken = new UsernameToken(username,password);
SoapContext context = webserviceProxy.RequestSoapContext;
context.Security.Tokens.Add(userToken);
它在soapEnvelope中添加了wssecurity-secext-1.0.xsd
< soap:Envelope xmlns:soap = http://schemas.xmlsoap.org/soap/envelope / xmlns:xsi = http://www.w3.org/2001/XMLSchema-instance xmlns:xsd = http://www.w3.org/2001/XMLSchema xmlns:wsa = http://schemas.xmlsoap.org / ws / 2004/08 /寻址
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>
我想根据要求提供肥皂信封。请帮我在SoapHeader中使用wsse:UsernameToken生成所需的Soapenvelope。
Following should be the soap-envelope format.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:nz.govt.ird.eservices.types.account.transaction:0-6">
<soap: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">
<wsu:Timestamp>
<wsu:Created>
</wsu:Timestamp>
<wsse:UsernameToken>
<wsse:Username>username
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password
<wsu:Created/>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
</soap:Body>
</soap:Envelope>
when I add username token using following code
UsernameToken userToken = new UsernameToken("username", "password");
SoapContext context = webserviceProxy.RequestSoapContext;
context.Security.Tokens.Add(userToken);
it adds the wssecurity-secext-1.0.xsd in soapEnvelope
<soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:wsa=http://schemas.xmlsoap.org/ws/2004/08/addressing
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>
I want the soap envelope according to the requirement. please help me to generate the required Soapenvelope with wsse:UsernameToken in SoapHeader.
推荐答案
这篇关于使用用户名和密码构建soap headr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!