tags:

views:

16

answers:

0

Hi All,

I need to create Client classes for webservices hosted remotely. I used WSDL2JAVA (axis2-1.4.1) to generate java code out of the WSDL provided by my client. This tool gave me the source code and a build.xml. I then ran the ant build provided to get the jar. Command used to generate the code:

wsdl2java -p net.XXX.web.wsclient -d xmlbeans -uri vz.wsdl

ant gave me a jar and I kept it in the project classpath, I then able to get the response xml successfully from the webservice.

Response XML:

<m:getUserProfileByVOLNameResponse xmlns:m="http://netservices.XXX.net/vasipvsi/vsi_servicedetails_webservice"&gt;
    <result xsi:type="n1:SearchVSIResult" xmlns:n1="java:net.XXX.vsi.datatype.asurion" xmlns:xsi="xsi">
        <errorCode xsi:type="xsd:string">000000</errorCode>
        <errorString xsi:type="xsd:string">No error</errorString>
        <version xsi:type="xsd:string">XYZ</version>
        <userProfiles soapenc:arrayType="n2:UserProfile[1]" xmlns:n2="java:net.XXX.vsi.datatype" xmlns:soapenc="soapenc">
            <UserProfile xsi:type="n2:UserProfile">
                <accessAccountId xsi:type="xsd:string">010101010</accessAccountId>
            </UserProfile>
        </userProfiles>
    </result>
</m:getUserProfileByVOLNameResponse>

But when I use the getter methods to extract out the values from the response xml, they are returning only null.

GetUserProfileByVOLNameDocument reqDoc = GetUserProfileByVOLNameDocument.Factory.newInstance();
GetUserProfileByVOLNameDocument.GetUserProfileByVOLName req =
                    reqDoc.addNewGetUserProfileByVOLName();
req.setString("XXXX");

GetUserProfileByVOLNameResponseDocument responseDoc = stub.getUserProfileByVOLName(reqDoc);

responseDoc.getGetUserProfileByVOLNameResponse().getResult() is printing the xml output (fragment). But when I use responseDoc.getGetUserProfileByVOLNameResponse().getResult().getErrorString() its giving me null (none of the getter methods seems to be working here).

Please help me to figure out the issue as it is crucial for further work.

NOTE: I am using JDK 1.6, AXIS2 1.4.1, ANT 1.7.0

Thanks in advance.