1

I am new to wso2.. I am facing an issue while calling an EXTERNAl SOAP Service using wso2esb proxy service.. I am using WSO2 ESB inside a corporate proxy.. I can able to call this external soap service directly using an soap client..

Is there any proxy configuration that I need to set in WSO2 ESB ?

I am getting the following exception while connecting a soap service using wso2proxy service

2014-03-18 14:40:52,193 [-] [PassThroughHTTPSender] WARN ConnectCallback Connection refused or failed for : www.w3schools.com/68.232.44.251:80 2014-03-18 14:40:52,198 [-] [PassThroughMessageProcessor-3] WARN EndpointContext Endpoint : AnonymousEndpoint will be marked SUSPENDED as it failed 2014-03-18 14:40:52,199 [-] [PassThroughMessageProcessor-3] WARN EndpointContext Suspending endpoint : AnonymousEndpoint - current suspend duration is : 30000ms - Next retry after : Tue Mar 18 14:41:22 IST 2014 2014-03-18 14:41:51,185 [-] [HTTP-Listener I/O dispatcher-2] WARN SourceHandler Connection time out after request is read: http-incoming-2 2014-03-18 14:51:49,691 [-] [PassThroughHTTPSender] WARN ConnectCallback Connection refused or failed for : www.w3schools.com/68.232.44.251:80 2014-03-18 14:51:49,693 [-] [PassThroughMessageProcessor-5] WARN EndpointContext Endpoint : AnonymousEndpoint will be marked SUSPENDED as it failed 2014-03-18 14:51:49,694 [-] [PassThroughMessageProcessor-5] WARN EndpointContext Suspending endpoint : AnonymousEndpoint - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Tue Mar 18 14:52:19 IST 2014

Can anyone help me on this please.. For more information please have a look into this. (How to send a soap request(xml) to soap service using wso2 proxy service)

Added the Error Screeshot,Please have a look into this

While clicking **test** in design view,getting the below exception


Fixed the issue and Below are the final configurations


My axis2.xml configuration as Jean Told ( I'm currently testing with NIO, therefore I've removed standard repository/conf/axis2/axis2.xml and renamed repository/conf/axis2/axis2_nhttp.xml to repository/conf/axis2/axis2.xml in my WSO2 ESB v4.8.1 then you edit this new axis2 conf file and search for transportSender name="http" and inside the node transportSender)

<transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender"> <parameter name="non-blocking" locked="false">true</parameter> <parameter name="http.proxyHost" locked="false">proxy.abc.com</parameter> <parameter name="http.proxyPort" locked="false">8080</parameter> </transportSender>

Then My proxy service configuration

********Changed my proxy service Configuration like below answer *****

`<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="CelsiusToFahrenheitService"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="messageType" value="text/xml" scope="axis2"/>
         <property name="Proxy-Authorization"
                   expression="fn:concat('Basic', base64Encode('INDIA\username:pwd'))"
                   scope="transport"/>
         <property name="POST_TO_URI" value="true" scope="axis2"/>
         <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
         <header name="Action"
                 value="http://www.w3schools.com/webservices/CelsiusToFahrenheit"/>
         <send>
            <endpoint>
               <address uri="http://www.w3schools.com/webservices/tempconvert.asmx"
                        format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <property name="messageType" value="text/xml" scope="axis2"/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>`

Then i restarted the ESB ,then went to try this service in wso2 console as well as using Rest Client(Mozilla Firefox Addon),got the resposne successfully

Thanks alot Jean-Michel for helping this task

Community
  • 1
  • 1
Mahesh Narayanan
  • 143
  • 2
  • 19

1 Answers1

1

You will find the way to configure WSO2 here.

In /repository/conf/axis2/axis2.xml, edit the transportSender configuration of the http transport to specify the proxy server as follows:

<transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender">
    <parameter name="non-blocking" locked="false">true</parameter>
    <parameter name="http.proxyHost" locked="false">proxyhost.yourdomain</parameter>
    <parameter name="http.proxyPort" locked="false">proxyport</parameter>
</transportSender>

In the Synapse configuration of the proxy service that sends messages to this proxy server, set the following two properties before the send mediator:

<syn:property name="Proxy-Authorization" expression="fn:concat('Basic', base64Encode('userName:password'))" scope="transport"/>
<syn:property name="POST_TO_URI" value="true" scope="axis2"/>

Sample proxy to test tempconvert service :

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="CelsiusToFahrenheitService" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
    <target>
        <inSequence>
            <property name="messageType" value="text/xml" scope="axis2"/>
            <property name="Proxy-Authorization" expression="fn:concat('Basic', base64Encode('DOMAIN\user:pass'))" scope="transport"/>
            <property name="POST_TO_URI" value="true" scope="axis2"/>
            <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
            <header name="Action" value="http://www.w3schools.com/webservices/CelsiusToFahrenheit"/>
            <send>
                <endpoint>
                    <address uri="http://www.w3schools.com/webservices/tempconvert.asmx" format="soap11"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <property name="messageType" value="text/xml" scope="axis2"/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>

In WSO2 ESB console, click on "Try this service" and enter this request :

<CelsiusToFahrenheit xmlns="http://www.w3schools.com/webservices/">
  <Celsius>20</Celsius>
</CelsiusToFahrenheit>
Priyantha
  • 4,839
  • 6
  • 26
  • 46
Jean-Michel
  • 5,926
  • 1
  • 13
  • 19
  • Thanks for your response.. Actually i want to call this service (http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit) using wso2 proxy service.. While i am testing the Address Endpoint in the Design view.. i am getting **Invalid Address,Unable to establish a Connection**... How to solve this.. – Mahesh Narayanan Mar 18 '14 at 09:51
  • I am using wso2 inside a company, i have a proxy like **proxy.xxx.com** and i have **username** and **password** there,,, so i need to set as u told right?? so here `localhost` i need to gave **proxy.xxx.com** instead of localhost and here `` i need to gave the proxy username and pwd right?? – Mahesh Narayanan Mar 18 '14 at 09:53
  • Added the proxy service in my question... How to edit as u told?? – Mahesh Narayanan Mar 18 '14 at 09:54
  • the first part (with proxyHost and proxyPort) must be configured in repository/conf/axis2/axis2.xml (default http sender is PassThroughHttpSender : configure this sender). An alternative is to configure proxyHost and proxyPort as java start parameters : -Dhttp.proxyHost=host -Dhttp.proxyPort=8080. The second part take place in your mediation – Jean-Michel Mar 18 '14 at 09:58
  • I have configured what u suggested and see above my edited proxy service (Is this correct) and While i am testing the same Address Endpoint (http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit) in the Design view.. i am still getting **Invalid Address,Unable to establish a Connection** – Mahesh Narayanan Mar 18 '14 at 10:11
  • You should send a request to your proxy in WSO2 to test if the connection is OK. Are you able to call http://www.w3schools.com/webservices/tempconvert.asmx from your browser ? (I'm behind a corporate proxy, I have configured http transport inside axis2 conf, I've deployed your proxy in WSO2 -changing user/password- and it works for me, I can use "test" in design view with success) – Jean-Michel Mar 18 '14 at 10:32
  • 1) I am able to call the service directly using the browser 2) I have some doubts please clarify... I have to add the **transportsender** configuration like u shared right? I already have a transportsender configuration like this`` so shall i change the class to **org.apache.synapse.transport.nhttp.HttpCoreNIOSender** or i need to enter entire confguration ??? – Mahesh Narayanan Mar 18 '14 at 11:58
  • Can you share me ur axis 2 configuration? Are u deployed the same service that i pasted above (in question) . What u have to give in the tag `localhost` Here **localhost** or ur company proxy address?? Or we have to give **www.w3schools.com**.. Can you explain what u did in the configuration please...Still i am getting,Invaid Address exception while clicking *test* in Design View – Mahesh Narayanan Mar 18 '14 at 12:21
  • Please Share what u have did in the Configuration and Proxy Services? – Mahesh Narayanan Mar 18 '14 at 12:28
  • in the expression associated with property "Proxy-Authorization", there is an unwanted blank space behind 'Basic ' and in your login, don't forget to specify your domain if appropriate : – Jean-Michel Mar 18 '14 at 12:43
  • Ok..What i have to configure in axis2.xml, I already have a transportsender configuration like this``so shall i change the class to **org.apache.synapse.transport.nhttp.HttpCoreNIOSender** or i need to enter entire configuration ??? – Mahesh Narayanan Mar 18 '14 at 12:45
  • What i have to enter **localhost** here **localhost** or **proxy.abc.com** – Mahesh Narayanan Mar 18 '14 at 12:46
  • Can you share the configuration please ,both Proxy service and axis2.xml so that i can cross verify with that please help me... – Mahesh Narayanan Mar 18 '14 at 12:49
  • I am added the configuration like this ` true proxy.abc.com 8080 ` – Mahesh Narayanan Mar 18 '14 at 12:56
  • Proxy Service Configuration like this ` ` – Mahesh Narayanan Mar 18 '14 at 12:57
  • regarding http transport, you must choose between passThrough or NIO. I'm currently testing with NIO, therefore I've removed standard repository/conf/axis2/axis2.xml and renamed repository/conf/axis2/axis2_nhttp.xml to repository/conf/axis2/axis2.xml in my WSO2 ESB v4.8.1 then you edit this new axis2 conf file and search for transportSender name="http" and inside the node transportSender, you add the parameters given in my answer. Obviously, replace localhost and 8080 with host and port of YOUR proxy – Jean-Michel Mar 18 '14 at 13:06
  • Thanks for your detailed explanation.. Really Sorry to disturb u.. I have did what u told and restarted the ESB and my proxy service is like (above i mentioned in my question).. Then how u tested this proxy service?? Using which tool? What u gave the request? – Mahesh Narayanan Mar 18 '14 at 13:13
  • If you want to test your proxy with "Try this service" in wso2 console, you must add 2 parameters to specify the SOAPAction and to disable http chunking, I'm going to edit my answer and add my proxy conf... – Jean-Michel Mar 18 '14 at 13:16
  • Then i go to Design View of my proxy service,then went to Send Mediator -- address endpoint is `http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenhei‌​t` and clicked **test** button,i am still getting the **Invalid Address, Unable to estabilish a connection** .. Can you do the same and check whether u r getting success for this **SAME URL** – Mahesh Narayanan Mar 18 '14 at 13:17
  • I can test the same address with success. But in order to use your proxy and invoke the tempconvert service, you sould remove ?op=CelsiusToFahrenhei‌​t Don't focus on this "test" button, please, try to send a request to your "CelsiusToFahrenheitService" proxy service – Jean-Michel Mar 18 '14 at 13:24
  • Ok i will check with your answer first and let you know..In the mean time,i have edited my question please have a look – Mahesh Narayanan Mar 18 '14 at 13:27
  • Thanks alot..I tried with your proxy service Configuration...Now it's working fine Thanks alot... As you told,**test** button still nt working,i am not focussing on that.. :):) – Mahesh Narayanan Mar 18 '14 at 13:39
  • You just made my day ;-) If you find the problem with this "test" button, don't forget to add a comment to explain that ! – Jean-Michel Mar 18 '14 at 13:42
  • I added the correct configuration fully in my question.. Please have a look and let me know if i need to add/change anything – Mahesh Narayanan Mar 18 '14 at 13:45
  • Finally one thing,i am tested using NIO as u told,if i need to use thru PassThrough,then i can use the same axis2.xml with this configurations under Passthrough transport header right – Mahesh Narayanan Mar 18 '14 at 13:49
  • Yes and if you look at standard axis2.xml given with WSO2 ESB 4.8.1, you will see that those parameters are already specified (but inside comments) – Jean-Michel Mar 18 '14 at 13:53
  • Ok i ll check with this... I have one more doubt ,can you help me if you know that.. THis same proxy service,here the iput is XML and output is XML right? I want to call this service like below 1) I want to give input request as JSON 2) ESB will convert it to xml format (As we gave messageType as text/xml 3) Call to an external Soap service 4) Returning an XML response 5) I want to convert the same xml response into JSON format (By setting the messageType as application/json in the OutSequence)) Is it possible to do that???? – Mahesh Narayanan Mar 20 '14 at 06:24
  • You should find all you need there : https://docs.wso2.org/display/ESB481/JSON+Support – Jean-Michel Mar 20 '14 at 07:40
  • Thanks for your resposne.i too found an Eg here,but i am not able to apply this within my ESB ?? (https://docs.wso2.org/display/ESB481/Sample+440:+Converting+JSON+to+XML+Using+XSLT) Where i need to set that **** tag and all.. Can you helpme in this case please For Reference please have a look (http://stackoverflow.com/q/22525911/2822914) – Mahesh Narayanan Mar 20 '14 at 09:56
  • Please help me on this,,,Please have a look into this (http://stackoverflow.com/questions/22525911/wso2-esb-transform-json-to-xml-and-call-an-external-soap-service) – Mahesh Narayanan Mar 20 '14 at 12:46