如何删除根元素并修改标签以响应

时间:2019-01-21 13:10:19

标签: java jax-ws

我无法从Java获得此结果。我需要在下面重新创建确切的响应。我对注释不是很熟悉

public TestIface(){

private String code;
private String codeDesc;

    @WebMethod(operationName = "Test")
    public TestIface Test(@WebParam (name = "Code", targetNamespace = "http://aaa.com.ph/") String ac,) {

        TestIface testIface= new TestIface();
        testIface.setCode("0000");
        testIface.setCodeDesc("TEST");

        return testIface;
    }
}

实际结果:

    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
       <S:Body>
          <ns2:TestResponse xmlns:ns2="http://aaa.com.ph/">
             <return>
                <code>0000</code>
                <codeDesc>TEST</codeDesc>
             </return>
          </ns2:TestResponse>
       </S:Body>
    </S:Envelope>

预期结果:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
          <NS1:TestResponse xmlns:NS1="http://aaa.com.ph/">
             <code>0000</code>
             <codeDesc>TEST</codeDesc>
          </NS1:TestResponse>
       </soapenv:Body>
    </soapenv:Envelope>

0 个答案:

没有答案
相关问题