Reputation: 91
I am developing a POC on Spring Integration with following usecase.
my spring-int config xml has following
<int-ws:outbound-gateway id="marshallingGateway" request-channel="mdmIntInputChannel" reply-channel="mdmIntOutputChannel"
uri="ws-endpoint" marshaller="marshaller" unmarshaller="marshaller"/>
<oxm:jaxb2-marshaller id="marshaller" contextPath="com.veeaar.ws.types.jaxb"/>
Have all my jaxb generated source in my spring integration proj workspace.
While executing this in STS 3.8.3, the following error is being thrown.
Not sure what is wrong in my code. Any help resolving this is highly appreciated. Thanks.
Caused by: org.springframework.oxm.MarshallingFailureException: JAXB marshalling exception; nested exception is javax.xml.bind.MarshalException
- with linked exception:
[Exception [EclipseLink-25007] (Eclipse Persistence Services - 2.6.1.v20150916-55dc7c3): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor for class java.lang.String was not found in the project. For JAXB, if the JAXBContext was bootstrapped using TypeMappingInfo[] you must call a marshal method that accepts TypeMappingInfo as an input parameter.]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.convertJaxbException(Jaxb2Marshaller.java:908)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:684)
at org.springframework.ws.support.MarshallingUtils.marshal(MarshallingUtils.java:81)
at org.springframework.integration.ws.MarshallingWebServiceOutboundGateway$MarshallingRequestMessageCallback.doWithMessageInternal(MarshallingWebServiceOutboundGateway.java:129)
at org.springframework.integration.ws.AbstractWebServiceOutboundGateway$RequestMessageCallback.doWithMessage(AbstractWebServiceOutboundGateway.java:233)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:590)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
at org.springframework.integration.ws.MarshallingWebServiceOutboundGateway.doHandle(MarshallingWebServiceOutboundGateway.java:87)
at org.springframework.integration.ws.AbstractWebServiceOutboundGateway.handleRequestMessage(AbstractWebServiceOutboundGateway.java:188)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
... 36 more
Am explaining further my POC here to understand more why JAXB conversion needed before invoking the remote webservice.
The XSL transformation I doing in Spring Integ converts from input message of "Event" to "fetchCodeByName" message as given below.
<tns:fetchCodeByName xmlns:tns="http://www.veeaar.com/remote/wsdl/2010-1" xmlns:ns1="http://www.veeaar.com/remote/xml/2010-1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<ns1:Code>
<Name>xxx</Name>
</ns1:Code>
</tns:fetchCodeByName>
In WSDL, fetchCodeByName is mapped to CodesType of ns1 namespace. Have generated JAXB classes from 'Codes' schema XSD.
Before invoking the remote web service, if I create a service activator and try to unmarshall the transformation output to JAXB object, we get error reporting as unmarshalling task expecting 'Codes' as root element not 'fetchCodeByName'.
How to resolve this issue?
Is there any way in Spring Integration, can we invoke a remote web service without marshall and unmarshal the input message? Can't we just direct the XSLT output straightway to int-ws:outbound-gateway?
Upvotes: 0
Views: 1218
Reputation: 121272
Why do you need to unmarshal before WS Outbound Gateway? You see, you then marshal it again! Just use simple
WS Outbound Gateway variant (without marshaller
) and send an XSLT transformer result in its input
channel as is.
Upvotes: 1