![](/img/trans.png)
[英]How to get the text value of an element in Groovy from within a soap envelope XML message
[英]How to get value from soap message?
我想问一下是否有任何方法可以从肥皂请求中检索数据? 我知道这个问题可能会经常被问到。 但是,我找不到适合我问题的好答案。 这是我的要求:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:getFruit soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<aGetFruitRequest href="#id0"/>
</ns1:getFruit>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:GetFruitRequest">
<name xsi:type="xsd:string">apple</name>
<type xsi:type="xsd:string">fruit</type>
</multiRef>
</soapenv:Body>
我想获取标记“名称”和“类型”中的值“苹果”和“水果”。 有什么办法可以在Java中做到这一点吗?
谢谢
您可以使用Apache Axis,或者如果要提取所有值,则可以使用JXPath自己解析响应。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.