WSO2 ESB: DYNAMIC CHANGE IN ADDRESS ENERGY

how can i dynamically set the endpoint address

i sets the endpoint address to the property at run time and must replace the endpoint address URI with this value.

How can I set the value of the address URI with this value?

+6
source share
5 answers

You can create your endpoint, for example

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="MyEndpoint"> <http uri-template="{uri.var.full}?f={uri.var.f}{+uri.var.extra}" method="put"> </http> </endpoint> 

Then, before invoking the MyEndpoint endpoint, set the properties .. the properties to be analyzed for the endpoint must begin with uri.

I also found out that if you put the + symbol in front of the property name, it does not encode its URI, so it is convenient for creating parameters on the fly. Otherwise, for known parameters, you can do, as described above, for the parameter e

so something like

 <property name="uri.var.full" value="http://jarhedz.com/viewtopic.php"/> <property name="url.var.f" value="2"/> <property name="uri.var.extra" value="&t=39"/> <send> <endpoint key="MyEndpoint"></endpoint> </send> 

should bring you to the URL http://jarhedz.com/viewtopic.php?f=2&t=39

(By the way, as a note, if you use a web editor, he will complain about and ... his buggies, how the hell .. save it as

 &amp; 

.. and this saves it as / or a property using javascript)

+3
source

Use the Header meditaor to set the "to" header and use the default endpoint. Mark this post for a sample.

+2
source

Use the header mediator to set the "To" Address header to the value that you retrieve from your assigned property.

+1
source

If the server does not publish WSDL, see Myobis comment here . Tried addPort without success.

0
source

This method works for me correctly.

I need to create a dynamic url

http: // localhost: 8787 / { dynamic parameter }

Inside the endpoint, the url is as follows

http: // localhost: 8787 / {uri.var.servicepath}

Set the test variable as a dynamic parameter (if you need to set the value of Expression). Set the value to "test" inside the property broker. (I did this introxy service)

 <property name="uri.var.servicepath" scope="default" type="STRING" value="test"/> 

create endpoint

Here I created an HTTP endpoint

 <endpoint name="ServiceEP" xmlns="http://ws.apache.org/ns/synapse"> <http method="post" uri-template="http://localhost:8787/{uri.var.servicepath}"/> </endpoint> 

Then add this endpoint inside your proxy service or API

 <send> <endpoint key="ServiceEP"/> </send> 

Finally, your proxy looks like this

 <inSequence> <property name="uri.var.servicepath" scope="default" type="STRING" value="test"/> <send> <endpoint key="SurepayVASAppsEP"/> </send> </inSequence> 

Similarly, you can change each parameter url.Ex -:

Http: // {uri.var.hostname}: {uri.var.port} / {uri.var.servicepath}

0
source

All Articles