Jaba
Jaba

Reputation: 33

How to call webservice in WSO2 proxy

how I can call web service inside of proxy? Proxy itself works fine, and I added call of logging web service in "in" sequence. I create call using payload factory + send.

Problem is, that proxy now returns result of this logging web service instead of what web service should return. There is address end point defined in "out" sequence.

I am using WSO2 ESB 4.6.0.

Upvotes: 1

Views: 1028

Answers (2)

Anusha Ruwanpathirana
Anusha Ruwanpathirana

Reputation: 107

There are two ways you can achieve the logs

1. Log ESB incoming and outgoing messages through wire log.

To enable debug mode for wire logs; - ESB console > Configure > Logging - Set “org.apache.synapse.transport.http.wire” level to “DEBUG”.

In the log, it indicates >> incoming messages to ESB

                 <<  outgoing messages from  ESB

2. Use Logs at the appropriate place

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="TestProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="full">
            <property name="test" value="incomming to ESB-----------------------"/>
         </log>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
         </send>
         <log level="full">
            <property name="test" value="outcomming from ESB-----------------------"/>
         </log>
      </inSequence>
      <outSequence>
         <log level="full">
            <property name="test" value="incomming to ESB-----------------------"/>
         </log>
         <send/>
         <log level="full">
            <property name="test" value="outcomming from ESB-----------------------"/>
         </log>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
   <description/>
</proxy>

If it is resolve your problem, please flag as answered.

Upvotes: 1

Anusha Ruwanpathirana
Anusha Ruwanpathirana

Reputation: 107

This is the simple example of calling web service inside of the proxy. You need to up back-end service before create the proxy

<proxy xmlns="http://ws.apache.org/ns/synapse" name="customPro" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
         </send>
      </inSequence>
      <out-sequence>
         <send/>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
   <description></description>
</proxy>

You need to define web service url within the end-point in tag

As well as, this kind of send mediator return end-point response to outSequence by default.

You can get good understanding of these if you go through the ESB documentation from following url

http://docs.wso2.org/display/ESB460/Samples

If you need further help, feel free to ask here

Upvotes: 2

Related Questions