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://schemas.xmlsoap.org/soap/envelope/" xmlns:hub="http://hub4api.cellulant.com/">
<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://schemas.xmlsoap.org/soap/envelope/">
Body>
<ns2:validateAccountResponse xmlns:ns2="http://hub4api.cellulant.com/">
<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?
You can use wsimport
to generate Java code for a certain (simple) webservice.
Take a look at http://docs.oracle.com/javase/7/docs/technotes/tools/share/wsimport.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.