Java SOAPResponse to Marshall - Expected elements are <{}request>

Viewed 33

I want to map object from a SOAPResponse, so that, I'm using Marshall, but there is an error.

Response

<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header></env:Header>
<env:Body>
    <ns1:cancelShipmentResponse
        xmlns:ns1='http://yurticikargo.com.tr/ShippingOrderDispatcherServices'
        xmlns:ns2='http://yurticikargo.com.tr/ShippingOrderDispatcherServices'
        xmlns:ns3='http://yurticikargo.com.tr/WSExceptions/'>
        <ShippingOrderResultVO>
            <outFlag>1</outFlag>
            <outResult>Yurtiçi Kargo sisteminde kayıtlı TR kullanıcı adlı bir kullanıcı yok!</outResult>
            <errCode>1625</errCode>
            <count>0</count>
            <senderCustId>0</senderCustId>
        </ShippingOrderResultVO>
    </ns1:cancelShipmentResponse>
</env:Body></env:Envelope>

My Object

@XmlRootElement(name = "cancelShipmentResponse", namespace = "http://yurticikargo.com.tr/ShippingOrderDispatcherServices")@XmlAccessorType(XmlAccessType.FIELD)public class CancelShipmentResponse {@XmlElement(name = "ShippingOrderResultVO")ShipingOrderResultVO shipingOrderResultVO;}

My Codes

JAXBContext jc = JAXBContext.newInstance(CancelShipmentRequest.class);
        Unmarshaller unmarshaller = jc.createUnmarshaller();
        CancelShipmentRequest rc = (CancelShipmentRequest) unmarshaller.unmarshal(soapResponse.getSOAPBody());
0 Answers
Related