我有一个简单的java Web服务,请求xml如下所示。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.jfoundation.com/WebService/WebServiceService">
<soapenv:Header>
<airline xmlns="http://www.jfoundation.com/ws/security/">
<Code>CMB</Code>
</airline>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<UsernameToken>
<Username>username_here</Username>
<Password>password_here</Password>
</UsernameToken>
</Security>
</soapenv:Header>
<soapenv:Body>
<web:registerUser>
<userDetailsRQ>
<emailID>email_here</emailID>
<fax>fax_number_here</fax>
<mobile>mobile_phone_number_here</mobile>
</userDetailsRQ>
</web:registerUser>
</soapenv:Body>
</soapenv:Envelope>
现在,我正在尝试在.Net 4.0中使用此Web服务,我能够使用框架生成的类创建服务引用并创建代理对象。但我不知道如何通过客户端传递soap标题详细信息。
以下是调用Web服务的代码段。但它失败了,因为我无法传递捕获以下信息的标题,例如代码,用户名,密码
WebServiceClient objClientProxy = new WebServiceClient();
registerUserDetailsRQ objUserDetailsEntity = new registerUserDetailsRQ() { emailID = "", fax = "", mobile = ""};
objClientProxy.registerUser(objUserDetailsEntity);
感谢有人可以提供帮助..