Announcement Announcement Module
Collapse
No announcement yet.
Unable to read SoapHeader in Endpoint class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to read SoapHeader in Endpoint class

    Hi,

    I am using spring WS 2.0 and wanted to read the soapheader in my endpoint class.
    I am getting below error "No adapter for endpoint" :

    HTTP/1.1 500 Internal Server Error
    Server: Apache-Coyote/1.1
    Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    SOAPAction: ""
    Content-Type: text/xml;charset=utf-8
    Content-Length: 818
    Date: Thu, 19 May 2011 09:36:51 GMT
    Connection: close

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring xml:lang="en">No adapter for endpoint [public javax.xml.bind.JAXBElement&lt;ImportAccountingCalc ulationResponse&gt;ServicePayloadRootAnnotationEnd Point.importAccCalDetails(ImportAccountingCalculat ion,org.springframework.ws.soap.SoapHeader)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

    Endpoint class
    @PayloadRoot(localPart = "Import", namespace = IMPORT_MESSAGES_NAMESPACE)
    public JAXBElement<ImportAccountingCalculationResponse> importAccCalDetails(Import import,
    SoapHeader header) {
    ImportResponse importResponse = JAXB_OBJECT_FACTORY.createImportResponse();
    importResponse = importService.importAccCalDetails(import);
    System.out.println();

    return new JAXBElement<ImportResponse>(new QName(
    IMPORT_MESSAGES_NAMESPACE,IMPORT_ACC_CAL_RESPONSE) , ImportResponse.class, importResponse);
    }

    Apllication context

    <sws:interceptors>
    <bean class="org.springframework.ws.server.endpoint.inte rceptor.PayloadLoggingInterceptor"/>

    </sws:interceptors>


    <bean id="importServiceEndpoint"
    class="endpoint.calculationmanager.ImportServicePa yloadRootAnnotationEndPoint">
    <constructor-arg>
    <bean class="service.impl.ImportServiceImpl"/>
    </constructor-arg>
    </bean>

    <bean class="org.springframework.ws.server.endpoint.adap ter.GenericMarshallingMethodEndpointAdapter">
    <constructor-arg ref="marshaller" />
    </bean>

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="contextPaths">
    <list>
    <value>schemas.calculationmanager</value>
    <value>schemas.manager</value>
    </list>
    </property>

    </bean>

    Note: If i remove the SoapHeader header argument from endpoint class then i am getting the response back.

    Can anyone suggest what mapping is required to read the SoapHeader in endpoint class.

    Any help is appriciated

    -Savita
    Last edited by SavitaSingh; May 21st, 2011, 06:50 AM.

  • #2
    This is resolved, we do not need to cast response back to JAXB object.

    public JAXBElement<ImportAccountingCalculationResponse> importAccCalDetails(Import import,
    SoapHeader header) {
    change this to as per below then soap header will be available

    public ImportAccountingCalculationResponse importAccCalDetails(Import import,
    SoapHeader header) {
    }

    Comment


    • #3
      I am getting same error...Kindly help me....

      Code:
      @PayloadRoot(localPart="AccountDetailsRequest", namespace="http://com/xxxx/selva/samples/webservices/accountservice")
       @ResponsePayload
         public AccountDetailsResponse DetailsRequest(@RequestPayload JAXBElement<ReqType> element,SoapHeader header)
           throws BusinessException

      error:

      Code:
      <faultstring xml:lang="en">No adapter for endpoint [public com.xxx.selva.samples.xjcschema.AccountDetailsResponse com.xxxx.selva.samples.services.endpoints.AccountServiceEndpoint.DetailsRequest(javax.xml.bind.JAXBElement&lt;com.xxx.selva.samples.xjcschema.ReqType>,org.springframework.ws.soap.server.endpoint.annotation.SoapHeader) throws com.xxxx.selva.samples.exception.BusinessException]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
      
        {

      Comment

      Working...
      X