2
我的任务是编写一个更新操作的web服务,其中一个对象列表传递给该方法。JAXWS中SOAP请求参数的JAXB绑定
@WebMethod(operationName = "updateObjects", action = "urn:preferences")
public boolean updateObjects(List<MyObject> objects){
}
MyObject类很简单。
@XmlRootElement(name="Object")
public class MyObject{
private String item1;
private String item2;
}
现在的问题陈述。当我看到这个方法(对我产生的SOAP UI)的SOAP请求,该请求看起来象下面这样:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
<soapenv:Header/>
<soapenv:Body>
<pref:updateObjects>
<!--Zero or more repetitions:-->
<arg0>
<!--Optional:-->
<item1>?</item1>
<!--Optional:-->
<item2>?</item2>
</arg0>
</pref:updateObjects>
</soapenv:Body>
</soapenv:Envelope>
,但我希望它看起来像下面。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
<soapenv:Header/>
<soapenv:Body>
<pref:updateObjects>
<!--Zero or more repetitions:-->
<Objects>
<Object>
<!--Optional:-->
<item1>?</item1>
<!--Optional:-->
<item2>?</item2>
</Object>
<Object>
<!--Optional:-->
<item1>?</item1>
<!--Optional:-->
<item2>?</item2>
</Object>
</Objects>
</pref:updateObjects>
</soapenv:Body>
</soapenv:Envelope>
有人可以请指教。提前致谢。
非常感谢的快速反应ggarcio ..难道没有办法,我们可以做到这一点,而无需通过做这个包装对我们任何注释创建的包装类( )?我有8个这样的方法为不同的对象列表:( – Vinay
检查更新的答案:-) – ggarciao
它的工作先生...保存了我一些时间..接受你的答案..干杯... – Vinay