0

正しい 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.

4

1 に答える 1

0

MakePaymentResponseVO の名前を @WebResult に入れてみましたか? :

JAVA インターフェイス:

@WebService
public interface IPag {
        @WebResult(name="makePaymentResponse", targetNamespace="http://.../")
        @WebMethod(operationName="makePayment")
        public MakePaymentResponseVO makePayment(MakePaymentRequestVO r);
}
于 2013-10-16T12:25:18.063 に答える