• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding header - Webservice client - JDK 1.4  RSS feed

kalpana Kumar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Need help with the below.
I am trying to add header(authentication token) to a webservice client call as part of the header. This is done by a single line of code in JDK 5 and higher versions as below. But how to accomplish the below equivalent in JDK 1.4 and Axis 1.4.

headers.add(com.sun.xml.ws.api.message.Headers.create( authenticationElement) );
( (WSBindingProvider) wsClientEndpoint).setOutboundHeaders( headers );

The Soapmessage is as below.

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

com.sun.xml.ws.api.message.Headers - This is given as part of JDK 6.0. But I cannot use JDK 6.0 and should do the above in JDK 1.4.

Since I could not find the above equivalent in JDK 1.4, I tried creating a SOAPMessage and tried posting the same using SOAPConnection - javax.xml.soap.SOAPConnection to the destination.

as below
SOAPMessage reply = connection.call(soapmsg,destination);

But the reply gives SOAPMessageImpl[SOAPPartImpl[null]] as output.

Not sure what is happening. I am trying to achieve the same in both the cases, posting a message to the destination. Please suggest.

Thanks in Advance.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!