Set custom SOAP header using Axis 1.4

前端 未结 3 1093
清歌不尽
清歌不尽 2020-12-24 15:29

I\'m trying to consume a .NET 2.0 web service using Axis. I generated the web services client using Eclipse WST Plugin and it seems ok so far.

Here the expected SOA

3条回答
  •  时光取名叫无心
    2020-12-24 16:02

    I have the same issue and solved by the below fragement:

    ServiceSoapStub clientStub = (ServiceSoapStub)new ServiceLocator().getServiceSoap(url);
    org.apache.axis.message.SOAPHeaderElement header = new org.apache.axis.message.SOAPHeaderElement("http://www.abc.com/SSsample/","AuthHeader");
    SOAPElement node = header.addChildElement("Username");
    node.addTextNode("aat");
    SOAPElement node2 = header.addChildElement("Password");
    node2.addTextNode("sd6890");
    
    ((ServiceSoapStub) clientStub).setHeader(header);
    

提交回复
热议问题