Converting xml SOAPUI response to Java Object



Am a beginner in webservices, am working on consuming a webservice from a partner API which will act as the server, i have developed a Gateway application that will push requests to my API which will act as the client. i did this as the methods in my API and the partner's API do not match. i have explored the partner's API on SOAPUI and identified the method that i require, which i have pasted below:



<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE" xmlns:hub="http://ift.tt/YCChdh">
<soapenv:Header/>
<soapenv:Body>
<hub:validateAccount>
<credentials>
<username>?</username>
<password>?</password>
</credentials>
<packet>
<!--1 or more repetitions:-->
<Item>
<serviceID>?</serviceID>
<serviceCode>?</serviceCode>
<accountNumber>?</accountNumber>
<requestExtraData>?</requestExtraData>
</Item>
</packet>
</hub:validateAccount>
</soapenv:Body>
</soapenv:Envelope>


After submiting request to specified endpoint URL, i get the below response



<S:<S:Envelope xmlns:S="http://ift.tt/sVJIaE">
Body>
<ns2:validateAccountResponse xmlns:ns2="http://ift.tt/YCChdh">
<return>
<authStatus>
<authStatusCode>131</authStatusCode>
<authStatusDescription>Authentication was a success</authStatusDescription>
</authStatus>
<results>
<Item>
<statusCode>307</statusCode>
<statusDescription>Account number provided is valid</statusDescription>
<serviceID>130</serviceID>
<serviceCode/>
<accountNumber>XXXXXXXX</accountNumber>
<active>yes</active>
<responseExtraData>{"Currency":"XXX","VALUE":"33.54","DueDate":"2014-09-12T00:00:00+07:00"}</responseExtraData>
</Item>
</results>
</return>
</ns2:validateAccountResponse>
</S:Body>
</S:Envelope>


I want to convert the response into a java object and use it in my GateWay but i dont know how to go about it. Can someone please assist me?


No comments:

Post a Comment