You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Stephen Hall <sh...@starmountsystems.com> on 2008/10/27 21:51:31 UTC

[synapse] new user having trouble with proxy example

Hello,

I'm a fairly new user to synapse so please bear with me. After getting sample 150 to work, I tried to set up synapse as a proxy to an existing web service. The service I am consuming  is a .NET service, I had previously written a client for this service using axis2 with adb binding. My client works fine w/o using synapse as a proxy. But when I use synapse a SOAPFault is thrown by the .NET service. I'm not certain if I messed up my configuration of synapse or my configuration of org.apache.axis2.client.ServiceClient. Below, I've included the soap envelope sent by axis2, the envelope then sent by synapse, the fault returned by the .net service, the wsdl, the synapse config, and the setUp method of a junit test where I configure axis2. I've tried a number of different things with the axis2 ServiceClient config from explicitly setting an action to adding proxy properties.

The fault says I mismatch between the action in my header (not sure if thats soap or http so i included both) but I don't see it?

Any help greatly appreciated

Steve Hall


The message sent to synapse:

POST /soap/CreehanProxy HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders"
User-Agent: Axis2
Host: localhost:8280
Transfer-Encoding: chunked

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Header>
    <wsa:To>http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc</wsa:To>
    <wsa:MessageID>urn:uuid:BC59F095B67592C3451225137098344</wsa:MessageID>
    <wsa:Action>http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders</wsa:Action>
  </soapenv:Header>
  <soapenv:Body>
    <ns2:RetrievePatientInfoWithOrders xmlns:ns2="http://tempuri.org/">
      <ns2:userId>TEST1</ns2:userId>
      <ns2:orderId>665700</ns2:orderId>
      <ns2:storeNumber>46</ns2:storeNumber>
    </ns2:RetrievePatientInfoWithOrders>
  </soapenv:Body>
</soapenv:Envelope>


>From synapse to the .net service:

POST http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc HTTP/1.1
Host: localhost:8280
Content-Type: application/soap+xml; charset=UTF-8; action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders"
Transfer-Encoding: chunked
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing">
  <soapenv:Header>
    <wsa:To>http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc</wsa:To>
    <wsa:MessageID>urn:uuid:A87E61F1744D955E0F1224865751760</wsa:MessageID>
    <wsa:Action>http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders</wsa:Action>
  </soapenv:Header>
  <soapenv:Body>
    <ns2:RetrievePatientInfoWithOrders xmlns:ns2="http://tempuri.org/">
      <ns2:userId>TEST1</ns2:userId>
      <ns2:orderId>665700</ns2:orderId>
      <ns2:storeNumber>46</ns2:storeNumber>
    </ns2:RetrievePatientInfoWithOrders>
  </soapenv:Body>
</soapenv:Envelope>


The fault:

HTTP/1.1 500 Internal Server Error
Date: Mon, 27 Oct 2008 19:49:38 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Connection: close
Cache-Control: private
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 642

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
  </s:Header>
  <s:Body>
    <s:Fault>
      <s:Code>
        <s:Value>s:Sender</s:Value>
        <s:Subcode>
          <s:Value>a:ActionMismatch</s:Value>
        </s:Subcode>
      </s:Code>
      <s:Reason>
        <s:Text xml:lang="en-US">The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders'. </s:Text>
      </s:Reason>
      <s:Detail>
        <a:ProblemHeaderQName>a:Action</a:ProblemHeaderQName>
      </s:Detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

The WSDL:


<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="PointOfSale" targetNamespace="http://tempuri.org/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                  xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
                  xmlns:tns="http://tempuri.org/"
                  xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
                  xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                  xmlns:i0="http://www.creehan.com"
                  xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
                  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:wsa10="http://www.w3.org/2005/08/addressing"
                  xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
  <wsdl:import namespace="http://www.creehan.com" location="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?wsdl=wsdl0"/>
  <wsdl:types>
    <xsd:schema targetNamespace="http://tempuri.org/Imports">
      <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
      <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
      <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Creehan.Scriptmed.POS.Business"/>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="IPointOfSale_RetrievePatientInfoWithOrders_InputMessage">
    <wsdl:part name="parameters" element="tns:RetrievePatientInfoWithOrders"/>
  </wsdl:message>
  <wsdl:message name="IPointOfSale_RetrievePatientInfoWithOrders_OutputMessage">
    <wsdl:part name="parameters" element="tns:RetrievePatientInfoWithOrdersResponse"/>
  </wsdl:message>
  <wsdl:message name="IPointOfSale_SubmitPayments_InputMessage">
    <wsdl:part name="parameters" element="tns:SubmitPayments"/>
  </wsdl:message>
  <wsdl:message name="IPointOfSale_SubmitPayments_OutputMessage">
    <wsdl:part name="parameters" element="tns:SubmitPaymentsResponse"/>
  </wsdl:message>
  <wsdl:message name="IPointOfSale_ProcessOrderFulfillment_InputMessage">
    <wsdl:part name="parameters" element="tns:ProcessOrderFulfillment"/>
  </wsdl:message>
  <wsdl:message name="IPointOfSale_ProcessOrderFulfillment_OutputMessage">
    <wsdl:part name="parameters" element="tns:ProcessOrderFulfillmentResponse"/>
  </wsdl:message>
  <wsdl:portType name="IPointOfSale">
    <wsdl:operation name="RetrievePatientInfoWithOrders">
      <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders" message="tns:IPointOfSale_RetrievePatientInfoWithOrders_InputMessage"/>
      <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrdersResponse" message="tns:IPointOfSale_RetrievePatientInfoWithOrders_OutputMessage"/>
    </wsdl:operation>
    <wsdl:operation name="SubmitPayments">
      <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/SubmitPayments" message="tns:IPointOfSale_SubmitPayments_InputMessage"/>
      <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/SubmitPaymentsResponse" message="tns:IPointOfSale_SubmitPayments_OutputMessage"/>
    </wsdl:operation>
    <wsdl:operation name="ProcessOrderFulfillment">
      <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/ProcessOrderFulfillment" message="tns:IPointOfSale_ProcessOrderFulfillment_InputMessage"/>
      <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/ProcessOrderFulfillmentResponse" message="tns:IPointOfSale_ProcessOrderFulfillment_OutputMessage"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:service name="PointOfSale">
    <wsdl:port name="PosService_WSHTTP" binding="i0:PosService_WSHTTP">
      <soap12:address location="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc"/>
      <wsa10:EndpointReference>
        <wsa10:Address>http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc</wsa10:Address>
        <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
          <Upn>LocalService</Upn>
        </Identity>
      </wsa10:EndpointReference>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


synapse.xml:

<definitions xmlns="http://ws.apache.org/ns/synapse">

    <proxy name="CreehanProxy" trace="enable" statistics="enable">
        <target>
            <endpoint>
                <address uri="http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc"/>
            </endpoint>
            <inSequence>
                <log level="full"/>
            </inSequence>
            <outSequence>
                <log level="full"/>
                <send/>
            </outSequence>
        </target>
    </proxy>
</definitions>



axis2 programmatic configuration:

    public void setUp()
    {

        String repositoryLocation = "C:/devtools/axis2-1.2/repository";
    
        serviceUrl = "http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc";

        prxUrl = "http://localhost:8280/soap/CreehanProxy";
        
        try
        {
            ConfigurationContext ctx = ConfigurationContextFactory
            .createConfigurationContextFromFileSystem(repositoryLocation,
                    null);

          stub = new PointOfSaleStub(ctx, null);
          client = stub._getServiceClient();
          Options options = new Options();
          
          //set soap version
          options.setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
          
          //do addressing
          client.engageModule("addressing");
          options.setTo(new EndpointReference(serviceUrl));
          //options.setTo(new EndpointReference(prxUrl));
          options.setProperty(Constants.Configuration.TRANSPORT_URL, prxUrl);
          
          options.setAction("http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders");
          
          /*
          HttpTransportProperties.ProxyProperties proxyProperties =
              new HttpTransportProperties.ProxyProperties();
          URL url = new URL(prxUrl);
          proxyProperties.setProxyName(url.getHost());
          proxyProperties.setProxyPort(url.getPort());
          proxyProperties.setUserName("");
          proxyProperties.setPassWord("");
          proxyProperties.setDomain("");
          options.setProperty(HTTPConstants.PROXY, proxyProperties);
          */    
          
          client.setOptions(options);
        }
        catch (AxisFault e)
        {
        }

    }


Re: [synapse] new user having trouble with proxy example

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Stephen
> Below, I've included the soap envelope sent by axis2, the envelope then sent by synapse, the fault returned by the .net service, the wsdl, the synapse config, and the setUp method of a junit test where I configure axis2. I've tried a number of different things with the axis2 ServiceClient config from explicitly setting an action to adding proxy properties.
>
> The fault says I mismatch between the action in my header (not sure if thats soap or http so i included both) but I don't see it?
>   
Could you attach a trace of a successful call from any client to this 
service? This will help us pinpoint the problem much quicker.. also do 
you have a proxy service on your network.. The following (as sent by 
Synapse) is not correct either:

POST http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc 
HTTP/1.1
Host: localhost:8280

The "Host" header does not match the full URL provided in the POST, and 
.Net has been known to have a few issues around some subtle differences 
like these and the error its reporting has a chance to be misleading..

asankha

Re: [synapse] new user having trouble with proxy example

Posted by Dinuka <di...@wso2.com>.
Hi Stephen,
     Im not entirely sure if this might be the issue but as you are 
calling the web service with ws-addressing enabled, could you enable 
ws-addressing at the endpoint level of the proxy service as well. Just 
add the line <enableAddressing/> within the <address> endpoint element.

Regards,
Dinuka
Stephen Hall wrote:
> Hello,
>
> I'm a fairly new user to synapse so please bear with me. After getting sample 150 to work, I tried to set up synapse as a proxy to an existing web service. The service I am consuming  is a .NET service, I had previously written a client for this service using axis2 with adb binding. My client works fine w/o using synapse as a proxy. But when I use synapse a SOAPFault is thrown by the .NET service. I'm not certain if I messed up my configuration of synapse or my configuration of org.apache.axis2.client.ServiceClient. Below, I've included the soap envelope sent by axis2, the envelope then sent by synapse, the fault returned by the .net service, the wsdl, the synapse config, and the setUp method of a junit test where I configure axis2. I've tried a number of different things with the axis2 ServiceClient config from explicitly setting an action to adding proxy properties.
>
> The fault says I mismatch between the action in my header (not sure if thats soap or http so i included both) but I don't see it?
>
> Any help greatly appreciated
>
> Steve Hall
>
>
> The message sent to synapse:
>
> POST /soap/CreehanProxy HTTP/1.1
> Content-Type: application/soap+xml; charset=UTF-8; action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders"
> User-Agent: Axis2
> Host: localhost:8280
> Transfer-Encoding: chunked
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
>   <soapenv:Header>
>     <wsa:To>http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc</wsa:To>
>     <wsa:MessageID>urn:uuid:BC59F095B67592C3451225137098344</wsa:MessageID>
>     <wsa:Action>http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders</wsa:Action>
>   </soapenv:Header>
>   <soapenv:Body>
>     <ns2:RetrievePatientInfoWithOrders xmlns:ns2="http://tempuri.org/">
>       <ns2:userId>TEST1</ns2:userId>
>       <ns2:orderId>665700</ns2:orderId>
>       <ns2:storeNumber>46</ns2:storeNumber>
>     </ns2:RetrievePatientInfoWithOrders>
>   </soapenv:Body>
> </soapenv:Envelope>
>
>
> >From synapse to the .net service:
>
> POST http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc HTTP/1.1
> Host: localhost:8280
> Content-Type: application/soap+xml; charset=UTF-8; action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders"
> Transfer-Encoding: chunked
> Connection: Keep-Alive
> User-Agent: Synapse-HttpComponents-NIO
>
> <?xml version="1.0" encoding="utf-8"?>
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing">
>   <soapenv:Header>
>     <wsa:To>http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc</wsa:To>
>     <wsa:MessageID>urn:uuid:A87E61F1744D955E0F1224865751760</wsa:MessageID>
>     <wsa:Action>http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders</wsa:Action>
>   </soapenv:Header>
>   <soapenv:Body>
>     <ns2:RetrievePatientInfoWithOrders xmlns:ns2="http://tempuri.org/">
>       <ns2:userId>TEST1</ns2:userId>
>       <ns2:orderId>665700</ns2:orderId>
>       <ns2:storeNumber>46</ns2:storeNumber>
>     </ns2:RetrievePatientInfoWithOrders>
>   </soapenv:Body>
> </soapenv:Envelope>
>
>
> The fault:
>
> HTTP/1.1 500 Internal Server Error
> Date: Mon, 27 Oct 2008 19:49:38 GMT
> Server: Microsoft-IIS/6.0
> X-Powered-By: ASP.NET
> X-AspNet-Version: 2.0.50727
> Connection: close
> Cache-Control: private
> Content-Type: application/soap+xml; charset=utf-8
> Content-Length: 642
>
> <?xml version="1.0" encoding="utf-8"?>
> <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
>   <s:Header>
>     <a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
>   </s:Header>
>   <s:Body>
>     <s:Fault>
>       <s:Code>
>         <s:Value>s:Sender</s:Value>
>         <s:Subcode>
>           <s:Value>a:ActionMismatch</s:Value>
>         </s:Subcode>
>       </s:Code>
>       <s:Reason>
>         <s:Text xml:lang="en-US">The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders'. </s:Text>
>       </s:Reason>
>       <s:Detail>
>         <a:ProblemHeaderQName>a:Action</a:ProblemHeaderQName>
>       </s:Detail>
>     </s:Fault>
>   </s:Body>
> </s:Envelope>
>
> The WSDL:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions name="PointOfSale" targetNamespace="http://tempuri.org/"
>                   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>                   xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
>                   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>                   xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
>                   xmlns:tns="http://tempuri.org/"
>                   xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
>                   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
>                   xmlns:i0="http://www.creehan.com"
>                   xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
>                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                   xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
>                   xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
>                   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
>                   xmlns:wsa10="http://www.w3.org/2005/08/addressing"
>                   xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
>   <wsdl:import namespace="http://www.creehan.com" location="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?wsdl=wsdl0"/>
>   <wsdl:types>
>     <xsd:schema targetNamespace="http://tempuri.org/Imports">
>       <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
>       <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
>       <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Creehan.Scriptmed.POS.Business"/>
>     </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="IPointOfSale_RetrievePatientInfoWithOrders_InputMessage">
>     <wsdl:part name="parameters" element="tns:RetrievePatientInfoWithOrders"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_RetrievePatientInfoWithOrders_OutputMessage">
>     <wsdl:part name="parameters" element="tns:RetrievePatientInfoWithOrdersResponse"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_SubmitPayments_InputMessage">
>     <wsdl:part name="parameters" element="tns:SubmitPayments"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_SubmitPayments_OutputMessage">
>     <wsdl:part name="parameters" element="tns:SubmitPaymentsResponse"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_ProcessOrderFulfillment_InputMessage">
>     <wsdl:part name="parameters" element="tns:ProcessOrderFulfillment"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_ProcessOrderFulfillment_OutputMessage">
>     <wsdl:part name="parameters" element="tns:ProcessOrderFulfillmentResponse"/>
>   </wsdl:message>
>   <wsdl:portType name="IPointOfSale">
>     <wsdl:operation name="RetrievePatientInfoWithOrders">
>       <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders" message="tns:IPointOfSale_RetrievePatientInfoWithOrders_InputMessage"/>
>       <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrdersResponse" message="tns:IPointOfSale_RetrievePatientInfoWithOrders_OutputMessage"/>
>     </wsdl:operation>
>     <wsdl:operation name="SubmitPayments">
>       <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/SubmitPayments" message="tns:IPointOfSale_SubmitPayments_InputMessage"/>
>       <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/SubmitPaymentsResponse" message="tns:IPointOfSale_SubmitPayments_OutputMessage"/>
>     </wsdl:operation>
>     <wsdl:operation name="ProcessOrderFulfillment">
>       <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/ProcessOrderFulfillment" message="tns:IPointOfSale_ProcessOrderFulfillment_InputMessage"/>
>       <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/ProcessOrderFulfillmentResponse" message="tns:IPointOfSale_ProcessOrderFulfillment_OutputMessage"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:service name="PointOfSale">
>     <wsdl:port name="PosService_WSHTTP" binding="i0:PosService_WSHTTP">
>       <soap12:address location="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc"/>
>       <wsa10:EndpointReference>
>         <wsa10:Address>http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc</wsa10:Address>
>         <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
>           <Upn>LocalService</Upn>
>         </Identity>
>       </wsa10:EndpointReference>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>
>
> synapse.xml:
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>
>     <proxy name="CreehanProxy" trace="enable" statistics="enable">
>         <target>
>             <endpoint>
>                 <address uri="http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc"/>
>             </endpoint>
>             <inSequence>
>                 <log level="full"/>
>             </inSequence>
>             <outSequence>
>                 <log level="full"/>
>                 <send/>
>             </outSequence>
>         </target>
>     </proxy>
> </definitions>
>
>
>
> axis2 programmatic configuration:
>
>     public void setUp()
>     {
>
>         String repositoryLocation = "C:/devtools/axis2-1.2/repository";
>     
>         serviceUrl = "http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc";
>
>         prxUrl = "http://localhost:8280/soap/CreehanProxy";
>         
>         try
>         {
>             ConfigurationContext ctx = ConfigurationContextFactory
>             .createConfigurationContextFromFileSystem(repositoryLocation,
>                     null);
>
>           stub = new PointOfSaleStub(ctx, null);
>           client = stub._getServiceClient();
>           Options options = new Options();
>           
>           //set soap version
>           options.setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>           
>           //do addressing
>           client.engageModule("addressing");
>           options.setTo(new EndpointReference(serviceUrl));
>           //options.setTo(new EndpointReference(prxUrl));
>           options.setProperty(Constants.Configuration.TRANSPORT_URL, prxUrl);
>           
>           options.setAction("http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders");
>           
>           /*
>           HttpTransportProperties.ProxyProperties proxyProperties =
>               new HttpTransportProperties.ProxyProperties();
>           URL url = new URL(prxUrl);
>           proxyProperties.setProxyName(url.getHost());
>           proxyProperties.setProxyPort(url.getPort());
>           proxyProperties.setUserName("");
>           proxyProperties.setPassWord("");
>           proxyProperties.setDomain("");
>           options.setProperty(HTTPConstants.PROXY, proxyProperties);
>           */    
>           
>           client.setOptions(options);
>         }
>         catch (AxisFault e)
>         {
>         }
>
>     }
>
>
>   


Re: [synapse] new user having trouble with proxy example

Posted by Saliya Ekanayake <sa...@wso2.com>.
Hi Steve,

I guess the reason is that your .NET service need to have the exact 
SOAP-Action header in the HTTP heading as that in wsa:Action. So one 
thing you can do is to add the following line (the added line is shown 
in Red color) to your Synapse configuration.


<definitions xmlns="http://ws.apache.org/ns/synapse">

    <proxy name="CreehanProxy" trace="enable" statistics="enable">
        <target>
            <endpoint>
                <address uri="http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc"/>
            </endpoint>
            <inSequence>
                <log level="full"/>
                <property name="SOAP-Action" action="set" value="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders scope=transport/>
            </inSequence>
            <outSequence>
                <log level="full"/>
                <send/>
            </outSequence>
        </target>
    </proxy>
</definitions>


Thanks,
Saliya


Stephen Hall wrote:
> Hello,
>
> I'm a fairly new user to synapse so please bear with me. After getting sample 150 to work, I tried to set up synapse as a proxy to an existing web service. The service I am consuming  is a .NET service, I had previously written a client for this service using axis2 with adb binding. My client works fine w/o using synapse as a proxy. But when I use synapse a SOAPFault is thrown by the .NET service. I'm not certain if I messed up my configuration of synapse or my configuration of org.apache.axis2.client.ServiceClient. Below, I've included the soap envelope sent by axis2, the envelope then sent by synapse, the fault returned by the .net service, the wsdl, the synapse config, and the setUp method of a junit test where I configure axis2. I've tried a number of different things with the axis2 ServiceClient config from explicitly setting an action to adding proxy properties.
>
> The fault says I mismatch between the action in my header (not sure if thats soap or http so i included both) but I don't see it?
>
> Any help greatly appreciated
>
> Steve Hall
>
>
> The message sent to synapse:
>
> POST /soap/CreehanProxy HTTP/1.1
> Content-Type: application/soap+xml; charset=UTF-8; action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders"
> User-Agent: Axis2
> Host: localhost:8280
> Transfer-Encoding: chunked
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
>   <soapenv:Header>
>     <wsa:To>http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc</wsa:To>
>     <wsa:MessageID>urn:uuid:BC59F095B67592C3451225137098344</wsa:MessageID>
>     <wsa:Action>http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders</wsa:Action>
>   </soapenv:Header>
>   <soapenv:Body>
>     <ns2:RetrievePatientInfoWithOrders xmlns:ns2="http://tempuri.org/">
>       <ns2:userId>TEST1</ns2:userId>
>       <ns2:orderId>665700</ns2:orderId>
>       <ns2:storeNumber>46</ns2:storeNumber>
>     </ns2:RetrievePatientInfoWithOrders>
>   </soapenv:Body>
> </soapenv:Envelope>
>
>
> >From synapse to the .net service:
>
> POST http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc HTTP/1.1
> Host: localhost:8280
> Content-Type: application/soap+xml; charset=UTF-8; action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders"
> Transfer-Encoding: chunked
> Connection: Keep-Alive
> User-Agent: Synapse-HttpComponents-NIO
>
> <?xml version="1.0" encoding="utf-8"?>
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing">
>   <soapenv:Header>
>     <wsa:To>http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc</wsa:To>
>     <wsa:MessageID>urn:uuid:A87E61F1744D955E0F1224865751760</wsa:MessageID>
>     <wsa:Action>http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders</wsa:Action>
>   </soapenv:Header>
>   <soapenv:Body>
>     <ns2:RetrievePatientInfoWithOrders xmlns:ns2="http://tempuri.org/">
>       <ns2:userId>TEST1</ns2:userId>
>       <ns2:orderId>665700</ns2:orderId>
>       <ns2:storeNumber>46</ns2:storeNumber>
>     </ns2:RetrievePatientInfoWithOrders>
>   </soapenv:Body>
> </soapenv:Envelope>
>
>
> The fault:
>
> HTTP/1.1 500 Internal Server Error
> Date: Mon, 27 Oct 2008 19:49:38 GMT
> Server: Microsoft-IIS/6.0
> X-Powered-By: ASP.NET
> X-AspNet-Version: 2.0.50727
> Connection: close
> Cache-Control: private
> Content-Type: application/soap+xml; charset=utf-8
> Content-Length: 642
>
> <?xml version="1.0" encoding="utf-8"?>
> <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
>   <s:Header>
>     <a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
>   </s:Header>
>   <s:Body>
>     <s:Fault>
>       <s:Code>
>         <s:Value>s:Sender</s:Value>
>         <s:Subcode>
>           <s:Value>a:ActionMismatch</s:Value>
>         </s:Subcode>
>       </s:Code>
>       <s:Reason>
>         <s:Text xml:lang="en-US">The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders'. </s:Text>
>       </s:Reason>
>       <s:Detail>
>         <a:ProblemHeaderQName>a:Action</a:ProblemHeaderQName>
>       </s:Detail>
>     </s:Fault>
>   </s:Body>
> </s:Envelope>
>
> The WSDL:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions name="PointOfSale" targetNamespace="http://tempuri.org/"
>                   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>                   xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
>                   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>                   xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
>                   xmlns:tns="http://tempuri.org/"
>                   xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
>                   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
>                   xmlns:i0="http://www.creehan.com"
>                   xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
>                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                   xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
>                   xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
>                   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
>                   xmlns:wsa10="http://www.w3.org/2005/08/addressing"
>                   xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
>   <wsdl:import namespace="http://www.creehan.com" location="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?wsdl=wsdl0"/>
>   <wsdl:types>
>     <xsd:schema targetNamespace="http://tempuri.org/Imports">
>       <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
>       <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
>       <xsd:import schemaLocation="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Creehan.Scriptmed.POS.Business"/>
>     </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="IPointOfSale_RetrievePatientInfoWithOrders_InputMessage">
>     <wsdl:part name="parameters" element="tns:RetrievePatientInfoWithOrders"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_RetrievePatientInfoWithOrders_OutputMessage">
>     <wsdl:part name="parameters" element="tns:RetrievePatientInfoWithOrdersResponse"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_SubmitPayments_InputMessage">
>     <wsdl:part name="parameters" element="tns:SubmitPayments"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_SubmitPayments_OutputMessage">
>     <wsdl:part name="parameters" element="tns:SubmitPaymentsResponse"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_ProcessOrderFulfillment_InputMessage">
>     <wsdl:part name="parameters" element="tns:ProcessOrderFulfillment"/>
>   </wsdl:message>
>   <wsdl:message name="IPointOfSale_ProcessOrderFulfillment_OutputMessage">
>     <wsdl:part name="parameters" element="tns:ProcessOrderFulfillmentResponse"/>
>   </wsdl:message>
>   <wsdl:portType name="IPointOfSale">
>     <wsdl:operation name="RetrievePatientInfoWithOrders">
>       <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders" message="tns:IPointOfSale_RetrievePatientInfoWithOrders_InputMessage"/>
>       <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrdersResponse" message="tns:IPointOfSale_RetrievePatientInfoWithOrders_OutputMessage"/>
>     </wsdl:operation>
>     <wsdl:operation name="SubmitPayments">
>       <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/SubmitPayments" message="tns:IPointOfSale_SubmitPayments_InputMessage"/>
>       <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/SubmitPaymentsResponse" message="tns:IPointOfSale_SubmitPayments_OutputMessage"/>
>     </wsdl:operation>
>     <wsdl:operation name="ProcessOrderFulfillment">
>       <wsdl:input wsaw:Action="http://tempuri.org/IPointOfSale/ProcessOrderFulfillment" message="tns:IPointOfSale_ProcessOrderFulfillment_InputMessage"/>
>       <wsdl:output wsaw:Action="http://tempuri.org/IPointOfSale/ProcessOrderFulfillmentResponse" message="tns:IPointOfSale_ProcessOrderFulfillment_OutputMessage"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:service name="PointOfSale">
>     <wsdl:port name="PosService_WSHTTP" binding="i0:PosService_WSHTTP">
>       <soap12:address location="http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc"/>
>       <wsa10:EndpointReference>
>         <wsa10:Address>http://10.1.90.54:1150/scriptmedPOSBIOST/PointOfSaleService.svc</wsa10:Address>
>         <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
>           <Upn>LocalService</Upn>
>         </Identity>
>       </wsa10:EndpointReference>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>
>
> synapse.xml:
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>
>     <proxy name="CreehanProxy" trace="enable" statistics="enable">
>         <target>
>             <endpoint>
>                 <address uri="http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc"/>
>             </endpoint>
>             <inSequence>
>                 <log level="full"/>
>             </inSequence>
>             <outSequence>
>                 <log level="full"/>
>                 <send/>
>             </outSequence>
>         </target>
>     </proxy>
> </definitions>
>
>
>
> axis2 programmatic configuration:
>
>     public void setUp()
>     {
>
>         String repositoryLocation = "C:/devtools/axis2-1.2/repository";
>     
>         serviceUrl = "http://10.1.90.54:1150/ScriptMedPOSBIOST/PointOfSaleService.svc";
>
>         prxUrl = "http://localhost:8280/soap/CreehanProxy";
>         
>         try
>         {
>             ConfigurationContext ctx = ConfigurationContextFactory
>             .createConfigurationContextFromFileSystem(repositoryLocation,
>                     null);
>
>           stub = new PointOfSaleStub(ctx, null);
>           client = stub._getServiceClient();
>           Options options = new Options();
>           
>           //set soap version
>           options.setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
>           
>           //do addressing
>           client.engageModule("addressing");
>           options.setTo(new EndpointReference(serviceUrl));
>           //options.setTo(new EndpointReference(prxUrl));
>           options.setProperty(Constants.Configuration.TRANSPORT_URL, prxUrl);
>           
>           options.setAction("http://tempuri.org/IPointOfSale/RetrievePatientInfoWithOrders");
>           
>           /*
>           HttpTransportProperties.ProxyProperties proxyProperties =
>               new HttpTransportProperties.ProxyProperties();
>           URL url = new URL(prxUrl);
>           proxyProperties.setProxyName(url.getHost());
>           proxyProperties.setProxyPort(url.getPort());
>           proxyProperties.setUserName("");
>           proxyProperties.setPassWord("");
>           proxyProperties.setDomain("");
>           options.setProperty(HTTPConstants.PROXY, proxyProperties);
>           */    
>           
>           client.setOptions(options);
>         }
>         catch (AxisFault e)
>         {
>         }
>
>     }
>
>
>