Webservice JAXWS Client not working - Incorrect request XML



I am trying to create a Java WebService Client using wsimport(JAXWS). I am facing a null pointer exception in the code when invoking the webservice which is working otherwise with an Axis client.


Here's the XML which isnt working:



<xml-fragment xmlns:ns2="http://ift.tt/1ysbI8b" xmlns:S="http://ift.tt/sVJIaE">
<filter>ALL</filter>
<dates>
<dateFilter>ACTIVE_DATE_SINCE</dateFilter>
<startDate>2014-11-28T00:00:00.000-05:00</startDate>
</dates>
<whose>
<direct>false</direct>
<third>false</third>
</whose>


Here's the working XML:



<xml-fragment xmlns:xsd="http://ift.tt/tphNwY" xmlns:soap="http://ift.tt/sVJIaE" xmlns:xsi="http://ift.tt/ra1lAU">
<lltt:filter xmlns:lltt="http://ift.tt/1ysbI8b">MATCHING</lltt:filter>
<lltt:dates xmlns:lltt="http://ift.tt/1ysbI8b">
<lltt:dateFilter>AUDIT_DATE</lltt:dateFilter>
<lltt:startDate>2014-11-27T22:55:00</lltt:startDate>
</lltt:dates>
<lltt:whose xmlns:lltt="http://ift.tt/1ysbI8b">
<lltt:direct>true</lltt:direct>
<lltt:third>true</lltt:third>
</lltt:whose>


I am not sure why the code is not generating the namespace with the tags. I tried using the ObjectFactory to create the webservice Objct. But when I invoke the webservice from the port its creating a null pointer exception on the server side and generating the non working XML.


Here's my code to invoke the service. Also I am using the ObjectFactory to create the inner types


MyWebServicePortType port = getServicePort();


ObjectFactory factory = new ObjectFactory();


MyDataType type = factory.createMyDataType();


.....


port.getData(type); //Here's the null pointer exception on the server side


Can anyone please help me to understand what might be going wrong which creates the request xml that doesent work?


A lot thanks in advance


No comments:

Post a Comment