How can I change response xml in JAX-WS
Asked Answered
O

1

8

I have the following XML as my JAX-WS web service response:

<soapenv:Envelope>
    <soapenv:Header/>
    <soapenv:Body>
        <QueryRBTReqMsgResponse>
            <QueryRBTRspMsg>
                <resultHeader>
                    <resultCode>0</resultCode>
                    <resultDesc>Successful</resultDesc>
                </resultHeader>
                <!--Optional:-->
                <QueryRBTResponse>
                    <part>1</part>
                </QueryRBTResponse>
            </QueryRBTRspMsg>
        </QueryRBTReqMsgResponse>
    </soapenv:Body>
</soapenv:Envelope>

But this is what I want:

<soapenv:Envelope>
    <soapenv:Header/>
    <soapenv:Body>
        <QueryRBTRspMsg>
            <resultHeader>
                <resultCode>0</resultCode>
                <resultDesc>Successful</resultDesc>
            </resultHeader>
            <!--Optional:-->
            <QueryRBTResponse>
                <part>1</part>
            </QueryRBTResponse>
        </QueryRBTRspMsg>
    </soapenv:Body>
</soapenv:Envelope>

How can I remove the <QueryRBTReqMsgResponse> tag from my response? I tried too many changes but none of them did the job!!!

Olein answered 22/8, 2017 at 9:19 Comment(3)
How do you generate this response? How does the response POJO of your service look like? I am guessing it has QueryRBTReqMsgResponse as root element.Crossgarnet
This response generated by standard Jax-Ws java library and there is no Pojo.Olein
This is the response of a SOAP service somewhere. JAX-WS is just an API. Did you build the service that returns this response?Crossgarnet
O
3

Finally I found the solution. We have to use following annotation:

@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
Olein answered 20/12, 2017 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.