0

I am new to wso2

I have created a Custom Proxy Service to call a backend Soap Service... I need to POST a Soap XML request to back end service,using a proxy service.. I am using REST CLIENT (Mozilla firefox addon) for calling my proxy service

I put the method as POST and content type as text/xml

Below is my proxy service configuration

<target>
    <inSequence>
        <property name="messageType" value="text/xml" scope="axis2" type="STRING"/>
    </inSequence>
    <outSequence>
        <send/>
    </outSequence>
    <faultSequence>
        <log level="full">
            <property name="MESSAGE" value="Executing default &quot;fault&quot; sequence"/>
            <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
            <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
        </log>
    </faultSequence>
    <endpoint>
        <address uri="Soap Service URL"/>
    </endpoint>
</target>

Here is my REQUEST(Rest Client Body) that i passed thru proxy service

<?xml version="1.0" encoding="utf-8"?>
<UserLogin xmlns="http://tempuri.org/">
<LoginID>xxx</LoginID>
<Password>xxx</Password>
</UserLogin>

But i am getting the following error

[2014-03-14 18:01:51,443]  WARN {SERVICE_LOGGER.FilterMediatorProxy} -  Executing fault handler due to exception encountered
[2014-03-14 18:01:51,444]  WARN {SERVICE_LOGGER.FilterMediatorProxy} -  ERROR_CODE : 0 ERROR_MESSAGE : Unexpected error during sending message out
[2014-03-14 18:01:51,445]  INFO {SERVICE_LOGGER.FilterMediatorProxy} -  FaultHandler executing impl: org.apache.synapse.mediators.MediatorFaultHandler
[2014-03-14 18:01:51,445]  WARN {SERVICE_LOGGER.FilterMediatorProxy} -  Executing fault sequence mediator : org.apache.synapse.mediators.base.SequenceMediator
[2014-03-14 18:01:51,445]  INFO {SERVICE_LOGGER.FilterMediatorProxy} -  To: http://10.132.97.131:9763/services/FilterMediatorProxy.FilterMediatorProxyHttpEndpoint/, 
From: 10.132.97.131, Direction: request, MESSAGE = Executing default "fault" sequence, 
ERROR_CODE = 0, ERROR_MESSAGE = Unexpected error during sending message out, Envelope: 
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body><UserLogin xmlns="http://tempuri.org/">
<LoginID>xxx</LoginID>
<Password>xxx</Password>
</UserLogin></soapenv:Body></soapenv:Envelope>`

The formatted XML is not properly going to Soap Service,i think that is the error..

Shall i need to set anything in the above configuration,please help me on this

When i used the console envelope code directly to call the Soap Service,it's working fine

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body><UserLogin xmlns="http://tempuri.org/">
<LoginID>xxx</LoginID>
<Password>xxx</Password>
</UserLogin></soapenv:Body>
</soapenv:Envelope>

Can anyone help me on this

Response is also an XML...

NOTE : Sorry for the long question

Community
  • 1
  • 1
Mahesh Narayanan
  • 143
  • 2
  • 19
  • You should find a stacktrace in wso2-esb-errors.log, could you share it ? – Jean-Michel Mar 14 '14 at 13:53
  • @Jean I have installed ESB on wso2 Carbon,so there is no file like **wso2-esb-errors.log**. I am getting the following error in Console (I shared in Question) . – Mahesh Narayanan Mar 17 '14 at 05:56
  • @Jean I am passing input as **text/xml** and output reponse also **text/xml** I think the message formatter and builder is not properly formmatted.... Can you help me on this please – Mahesh Narayanan Mar 17 '14 at 05:58
  • Try to send a request directly to the soap endpoint using Soap client like SoapUI. – Wenod Pathirana Mar 17 '14 at 06:56
  • @Wenod If i call the endpoint directly,i can able to get the response,but while using a PRoxy Service,i am not getting the result – Mahesh Narayanan Mar 17 '14 at 06:57
  • I think that the send operate correctly but the ESB can't build the response from your endpoint. I'm not used to your way to install the ESB and don't know how to find the correct log. One thing you can do is to use tcpmon (in the 'bin' directory) and change your endpoint to pass through tcpmon : this will allow you to verify if a response comes from your endpoint (and therefore, confirm that the ESB send the request). – Jean-Michel Mar 17 '14 at 08:02
  • Is there any exception trace in Service side. I couldn't say the exact reason without the exception or the error. btw you have to add the content type too. `` – Wenod Pathirana Mar 17 '14 at 08:17
  • @Wenod I have added that too, but i am not able to get the service response using a Proxy Service.. See this thread,i have tried another SOAP service, i am gettig this error... (http://stackoverflow.com/q/22448106/2822914) – Mahesh Narayanan Mar 17 '14 at 08:27
  • @Wenod I am using **WSO2 Carbon 4.2.0 and i have installed ESB 4.8.0 on this** Can you tried the above thread proxy service and whether u r getting the Response using `Try this Service` – Mahesh Narayanan Mar 17 '14 at 08:29
  • With this configuration I was able to get the response `
    `
    – Wenod Pathirana Mar 17 '14 at 09:15
  • @Wenod I have tried ur configuration too.. Still i am not able to get the output.... I am able to Connect an External RESTService(JSON Request and JSON Response) using a proxy service and got the response successfully... Facing issues while calling a SOAP Service!!!!!!!!!!!!!!!!!!!!!!!!!! Don't know the issue,,.. U tried to call this service using which tool???? – Mahesh Narayanan Mar 17 '14 at 09:40
  • @wenod Getting the following exception `Caused by: org.apache.axis2.AxisFault: Invalid query at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommo` – Mahesh Narayanan Mar 17 '14 at 09:42
  • @wenod I have tried the scenario liek below... Using Rest Client (Mozilla Firefox Addon) can you please try with this,,, METHOD-POST,Content-Type=text/xml,Body = ` 88 ` – Mahesh Narayanan Mar 17 '14 at 09:44
  • This is the thing. You have to download ESB 4.8.0 directly. Because if you have install the ESB features inside the carbon core, then you have to change some configurations in axis2.xml. Transport sender used in ESB is based synapse where carbon used is axis2.xml. In addition, I tried the proxy with the restClient with the text/xml and get the response successfully. – Wenod Pathirana Mar 17 '14 at 09:50
  • @wenod Thanks for your response... But our scenario should be need to use ESB on WSO2 Carbon,that's why...Do you know what and all the configurations i have to change in axis2.xml ??.. Can you help me on this pls!!!.....Becoz,for REST service also i faced issue,i have set the JSONMEssageFormateer and BUilder in axis2.xml and set the messageType property also as application/json in the proxy service,i have got the RESPONSE – Mahesh Narayanan Mar 17 '14 at 09:54
  • @wenod Our Criteria Should be need to use WSO2 Carbon and install the ESB on it and need to create a Proxy,,, IS it not possible??? – Mahesh Narayanan Mar 17 '14 at 09:56
  • It is possible but you have to add the configurations accordingly. It is better if you can replace the axis2.xml which shipped with the esb with the carbon default. – Wenod Pathirana Mar 17 '14 at 10:03
  • @Wenod Ok will try with this...Can you share me the axis2.xml of the ESB 4.8.0 pls? – Mahesh Narayanan Mar 17 '14 at 10:05
  • @wenod My mail id is eh.mahesh@gmail.com – Mahesh Narayanan Mar 17 '14 at 10:09
  • @wenod I have downloaded wso2esb 4.8.1 as u told and used with ur proxy service,still i am getting the `Request Timed Out` Exception...!!!!! – Mahesh Narayanan Mar 18 '14 at 05:36
  • @Wenod I am getting the below exception,while i am connecting using `Rest Client` or `try this service` – Mahesh Narayanan Mar 18 '14 at 06:08
  • I thinkyou are having some error in connecting the endpoint. When you creating the proxy service from the design view, press Test in the endpoint UI. – Wenod Pathirana Mar 18 '14 at 06:53
  • @Wenod Yes..i am getting the exception **Invalid Address,Unable to establish a Connection** while using the below link (http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit).. Then how u r getting the response successfully using the same Proxy service?????!!!!!! – Mahesh Narayanan Mar 18 '14 at 07:02
  • @Wenod I want to test a **SOAP Service using wso2proxy service (Reqeust XML and RESPOSNE XML)** Do you have any sample SOAP service to test this scenario.. I checked with **w3schools sample SOAP service** but getting the below exception..Please help me on this – Mahesh Narayanan Mar 18 '14 at 07:06
  • I was able to connect the url successfully and think something wrong with your network. Sample service included in the ESB pack. Follow this url to find more information. You can find most of the information regarding your questions in wso2 documentation. https://docs.wso2.org/display/ESB470/ESB+Samples+Setup#ESBSamplesSetup-StartingSampleBack-EndServices – Wenod Pathirana Mar 18 '14 at 08:37
  • @Wenod Thanks for your response.. Do you know,we need to set any PROXY in wso2esb? I am using inside a Company... and u gave the WSDL url or just the endpoint address u gave while configuring the proxy service?? – Mahesh Narayanan Mar 18 '14 at 08:58
  • Just the endpoint URL – Wenod Pathirana Mar 18 '14 at 10:40

1 Answers1

0

It will be easier for you if you use SoapUI, instead of browser, for sending a soap message to a proxy. You can follow this tutorial.

If you want to use the browser then I suggest setting up an API, instead of Proxy, since that is REST native. You can follow this tutorial and this tutorial to get started.

In your code above I believe you are getting that error because you haven't named your endpoint and you aren't referencing it. Also you have the send in the out sequence which means the send would be sending to the caller, not the endpoint.

Scott
  • 46
  • 5