Hi,
I think there are something wrong with your jbi message.
Which version of camel or servicemix are you using?
Willem
angel.ortiz wrote:
Hi,
I was able to transform the SOAP request into JBI. Now my message can be
evaluated by my camel flow:
Predicate isRequestA = body().contains("ServiceName1");
Predicate isRequestB = body().contains("ServiceName2");
Predicate isRequestC = body().contains("ServiceName3");
errorHandler(deadLetterChannel().maximumRedeliveries(0));
from("jetty:http://localhost:9080/research_msp/VirtualService")
.to("log:IN")
.process(new SOAPRequestTransformProcessor())
.to("log:TRANSFORMED")
.tryBlock()
.choice()
.when(isRequestA)
.to("log:REQUEST_A")
.to("jbi:service:http://path.to.service/ServiceName1//ServiceName1WSDL")
.to("log:RESULT1")
.when(isRequestB)
.to("log:REQUEST_B")
.to("jbi:service:http://path.to.service/ServiceName2//ServiceName2WSDL")
.to("log:RESULT2")
.when(isRequestC)
.to("log:REQUEST_C")
.to("jbi:service:http://path.to.service/ServiceName3//ServiceName3WSDL")
.to("log:RESULT3")
.otherwise()
.to("log:NOT_SUPPORTED")
.throwFault(new IllegalArgumentException("The requested operation is not
supported."))
.exception(Exception.class)
.to("log:ERROR")
.throwFault(new Exception("An unexpected error occurred"))
.end();
Now I have a really dumb error here that I haven't figured out yet... The
thing is, when I send a SOAP request to my jetty endpoint it is read and
transformed correctly. In my test the predicate isRequestB evaluates to
true and in the ServiceMix screen I can see the following:
...
INFO - REQUEST_B -
Exchange[BodyType:org.apache.camel.converter.stream.StreamCacheConverter.InputStreamCache,
Body:<jbi:message xmlns="http://java.sun.com/xml/ns/jbi"
xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"><jbi:part><sons:displayInformation
xmlns:sons="http://path.to.service/InformationService/"><approver>000000001</approver></sons:displayInformation></jbi:part></jbi:message>
]
[Fatal Error] :-1:-1: Premature end of file.
[Fatal Error] :-1:-1: Premature end of file.
ERROR - CxfBcComponent - Error processing exchange InOut[
id: ID:127.0.0.1-123ee902cef-3:0
status: Active
role: provider
service: {http://path.to.service/ServiceName2/}ServiceName2WSDL
endpoint: ServiceName2WSDLSOAP
operation: {http://path.to.service/ServiceName2WSDL/}displayInformation
in: Unable to display: org.xml.sax.SAXParseException: Premature end of
file.
]
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException:
Premature end of file.
at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:501)
at
org.apache.servicemix.cxfbc.CxfBcProvider.convertMessageToInputStream(CxfBcProvider.java:691)
at
org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:232)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)
at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
... 13 more
What I understand from the above exception is that there is something wrong
with the XML being sent to the jbi service. Maybe is not even sending
anything... not sure.
Any ideas on this one?
Angel
willem.jiang wrote:
Hi,
You may need to take the operation name out of the soap message, and put
it as the value of jbi:message type attribute.
Here is an example
<jbi:message xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"
xmlns:msg="http://cxf.component.camel.apache.org" type="msg:echo">
<jbi:part>
<ns1:echo xmlns:ns1="http://cxf.component.camel.apache.org">
<arg0 xmlns="http://cxf.component.camel.apache.org">Hello
World!</arg0></ns1:echo>
</jbi:part>
</jbi:message>
Willem