WSE 3.0创建的UsernameToken,但用户名和密码值为空 [英] WSE 3.0 creates the UsernameToken but Username and Password values are empty

查看:776
本文介绍了WSE 3.0创建的UsernameToken,但用户名和密码值为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
        xmlns:tns="http://tempuri.org/" 
        xmlns:types="http://tempuri.org/encodedTypes" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <soap:Header>
                <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1">
                    <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="unt_PQxtsT0a8iV1KN2Y">
                        <wsse:Username></wsse:Username>
                        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"></wsse:Password>
                        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">i03CXze0uiIYG8+q8MhEMYHiMcL/NOpCwvEVpQ5xo+M=</wsse:Nonce>
                        <wsu:Created>2012-04-25T22:59:23Z</wsu:Created>
                    </wsse:UsernameToken>
                    <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                        <wsu:Created>2012-04-25T22:59:23Z</wsu:Created>
                        <wsu:Expires>2012-04-25T22:60:23Z</wsu:Expires>
                    </wsu:Timestamp>
                </wsse:Security>
            </soap:Header>

客户端code:

Client code:

MessageServiceWse client = new MessageServiceWse();

UsernameToken usernameToken = new UsernameToken(token.Username, token.Password, PasswordOption.SendPlainText);

client.RequestSoapContext.Security.Tokens.Add(usernameToken);
client.RequestSoapContext.Security.Timestamp.TtlInSeconds = 60;

client.SomeMethod(请求);

client.SomeMethod(request);

这美丽的肥皂安全头,我设法噪音太大后创建安装和VS 2010,但使用WSE 3.0我调用这个Web服务(我不控制)的地狱仍在继续,虽然wverything似乎很好,我无法通过最后一个问题搞定。

This the beautiful soap security header I managed to create after too much noise to install and use WSE 3.0 in VS 2010. BUT, my hell of calling this web service (which I don't control) continues, and while wverything seemed fine, I can't get through this last issue.

如果您的请求头注意到,你可以看到,一切看起来都不错,除了,兴田的用户名和密码,我通过不存在!

If you notice on the request header, you can see that everything looks good, except, hte username and password I pass are not there!!!

有谁遇到类似的情况?

感谢您。

推荐答案

不知道,如果你仍然有这个问题,但是你能尝试这样的事情?
我不知道为什么你想获得令牌对象的用户名/密码。它是什么,客户端需要提供给服务

Not sure if you are still having this issue, however can you try something like this ? I don't know why you are trying to get username/pwd from token object. It is something that the client needs to provide to the service.

UsernameToken token = new UsernameToken("myusername", "mypwd", PasswordOption.SendPlainText );

client.SetClientCredential(token);
client.SetPolicy("ClientPolicy");

这篇关于WSE 3.0创建的UsernameToken,但用户名和密码值为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆