Is it possible to send the wsdl request body in active mq using camel route. If yes who can i achieve this below is my sample code in which im trying to send the wsdl request body in a queue but its not happening.
<route id="report">
<from id="_from2" uri="direct:reportIncident"/>
<to id="_to3" uri="activemq:queue:in.incident.report"/>
<process id="_process1" ref="reportIncidentProcessor"/>
<to id="_to1" uri="log:output"/>
</route>
I got below exception in my fuse.log file
org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 20000 millis due reply message with correlationID: Camel-ID-NISB-TEC-C3880-54427-1496206891706-5-5 not received on destination: temp-queue://ID:NISB-TEC-C3880-54424-1496206882676-7:1:1. Exchange[ID-TEC-1496206891706-5-4]
at org.apache.camel.component.jms.reply.ReplyManagerSupport.processReply(ReplyManagerSupport.java:153)[246:org.apache.camel.camel-jms:2.17.0.redhat-630077]
at org.apache.camel.component.jms.reply.TemporaryQueueReplyHandler.onTimeout(TemporaryQueueReplyHandler.java:62)[246:org.apache.camel.camel-jms:2.17.0.redhat-630077]
A web service call is InOut by default and when you send to the ActiveMQ it conveys that same style so it would expect a reply message which you wont get and therefore you see that exception.
So if you want to send a InOnly (fire and forget) message to the ActiveMQ, then you need to specify that
<to id="_to3" uri="activemq:queue:in.incident.report"/>
Should be
<to id="_to3" pattern="InOnly" uri="activemq:queue:in.incident.report"/>
See more at:
- http://camel.apache.org/event-message.html
- http://camel.apache.org/request-reply.html
Related
I'm developing workflow application in Apache camel
Business Use case:
Service is exposed at consumer endpoint
Processing with request message
Call external SOAP Service, get the response
check particular tag in response xml and then only call another external SOAP Service
Return the final response to client
Now I got stuck in step 4
My camel Route is
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route streamCache="true">
<from uri="cxf:bean:proxyEndpoint"/>
<process ref="myProcessor"/>
<!-- processing request & logging -->
<setBody>
<!-- set request as body required for calling external web service -->
</setBody>
<to uri="cxf:bean:panEndpoint"/>
<!-- <to uri="file:C:/LOG" /> -->
<!-- <process ref="myProcessor2"/> -->
<log message=">>> ${body}" loggingLevel="INFO"/>
</route>
</camelContext>
I'm able to call external Service but after <to uri="cxf:bean:panEndpoint"/> if I try to log body I'm getting arbitrary value same in case of routing to file.
When I tried to route to Processor and print System.out.println(exchange.getIn().getBody());
I'm getting sun.net.www.protocol.http.httpurlconnection$httpinputstream which I'm unable to parse or process
External Service is called and proper response is receiving as I tried to monitor the scenario using TCP-IP Monitor
Any help will be appreciated.
Tell Camel what type you want the body as, and it uses its type converter to make that happen (if possible).
So if you want the body as a InputStream do
exchange.getIn().getBody(InputStream.class)
If you want it as String, then do
exchange.getIn().getBody(String.class)
Read more here
http://camel.apache.org/type-converter.html
And when working with streams mind about stream caching
http://camel.apache.org/stream-caching.html
I'm using Apache CXF 2.5.9 within Mule ESB 3.5.0 CE for a Web Service client. If the soap message validation fails on server I get a soap fault (naturally) that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>https://10.1.104.105:8444/DohvatiIzOIBaF2FAServiceTest: cvc-simple-type 1: element {http://www.apis-it.hr/fin/2008/elements/DohvatIzOIBa}OIB value '716500116650' is not a valid instance of type {http://www.apis-it.hr/fin/2008/types/f63}String11BrojType</faultstring>
<faultactor>OIB CIS pristupni čvor</faultactor>
</soapenv:Fault>
..but when client side tries to unmarshall the fault I get this exception:
2014-12-13 13:52:34,199 [WARN] org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://www.apis-it.hr/fin/2010/services/DohvatiIzOIBaF2FAService}DohvatiIzOIBaF2ServicePortTypeService#{http://www.apis-it.hr/fin/2010/services/DohvatiIzOIBaF2FAService}DohvatiFOPoOIBu has thrown exception, unwinding now
java.lang.RuntimeException: Invalid QName in mapping: SOAP-ENV:Client
at org.apache.cxf.staxutils.StaxUtils.readQName(StaxUtils.java:1399)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:59)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:114)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)
I want the CXF client to unmarshall the soap fault to exception. How to get around this error?
Try making SOAP-ENV:Client something like this 12345, making the fault code a number solved it for me.
Mule won't catch the exception itself.
You should probably use a cxf fault interceptor. From there you can compose the message you are expecting.
Alternativly you could use the CXF transform feature
You need:
<entry key="faultcode" value="faultcode=soapenv:Client"/>
This will map the original invalid fault from the server into the following valid fault so that it can be accepted by the cxf client
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>An error occurred</faultstring>
</soapenv:Fault>
We have produced JAX-WS web-services with the help of Java API and published. Now we would like to queuing the requests, which are coming for the services with the help of JMS. We chosen the ACTIVE MQ JMS Server with the combination of MULE ESB.
We have tried the proxying of webservices with the help of two Http Endpoints. It is working fine. So When i trying to test it by sending request from SOAP UI to Http inbound end point, it is forwarding request to my services and get back the response to SOAP UI.
But when we are trying to put the JMS endpoint in between these Http end points, the request is forwarded to my services, but not the message (SOAP).
Please help me to resolve the issue or suggest me the alternative way for Queuing.
Following image shows flow in MULE.
.
Following is the flow :
<jms:activemq-connector name="Active_MQ1" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="finalFlow1" doc:name="finalFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8888" contentType="text/xml" doc:name="HTTP"/>
<jms:outbound-endpoint exchange-pattern="request-response" queue="servicesQueue" connector-ref="Active_MQ1" doc:name="JMS"/>
<http:outbound-endpoint mimeType="text/xml" doc:name="HTTP" exchange-pattern="request-response" method="POST" path="MyServices" host="localhost" port="5050" />
</flow>
Actually MyServices is produced at http://localhost:5050/MyServices
The problem is probably due to that you are expecting a string payload in your JMS queue and the http:inbound-endpoint produces a stream payload.
Try putting <object-to-string-transformer/> before the jms:outbound-endpoint.
We have a SOAP service that I want to proxy in WSO2 ESB. This is for POC that I am working on. I came across various documents and some explanation on forums but nothing concrete yet. I looked at API option but couldn't get anything to work. Whats the best way to do this? Can the transformation occur in esb itself or is the api the only option? Please advise.
You can better choose RESTAPI option.
Here is the documentation for that
What do you mean by couldn't get this working? This is not a big configuration, you need to define your proxy service such that you send the message (REST message) to the back end as a SOAP message. Here is a sample configuration.
<proxy name="StockQuoteProxy" transports="http https" startOnLoad="true">
<target>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"
format="soap11"/>
</endpoint>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
You can call this proxy in REST manner and it will automatically send the message to the backend SOAP service.
you can do it with the sample axis2 client as below.
ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Drest=true
I have been given a REST URI from my client which is as follows:
https://vm3.digitary.net/verifier/HEDDRequestDocumentAccess
Following request xml has to be POSTed to the above URI to get the response xml.
<documentAccessRequest xmlns="http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013 http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013">
<head>
<institutionCode>BBCU</institutionCode>
<username>HEDDUser</username>
<password>HEDDPass</password>
</head>
<body>
<heddEnquiryId>12347895844</heddEnquiryId>
<enquiree>
<email>jane#doe.com</email>
<firstName>Jane</firstName>
<lastName>Doe</lastName>
</enquiree>
<enquirer>
<organisation>BBC</organisation>
<contactName>Jeremy Clarkson</contactName>
</enquirer>
<documentRequested>HEAR</documentRequested>
</body>
</documentAccessRequest>
Now I have the requirement to make my own wrapper REST API in WSO2 ESB 4.6.0 which would simply call the above mentioned REST URI having the same request and response XML. The idea is to make the pass through REST API to above mentioned API.
I have implemented the following REST API:
<api xmlns="http://ws.apache.org/ns/synapse" name="TestDareRest" context="/documentRequest" hostname="46.137.187.137" port="8280">
<resource methods="POST" url-mapping="/request/*">
<inSequence>
<log/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<endpoint>
<address uri="https://vm3.digitary.net/verifier/HEDDRequestDocumentAccess" format="pox"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log/>
<property name="ContentType" value="application/xhtml+xml" scope="axis2"/>
<send/>
</outSequence>
</resource>
</api>
But above API is not working at all and it is gving loads of errors in the esb console. I am using the SOAPUI to test this REST service and posting the same request xml from there. The service is deployed on our public Ip server and can be seen by login in to following
https://46.137.187.137:9443/carbon/admin/index.jsp with username/pwd as admin/admin
I have tried setting both media type in SOAPUI as text/xml and application/xml
In case of text/xml it is giving error as follows:
org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found documentAccessResponse
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
In case of application/xml it is giving following error
INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:53a782ab-2081-4cb1-9e94-910b75816361, Direction: response
[2013-04-10 16:05:12,911] ERROR - PassThroughHttpSender Failed to submit the response
java.lang.UnsupportedOperationException
Please help me with this issue as it has got much critical to me.
Thanks in Advance
Shakshi
Can you switch the transport to nonblocking transport and check?
You can change the transport sender and receiver in the axis2.xml.
The media type is to be application/xml ..not the text/xml, which is used fro soap requests.
To post a request you can use curl utility.
# curl -X POST -d #request.xml "URL"