我使用SOAP服务。我不使用任何IDE。我有一个Shell脚本来编译,部署和取消部署Web服务。
我还有以下shell脚本
/lib/jaxws-ri-2.2.8/bin/wsgen.sh -verbose -keep -cp ./classes -d ./classes -s ./src com.uciext.ws.hw4.service.impl.OrderServiceWSImpl
我在java类中更改了WSDL请求元素的名称空间。
wsdl的网址是
http://localhost:8080/inventoryWS/ws/OrderServiceHw4?wsdl
请求是
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://inventory.service.hw4.ws.uciext.com">
<soapenv:Header/>
<soapenv:Body>
<inv:submitOrder>
<!--Optional:-->
<inv:order>
<vendorCode>?</vendorCode>
<vendorName>?</vendorName>
<orderNumber>?</orderNumber>
<!--1 or more repetitions:-->
<inv:productOrder>
<!--Optional:-->
<productSku>?</productSku>
<!--Optional:-->
<productName>?</productName>
<!--Optional:-->
<orderQuantity>?</orderQuantity>
</inv:productOrder>
</inv:order>
</inv:submitOrder>
</soapenv:Body>
</soapenv:Envelope>
我要删除inv:productOrder并更改productOrder
要实现这一点,我有一个Java类
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"vendorCode",
"vendorName",
"orderNumber",
"productOrder"
})
@XmlRootElement(name = "order")
public class Order {
@XmlElement(required = true)
protected String vendorCode;
@XmlElement(required = true)
protected String vendorName;
@XmlElement(required = true)
protected String orderNumber;
**@XmlElement(required = true, namespace = "")
protected List<ProductOrder> productOrder;**
如何更新WSDL请求的名称空间?