Hello
Im trying to build a client to consume the web service defined here: http://my.hot-sos.net/HTNGListener/HTNGListener.asmx?WSDL
I've use the wsimport tool to generate the classes and one of the services (ping) works fine.
The other servcies, however, are giving me this error:
javax.xml.ws.soap.SOAPFaultException: Server was unable to process request. ---> No HTNG Header found in Soap Header
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at $Proxy30.receiveMessageSync(Unknown Source)
at com.pogo.test.HelloWorldClient.main(HelloWorldClient.java:29)
I think the problem is that the service expects a header. The generated code has a HTNGHeader factory but I cant find a method where to add this header to the request.
<wsdl:operation name="ReceiveMessageSync">
<soap12:operation soapAction="http://htng.org/1.1/Listener.Wsdl#ReceiveMessageSync" style="document" soapActionRequired="true" />
<wsdl:input>
<soap12:body use="literal" />
<soap12:header message="tns:ReceiveMessageSyncHTNGHeader" part="HTNGHeader" use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
<soap12:header message="tns:ReceiveMessageSyncHTNGHeader" part="HTNGHeader" use="literal" />
</wsdl:output>
</wsdl:operation>
This is how Im trying to invoke:
HTNGListener listener = new HTNGListener();
HTNGListenerSoap stub = listener.getHTNGListenerSoap();
stub.ping();
org.htng._1_1.header.ObjectFactory headerOF = new org.htng._1_1.header.ObjectFactory();
HTNGHeader header = headerOF.createHTNGHeader();
header.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar() );
//I've created the header, but dont know how to set it.
String request = "<GetMessages/>";
System.out.println(stub.receiveMessageSync(request));
Any advise is more than welcome.
Thanks
Gonso