首页 新闻 搜索 专区 学院

.net(C#)调用java的webservice如何处理soapheader

0
悬赏园豆:50 [已关闭问题] 关闭于 2014-08-10 11:00

java的xml如下:

<soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
  <soap:Header>
    <wsse:Security soap:mustUnderstand="1" xmlns:wsse=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken wsu:Id="UsernameToken-13120210" 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:Username xmlns:wsse=" adminhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">admin</wsse:Username>
        <wsse:Password Type=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" xmlns:wsse=" adminhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">admin</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <ns1:authenticate xmlns:ns1=" http://webservice.repair.wxcrg.com.cn">
      <ns1:in0>sanders</ns1:in0>
      <ns1:in1>950F7192C6B606A2</ns1:in1>
    </ns1:authenticate>
  </soap:Body>
</soap:Envelope>

在.net这边代理类,根据网上的一些方法,都是修改代理类增加

public partial class MyHeader : SoapHeader
{
    public string username;
    public string passwored;
}继承soapHeader的类,然后在要调用的方法上面加

[System.Web.Services.Protocols.SoapHeaderAttribute("myHeader", Direction = SoapHeaderDirection.In, Required = true)]

这么处理后,还是会报System.Web.Services.Protocols.SoapHeaderException:

实在找不出什么原因。望各位高手指点一二,谢谢。

早起Abc的主页 早起Abc | 菜鸟二级 | 园豆:279
提问于:2010-10-23 19:44
< >
分享
所有回答(0)
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册