Announcement Announcement Module
Collapse
No announcement yet.
JAXB unmarshalling Issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JAXB unmarshalling Issue

    I am implementing a Web Service using Spring WS 2.x using an existing XSD which cannot be changed. Following is my Endpoint method :

    Code:
    private static final String NAMESPACE_URI = "http://www.xyz.com/cfr/statusrequest";
    
    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "UpdateStatusRequest")
    	@ResponsePayload
    	public UpdateStatusResponse handleUpdateStatusRequest(@RequestPayload UpdateStatusRequest updateStatusRequest) {
    		System.out.println(updateStatusRequest.getStCo());
    		
    		String statusCode = updateStatusService.updateStatus(updateStatusRequest.getUNa(), updateStatusRequest.getStCo(), updateStatusRequest.getInID().longValue());
    		
    		UpdateStatusResponse updateStatusResponse = new UpdateStatusResponse()
    		updateStatusResponse.setErC("Sample Error Code");
    		updateStatusResponse.setReT(statusCode) ;
    		
    		return updateStatusResponse;
    	}
    We are using JAXB marshaller to marshal & unmarshall configured as follows :

    Code:
    <oxm:jaxb2-marshaller id="marshaller" contextPath="com.xyz.cfr.ws.vo"></oxm:jaxb2-marshaller>
    When call the method using the SOAP UI gives following error :

    No adapter for endpoint [public com.xyz.cfr.ws.vo.UpdateStatusResponse com.xyz.cfr.ws.endpoint.UpdateStatusEndpoint.handl eUpdateStatusRequest(com.xyz.cfr.ws.vo.UpdateStatu sRequest)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?


    I have tried to remove the return object "UpdateStatusResponse" and it works fine, which makes me feel there is a problem with the unmarshalling of response.

    The XSD for the UpdateStatusResponse is as follows:

    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:sres="http://www.xyz.com/cfr/statusresponse" targetNamespace="http://www.xyz.com/cfr/statusresponse"
         elementFormDefault="qualified">
        <annotation/>
        <element name="UpdateStatusResponse" type="sres:UpdateStatusResponse">
            <annotation>
                <documentation>Update Status Response</documentation>
            </annotation>
        </element>
        <complexType name="UpdateStatusResponse">
            <sequence>
                <element name="ReT">
                    <annotation>
                        <documentation>Response Type</documentation>
                    </annotation>
                    <simpleType>
                        <restriction base="string">
                            <enumeration value="S"/>
                            <enumeration value="F"/>
                        </restriction>
                    </simpleType>
                </element>
                <element name="ErC" type="string">
                    <annotation>
                        <documentation>Error Code</documentation>
                    </annotation>
                </element>
            </sequence>
        </complexType>
    </schema>
    Can someone provide a pointer as to where as I going wrong ?
Working...
X