我在生成正确的 JAX-WS 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 并分别更改为每个参数,但我想将 VO 保留在那里并更改我的 XML 注释中的某些内容,但我找不到确切的内容。
我的JAVA界面:
@WebService
public interface IPag {
@WebResult(name="makePayment")
@WebMethod(operationName="makePayment")
public MakePaymentResponseVO makePayment(MakePaymentRequestVO vo);
}
我的请求VO:
@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...
}
我的回应VO:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {"status"})
@XmlRootElement(name = "makePaymentResponse")
public class MakePaymentResponseVO {
@XmlElement(name = "status")
private String status;
...get/set...
}
任何帮助将不胜感激,谢谢!!
在,AA。