0

I have a WSDL file and i want to add header to it when I am requesting it from the wed service client.

I want to add these three attributes to it in the header. I am using Java and Apache CXF

<soapenv:Header>
 <UsernameToken xmlns="http://example.com/webservice">username</UsernameToken>
  <PasswordText xmlns="http://example.com/webservices">password</PasswordText>
 <SessionType xmlns="http://example.com/webservices">Stateless</SessionType>
</soapenv:Header>
Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
  • Possible duplicate of [How do you add a Soap Header defined in a wsdl to a web service client in CXF?](https://stackoverflow.com/questions/11767209/how-do-you-add-a-soap-header-defined-in-a-wsdl-to-a-web-service-client-in-cxf) – Federico klez Culloca Apr 03 '18 at 15:26
  • It's not very helpful there are some methods in this link that are not understandable. Can you please provide an easy java program for this? – Tufail Qurashe Apr 03 '18 at 18:40
  • List
    headersList = new ArrayList
    (); Header testHeader = new Header(new QName("uri:singz.ws.sample", "test"), "A custom header", new JAXBDataBinding(String.class)); headersList.add(testHeader); ((BindingProvider)proxy).getRequestContext().put(Header.HEADER_LIST, headersList); Can you please tell me what is proxy and qname in this code. How to define it? What is it used for?
    – Tufail Qurashe Apr 03 '18 at 19:48

0 Answers0