richard
richard

Reputation: 2053

how to use wso2 esb connector in proxy

I download esb connector from git and follow steps to deploy foo-connector. These operation are all ok.

After I tried to create a proxy to try on this connector, and invoke by fiddler with url "http://t00012-laptop:8010/services/foo". ESB always give response 202.

The esb proxy configuration is following:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="foo"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>         
        <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" type="BOOLEAN"/>
         <foo.foo-operation>         
         </foo.foo-operation>        
      </inSequence>
      <outSequence>
         <log/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

Upvotes: 0

Views: 439

Answers (2)

Tharik Kanaka
Tharik Kanaka

Reputation: 2510

If you want to return the response of endpoint to caller just add response tag inside inSequence as shown below.

 <?xml version="1.0" encoding="UTF-8"?>
    <proxy xmlns="http://ws.apache.org/ns/synapse"
           name="foo"
           transports="https,http"
           statistics="disable"
           trace="disable"
           startOnLoad="true">
       <target>
          <inSequence>         
            <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" type="BOOLEAN"/>
             <foo.foo-operation>         
             </foo.foo-operation> 
             <respond/>       
          </inSequence>
          <outSequence>
             <log/>
             <send/>
          </outSequence>
       </target>
       <description/>
    </proxy>

Upvotes: 0

Jean-Michel
Jean-Michel

Reputation: 5946

Have a look at foo connector source code :

  • foo-operation is a template that just log the message payload + the value of a parameter named "generated_param" and then call a class org.wso2.carbon.connector.foo

  • This class print Hello WORLD in std output with the value of "generated_param"

If you change your proxy def like this :

<proxy xmlns="http://ws.apache.org/ns/synapse" name="foo" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
    <target>
        <inSequence>
            <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" type="STRING"/>
            <foo.foo-operation>
                <generated_param>ROJ</generated_param>
            </foo.foo-operation>
        </inSequence>
    </target>
    <description/>
</proxy>

call http://t00012-laptop:8010/services/foo : you will receive an empty response with http status code 202 and will see in std output from the ESB :

[2014-09-19 08:20:44,640]  INFO - LogMediator To: /services/TestFOO, MessageID:
urn:uuid:874f494e-86fa-49b5-b0b5-2b5f781eca43, Direction: request, template_para
m = ROJ, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns
:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body></soapenv:Bod
y></soapenv:Envelope>
Hello WORLD foo !!! : paramter :ROJ

That's all...

Upvotes: 2

Related Questions