如何修复错误“未定义命名空间前缀"soap"";使用WSE 2.0 SP3 [.NET Framewok 1.1] [英] How to fix error "Namespace prefix 'soap' not defined" from using WSE 2.0 SP3 [.NET Framewok 1.1]

查看:866
本文介绍了如何修复错误“未定义命名空间前缀"soap"";使用WSE 2.0 SP3 [.NET Framewok 1.1]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在使用WSE 2.0 SP3(.NET Framewok 1.1)时遇到一些问题.

我使用WSE 2.0 SP3来使用安全的Web服务.

我尝试将带有SOAP标头的UsernameToken发送到安全的Web服务. (Axis Java Web服务)

请参阅下面的代码,

....

UsernameToken userToken =新的UsernameToken(userName,password,PasswordOption.SendPlainText);
SoapContext requestContext = this.objProxyService.RequestSoapContext;
requestContext.Security.Tokens.Add(userToken);
MessageSignature sig =新的MessageSignature(userToken);
requestContext.Security.Elements.Add(sig);

......

this.objProxyService.GetValue();  ->出现错误

但是错误名称空间前缀'soap'未定义".当我尝试调用Web方法时发生.

SOAP消息使用"soapenv"是否有问题?前缀?

以下是期望的SOAP消息,

< soapenv:信封xmlns:ser ="http://servicexxxxxxxxxx.xx.xx" xmlns:soapenv =" http://schemas.xmlsoap.org/soap/envelope/>
  < soapenv:Header>
    < wsse:Security soapenv:mustUnderstand ="1" 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-448969DA1257B4367F14967409135479">
       < wsse:用户名>我的用户名</wsse:用户名>
       < wsse:Password Type =" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" MyPassword</wsse:密码>
       < wsse:Nonce EncodingType ="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"> dnvHwbnDwj27eNtJhTPpAw ==< /wsse:Nonce>
       < wsu:Created> 2017-06-06T09:21:53.547Z</wsu:Created>
     </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>

........

我该如何解决这个问题?

非常感谢.

解决方案

Jatuphum Tungsilnsukchai,您好,

谢谢您在这里发布.

根据您的问题与WCF更为相关,我将其移至 CLR论坛讨论并询问有关.NET Framework基类(BCL)的问题,例如Collections,I/O,行政管理,全球化,反思.还讨论所有其他Microsoft库 在.NET Framework上构建或扩展的.NET Framework,包括托管扩展框架(MEF),图表控件,CardSpace,Windows Identity Foundation(WIF),销售点(POS),交易.

感谢您的理解与合作.

最好的问候,

Wendy


Hi all,

I have some problem about using WSE 2.0 SP3 (.NET Framewok 1.1).

I use WSE 2.0 SP3 for consume secure web service.

I try to send the UsernameToken with SOAP Header to the secure web service. (Axis Java Web Service)

See my code below,

....

UsernameToken userToken = new UsernameToken(userName,password, PasswordOption.SendPlainText);
SoapContext requestContext = this.objProxyService.RequestSoapContext;
requestContext.Security.Tokens.Add(userToken);
MessageSignature sig = new MessageSignature(userToken);
requestContext.Security.Elements.Add(sig);

......

this.objProxyService.GetValue();  --> Error Appear

But the error "Namespace prefix 'soap' not defined" is occurred, when I try to invoke web method.

Does it have problem from the SOAP Message use "soapenv" prefix?

Below is expect SOAP message,

<soapenv:Envelope xmlns:ser="http://servicexxxxxxxxxx.xx.xx" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" 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-448969DA1257B4367F14967409135479">
        <wsse:Username>MyUsername</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">MyPassword</wsse:Password>
        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">dnvHwbnDwj27eNtJhTPpAw==</wsse:Nonce>
        <wsu:Created>2017-06-06T09:21:53.547Z</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>

........

How can I solve this problem?

Thank you very much.

解决方案

Hi Jatuphum Tungsilnsukchai,

Thank you for posting here.

According to your question is more related to WCF, I will move it to  Windows Communication Foundation, Serialization, and Networking forum for suitable support.

The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions. 

Thanks for your understanding and cooperation.

Best Regards,

Wendy


这篇关于如何修复错误“未定义命名空间前缀"soap"";使用WSE 2.0 SP3 [.NET Framewok 1.1]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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