0
我遇到註解問題以生成正確的JAX-WS xml結構。JAX-WS - 從VO參數中刪除內部XML根
實際上,對於WSDL生成的XML請求結構是這樣的:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:test="http:..ommited..">
<soapenv:Header/>
<soapenv:Body>
<test:makePayment>
<makePayment> <----- this is the problem, i want to remove it
<value></value>
<date></date>
</makePayment>
</test:makePayment>
</soapenv:Body>
</soapenv:Envelope>
及其響應:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<test:makePaymentResponse xmlns:test="http://.../">
<makePayment> <----- this is the problem, i want to remove it
<status></status>
</makePayment>
</test:makePaymentResponse>
</S:Body>
</S:Envelope>
我想刪除內makePayment標籤並讓請求/響應像這:
<soapenv:Body>
<test:makePayment>
<value></value>
<date></date>
</test:makePayment>
</soapenv:Body>
<soapenv:Body>
<test:makePaymentResponse>
<status></status>
</test:makePayment>
</soapenv:Body>
據我所知,它可能會簡單地刪除VO回來m方法參數並單獨更改爲每個參數,但我想保留VO並在XML註釋中更改某些內容,但我找不到具體的內容。
我的Java接口:
@WebService
public interface IPag {
@WebResult(name="makePayment")
@WebMethod(operationName="makePayment")
public MakePaymentResponseVO makePayment(MakePaymentRequestVO vo);
}
我RequestVO:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {"value","date"})
@XmlRootElement(name = "makePaymentRequest")
public class MakePaymentRequestVO {
@XmlElement(name = "value", required = true)
private String value;
@XmlElement(name = "date", required = true)
private String date;
...get/set...
}
我ResponseVO:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {"status"})
@XmlRootElement(name = "makePaymentResponse")
public class MakePaymentResponseVO {
@XmlElement(name = "status")
private String status;
...get/set...
}
任何幫助,將不勝感激,謝謝!
At, AA。
謝謝您的回答,我改變了像你說的。但是這是新的XML響應: <試驗:makePaymentResponse的xmlns:測試=「HTTP: //.../「> ><---我仍然想刪除它 > > makePaymentResponse> >測試:makePaymentResponse> > > –