title: Invoke Soap Service Using Proxy Service
body: <p>I want to create a proxy service to call an external Soap service using wso2 proxy service.</p>
  
  <p>I have created a proxy service like this:</p>
  
  <pre><code>&lt;target&gt;
      &lt;inSequence&gt;
          &lt;property name="messageType" value="text/xml" scope="axis2"/&gt;
          &lt;property name="ContentType" value="text/xml" scope="axis2"/&gt;
      &lt;/inSequence&gt;
      &lt;outSequence&gt;
          &lt;property name="messageType" value="text/xml" scope="axis2"/&gt;
          &lt;property name="ContentType" value="text/xml" scope="axis2"/&gt;
          &lt;send/&gt;
      &lt;/outSequence&gt;
      &lt;faultSequence&gt;
          &lt;log level="full"&gt;
              &lt;property name="MESSAGE" value="Executing default &amp;quot;fault&amp;quot; sequence"/&gt;
              &lt;property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/&gt;
              &lt;property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/&gt;
          &lt;/log&gt;
          &lt;log level="custom"&gt;
              &lt;property name="Trace" expression="get-property('ERROR_DETAIL')"/&gt;
          &lt;/log&gt;
      &lt;/faultSequence&gt;
      &lt;endpoint&gt;
          &lt;address uri="http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit"/&gt;
      &lt;/endpoint&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>Please have a look into this link (<a href="http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit" rel="nofollow noreferrer">http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit</a>)</p>
  
  <p>I want to call this Soap Service using a proxy service.</p>
  
  <p>I am using REST Client (Mozilla Firefox Addon) and </p>
  
  <p>My Input Request:</p>
  
  <pre><code>&lt;CelsiusToFahrenheit xmlns="http://www.w3schools.com/webservices/"&gt;
   &lt;Celsius&gt;33&lt;/Celsius&gt;
  &lt;/CelsiusToFahrenheit&gt;
  </code></pre>
  
  <p>I am getting an error while calling this service using a proxy service.</p>
  
  <p>Below is my error. I have enabled TRACE on my proxy service configuration.</p>
  
  <pre><code>[2014-03-17 11:42:16,187]  WARN {SERVICE_LOGGER.FilterMediatorProxy} -  Executing fault handler due to exception encountered
  [2014-03-17 11:42:16,188]  WARN {SERVICE_LOGGER.FilterMediatorProxy} -  ERROR_CODE : 0 ERROR_MESSAGE : Unexpected error during sending message out
  [2014-03-17 11:42:16,188]  INFO {SERVICE_LOGGER.FilterMediatorProxy} -  FaultHandler executing impl: org.apache.synapse.mediators.MediatorFaultHandler
  [2014-03-17 11:42:16,189]  WARN {SERVICE_LOGGER.FilterMediatorProxy} -  Executing fault sequence mediator : org.apache.synapse.mediators.base.SequenceMediator
  [2014-03-17 11:42:16,194]  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: 
  &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soapenv:Body&gt;
  &lt;CelsiusToFahrenheit xmlns="http://www.w3schools.com/webservices/"&gt;
     &lt;Celsius&gt;33&lt;/Celsius&gt;
  &lt;/CelsiusToFahrenheit&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
  [2014-03-17 11:42:16,206]  INFO {SERVICE_LOGGER.FilterMediatorProxy} -  
  Trace = org.apache.synapse.SynapseException: Unexpected error during sending message out
      at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:172)
      at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:71)
      at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send   (Axis2SynapseEnvironment.java:338)
      at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)
      at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
      at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:187)
      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
      at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
      at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
      at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      at org.eclipse.equinox.http.helper.FilterServletAdaptor$FilterChainImpl.doFilter(FilterServletAdaptor.java:56)
      at org.wso2.carbon.mashup.jsservices.custom.ui.CustomUIServletFilter.doFilter(CustomUIServletFilter.java:233)
      at org.eclipse.equinox.http.helper.FilterServletAdaptor.service(FilterServletAdaptor.java:37)
      at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
      at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
      at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
      at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
      at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
      at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
      at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
      at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: org.apache.axis2.AxisFault: Connection refused: connect
      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.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)
      at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)
      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
      at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
      at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
      at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)
      at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)
      ... 44 more
  Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
      at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:75)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
      at java.net.Socket.connect(Socket.java:579)
      at sun.reflect.GeneratedMethodAccessor113.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
      at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
      at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
      at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
      at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
      at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
      at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
      at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:622)
      at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
      ... 53 more
  </code></pre>
  
  <p>What's wrong in my configuration? While I am directly calling the Soap service (without using any proxy from REST client), I am getting the response correctly.</p>