【发布时间】:2014-09-12 09:20:10
【问题描述】:
我是 web 服务的初学者,我正在从一个作为服务器的合作伙伴 API 使用 web 服务,我开发了一个网关应用程序,它将请求推送到作为客户端的我的 API。我这样做是因为我的 API 中的方法与合作伙伴的 API 不匹配。我已经探索了合作伙伴在 SOAPUI 上的 API 并确定了我需要的方法,我将其粘贴在下面:
<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>
向指定的端点 URL 提交请求后,我得到以下响应
<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>
我想将响应转换为 java 对象并在我的 GateWay 中使用它,但我不知道如何去做。有人可以帮助我吗?
【问题讨论】:
标签: java xml web-services jaxb soapui