WSO2 endpoint format - wso2

new to WSO2 but trying to do something that should be relatively straightforward even for the uninitiated, before I have a crack at some xslt mediation in a wso2 proxy.
All im trying to do as a first step is change the transport between the wso2 client (jms) and the endpoint (http). The client is sending a full soap envelope in the JMS payload.
I can see that my endpoint is being invoked from the server logs (however I can see requests are rejected).
Sure enough, I can see from the proxy logs that WSO2 is adding an additional SOAP envelope wrapper around the soap payload from the client.
My understanding is that this should be correctable by setting the format attribute of the endpoint to "leave as-is". This doesnt make a difference however. I suspect this is an easy endpoint or proxy configuration fix, rather than requiring some xsl mediation? Any guidnace gratefully received:
my code:
Endpoint:
<endpoint xmlns="http://ws.apache.org/ns/synapse">
<address uri="http://d26li228.au.alcatel-lucent.com:44006/ilws/InstantLinkSOA">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
Proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="McProxy3"
transports="McJMS"
statistics="disable"
trace="enable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint key="conf:/ilepr"/>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<parameter name="transport.jms.Destination">McQueue</parameter>
<description/>
</proxy>

Set the content type of the message you are receiving from JMS : if there is already a SOAP Envelope, it's text/xml :
<parameter name="transport.jms.ContentType">
<rules xmlns="">
<jmsProperty>contentType</jmsProperty>
<default>text/xml</default>
</rules>
</parameter>
If the service you're calling through your endpoint wait soap11 or soap12, you can set this format in your endpoint definition (don't let "leave as-is")
You've defined OUT_ONLY to true inside your inSequence, before sending your message through your endpoint : the ESB won't instanciate any callback and will not receive any response (outSequence will never be executed)

Related

Transport error: 404 Error: Not Found in wso2 esb

i use from wso2 esb to add proxy service. i hvae an error when i try to call this web service. this is my proxy service :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="citynetserviceMain"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="DISABLE_CHUNKING"
value="true"
scope="axis2"
type="STRING"/>
<send>
<endpoint>
<address uri="http://citynetservice..../CityBank.svc?wsdl"
format="soap12"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="http://citynetservice..../CityBank.svc?wsdl"/>
<description/>
</proxy>
when i try to call this proxy service it throw an exception :
<TryitProxyError xmlns:h="http://wso2.org/ns/TryitProxy" h:status="SOAP envelope error">org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found</TryitProxyError>
Not sure if you are facing the same issue as mine, but I've had the same problem when an other server (tomcat) was listening on port 8280.
The ESB start without any problem but you can find an error in esb logs that say that port is already in use
You can access ESB console on port 9443 and use "try this service", but in my case, tomcat were sending back a 404.
Hope it can help.

WS02: Invoking external weather SOAP webservice from ESB

I am trying to use WSO2 ESB (version 4.8.1) to invoke externally hosted SOAP web services. To try it out I was using a public web service for weather information (http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL), more specifically the GetWeatherInformation operation.
I have successfully consumed the web service using the soapUI tool.
I am a newcomer to SOAP and ESB, so I tried to follow a number of blog entries, but I keep on getting errors. I tried using proxy service, payload factory and send but still didn't manage. Can somebody please help me with setting this up?
Thanks
Here come a sample API to invoke GetWeatherInformation :
<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://ws.apache.org/ns/synapse"
name="testws3api"
context="/testws3api">
<resource methods="GET" url-mapping="/GetWeatherInformation">
<inSequence>
<payloadFactory media-type="xml">
<format>
<GetWeatherInformation xmlns="http://ws.cdyne.com/WeatherWS/"/>
</format>
<args/>
</payloadFactory>
<send>
<endpoint>
<address uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx" format="soap11"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</resource>
</api>
You just have to send a GET http request to http://esb.hostname:8280/testws3api/GetWeatherInformation (use SoapUI or type this address in your internet browser) and you will get back the XML response from the Weather WS
It works with this proxy conf deployed in WSO2 ESB v4.8.1 :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="testws3"
transports="https http"
startOnLoad="true"
trace="disable">
<target>
<endpoint>
<wsdl service="Weather"
port="WeatherSoap12"
uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"/>
</endpoint>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"/>
</proxy>

Why WSO2 Send Mediator doesn't wait for response?

I have a WSO2 ESB-4.6.0 proxy that calls another proxy that calls an webservice.
Proxy1 --> Proxy2 --> Endpoint
If I directly call the second proxy via soapUI, the response is correctly returned and printed, but if I call the first proxy, then an blank body is returned.
In the ESB log, the outSequence of the Proxy1 is printed before the outSequence of the Proxy2.
Seems like the Send mediator present in the inSequence of the Proxy1 is making an asynchronous call to the Proxy2.
I've tried to replace the Send mediator by the Callout mediator, but the result is the same.
Follow this tutorial, but it didn't works also.
How to forward the response for the Proxy2 to the caller?
Please help. It's killing me!
EDIT
Problem solved! I was using a wrong port to specify the serviceURL parameter for Callout mediator.
EDIT
The current proxies configuration:
Proxy1 (calling Proxy 2 - ManageWorkforce):
<proxy xmlns="http://ws.apache.org/ns/synapse" name="GetAppointmentSchedulePortalReqCS" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<xslt key="conf:ManageWorkforce/xslt/GetAppointmentSchedulePortalReqCS_Request.xsl"/>
<header name="Action" value="getAppointment"/>
<send>
<endpoint>
<address uri="https://localhost:9443/services/ManageWorkforce"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<xslt key="conf:ManageWorkforce/xslt/GetAppointmentSchedulePortalReqCS_Response.xsl"/>
<send/>
</outSequence>
<faultSequence/>
</target>
<publishWSDL key="conf:ManageWorkforce/GetAppointmentSchedulePortalReqCS.wsdl" />
</proxy>
Proxy 2 (calling Proxy3 -GetAppointmentPeopleProvCS):
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ManageWorkforce" transports="https http" startOnLoad="true" trace="disable">
<target>
<inSequence>
<switch source="get-property('Action')">
<case regex="getAppointment">
<callout serviceURL="https://localhost:8243/services/GetAppointmentPeopleProvCS" action="getAppointment">
<source xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
</case>
<!-- another cases -->
<default/>
</switch>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<header name="To" action="remove"/>
<send/>
</inSequence>
<outSequence>
<drop/>
</outSequence>
<faultSequence/>
</target>
<publishWSDL key="conf:ManageWorkforce/ManageWorkforce.wsdl"/>
</publishWSDL>
</proxy>
Proxy 3 (calling the service -GetAppointment):
<proxy xmlns="http://ws.apache.org/ns/synapse" name="GetAppointmentPeopleProvCS" transports="http https" serviceGroup="" startOnLoad="true" trace="disable">
<target>
<endpoint key="GetAppointment"/>
<inSequence>
<xslt key="conf:ManageWorkforce/xslt/GetAppointmentPeopleProvCS_Request.xsl"/>
</inSequence>
<outSequence>
<xslt key="conf:ManageWorkforce/xslt/GetAppointmentPeopleProvCS_Response.xsl"/>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
Final endpoint (service):
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="GetAppointment">
<address uri="http://10.13.6.75:9764/services/GetAppointment" />
</endpoint>
There are two mediators to invoke web services. Those are Callout Mediator and Call Mediator. The Callout mediator performs a blocking call and the Call Mediator performs a non-blocking call.
So, you should use Call mediator if you consider about performance. It's availble in ESB 4.8.0.
There are two samples for these in wiki docs.
There is another sample for Call Mediator from Dushan's blog. This has more complex mediators, but you can try out.
This is just a quick answer.
I hope this helps.
Thanks!
Proxy1 waits for the response from Proxy2 even you use the send mediator.
outSequence of the Proxy1 should not get executed before the execution of outSequence of Proxy2.
Switch to Callout Mediator is not the ideal solution for this.
I think there should be something wrong with the proxy configuration.
If you can post the proxy configuration here, we might be able to give you a help to solve this.

WSO2 ESB JMS sample showing vfs transport configuration error

I am trying to implement ESB as a JMS Consumer sample, given at WSO2 ESB documentation.
http://docs.wso2.org/display/ESB470/ESB+as+a+JMS+Consumer
I have followed below steps:
configuring JMS listener and sender in
ESB_Home\repository\conf\axis2\axis2.xml
copied all the jar file as mentioned
created a message queue in ActiveMQ using its web console.
Below is my proxy service code:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMStoHTTPStockQuote" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</target>
<description></description>
</proxy>
But still my proxy service is showing as faulty service. with the message:-
Unable to configure the service JMStoHTTPStockQuote for the VFS transport: Service doesn't have configuration information for transport vfs. This service is being marked as faulty and will not be available over the VFS transport.
As you can see I am not using VFS transport for my service and I have uncommented the code for VFS in axis2.xml but still I am getting this faulty exception.
First of all your proxy configuration is not correct. If you want to listen to a JMS queue, you need to use the jms transport in your proxy service. In the link you have mentioned, the proxy service is given as below.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMStoHTTPStockQuoteProxy" transports="jms">
<target>
<inSequence>
<property action="set" name="OUT_ONLY" value="true"/>
</inSequence>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
Here the transport is "jms". Please try with this config.

How we can process the Store and Forward Using JMS Message Stores

i have done all the changes in axis2 file and drop the jar files in lib
my message process is working fine and storing also
when ever i am sending request to proxy which consist store mediator and defined target.endpoint also after request message storing in message store its not processing
my configure files
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Message" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="faisal" value="faisal" scope="default" type="STRING"/>
<property name="target.endpoint" value="JmsChecking" scope="default" type="STRING"/>
<store messageStore="faisal5"/>
</inSequence>
<outSequence>
<log level="full"/>
</outSequence>
</target>
<description></description>
</proxy
and message store is
<messageStore name="faisal5" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.destination">faisal5_Queue</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
</messageStore>
and message processor
<messageProcessor name="faisal" class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" messageStore="faisal5" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="interval">1000</parameter>
<parameter name="max.delivery.attempts">4</parameter>
</messageProcessor>
and endpoint define which is like this
and its entries
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="JmsChecking">
<address uri="http://localhost:8282/services/JmscheckingEndpoint" format="soap11">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
end point consist log values proxy
proxy xmlns="http://ws.apache.org/ns/synapse" name="JmscheckingEndpoint" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="custom">
<property name="Message" value="JMs working fine"/>
<property name="value" expression="//mail/text()"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description></description>
</proxy>
Now i am sending my request
this log value is printing like this
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
[2013-07-25 11:42:03,039] INFO - LogMediator Message = JMs working fine, value = faisal.shaik#youtility.in
as well as message process is deactivating .if i am send one more request its just storing its not processing bcoz of message process is deactivate state
this JMS work only like this
MY scenario is i will get request if endpoint is available message will deliver and delete as well if endpoint is unavailable message will retry max mention times even also endpoint not available then it will store in message store
what is the use of this parameter will you please explain about this
i followed this link http://docs.wso2.org/wiki/display/ESB460/Store+and+Forward+Using+JMS+Message+Stores
where can i found this faisal5_Queue store point is it exist as folder
<parameter name="store.jms.destination">faisal5_Queue</parameter>
No it does not create a folder. when you mention the "store.jms.destination" using
faisal5_Queue wso2 esb will create an queue in your message broker(In your case ActiveMQ) with your specified name "faisal5_Queue". If you did not mention explicitly, WSO2 esb will create an queue with "YourMessageStoreName_Queue"
you can refer furthermore on these blogs to understand the behaviour of "Message Store" and "Message Processor"
http://vanjikumaran.blogspot.com/2013/08/jms-store-and-jms-processor-behavior.html
http://vanjikumaran.blogspot.com/2013/08/jms-messagenstore-and-jms-message.html
http://vanjikumaran.blogspot.com/2013/08/jms-messagen-store-and-jms-message.html