-
May 19th, 2011, 04:42 AM
#1
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<ImportAccountingCalc ulationResponse>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 at 06:50 AM.
-
May 29th, 2011, 02:45 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) {
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules