java的 ((Stub) proxy).setHeader("http://xxx.xxx.com","SessionId", wsct.getSessionId());
在.net 环境下实现过程
1.创建独立的类
public class RequestSOAPHeader:SoapHeader
{
[XmlNamespaceDeclarations]
public XmlSerializerNamespaces Namespaces { get; set; }
[XmlElement(Namespace = "http://xxx.xxx.com")]
public string SessionId { get; set; }
}
2. 在webservice动态生成的代码中手动添加:
public RequestSOAPHeader RequestSOAPHeader { get; set; }
3.在webservice动态生成的代码中调用的方法头部位置手动添加:
[SoapHeader("RequestSOAPHeader")]
4.
WeiNeng.BLL.ZxToEASBaseDataFacade.WSWebZXBaseDataFacadeSrvProxyService server = new WeiNeng.BLL.ZxToEASBaseDataFacade.WSWebZXBaseDataFacadeSrvProxyService();
string SessionId = Longin();
RequestSOAPHeader setHeader = new RequestSOAPHeader();
setHeader.SessionId = SessionId;
server.RequestSOAPHeader = setHeader;
string returnJson = server.getCustomer("");
到此就收工了。以上是根据个人实际开发整理。希望对读到的人有用。