You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Tom <u0...@gmail.com> on 2006/02/27 17:30:24 UTC

Routing to external WebServices from ServiceMix

Hello all,

I'm relatively new to ServiceMix. I am trying to get the following 
working :
1. A BPEL process (that is deployed on the PXE-engine in ServiceMix) 
generates result messages and these should be routed to an external Java 
WebService (later multiple webservices depending on the resulting 
message). Normally, based on the binding in the WSDL from the extrenal 
webservice, the message would be routed from the JBI-endpoint (of the 
BPELprocess deployed in ServiceMix) to the URL specified in this 
binding. How is it possible to let the routing first go to the 
http-binding component and then to the URL? Is there a dynamic solution 
or does it have to be hard-coded?
2. Additional, when multiple external webservices must be invoked : When 
the messages pass from the BPEL process through the http-binding 
component, how can this http-binding component determine which external 
webservice to invoke? Should the binding component act as a 
content-based router or are there alternatives?

Thanks in advance.
Greetz,

Tom

Re: Routing to external WebServices from ServiceMix

Posted by Guillaume Nodet <gn...@gmail.com>.
See comments inline...

On 3/8/06, Tom <u0...@gmail.com> wrote:
>
> Hello,
>
> First of all, thanx for the previous help Guillaume.
> Now I've got some more questions. Our setup is as follows (see attachment)
> :
> There are (currently) 4 WebServices available. A BPEL process that is
> running on the PXE needs to communicate with all four of the services.
> Before any message from the BPEL process is passed to the appropriate WS, it
> must pass first through a single logging-component and then via a
> SAAJ-binding-component to the correct endpoint.
>
> Currently, we could realize this setup as follows :
> - The PXE-system.xml of the BPEL process exports 4 ports, each for one
> external WebService.
> - We had to create 4 logging components (as service assemblies in a
> lightweight container), where the servicename and endpoint corresponds to
> the exported ports of the pxe-system.xml
> - Then each logging component forwards the message through a SAAJ
> component to each WebService (resulting in 4 SAAJ components)
> - The logging component removes the SOAP-header from the SOAP-messages
> that are returned from the WebServices.
> - All communication is synchronous : the client gets the resulting answer
> in a synchronous way
>
> Problems :
> - We want to have only one logging component and one SAAJ-component
> instead of 4 each
> - We would like to replace the SAAJ-component with a SOAP-component
> because the WebServices return SOAP answers.
> - We would like to have a loose coupling to the WSDLs of the WebServices
> (so we won't have to hard code the locations of the WSDLs)
>
> Questions :
> - What are the possibilities in ServiceMix to realize the scenario as
> dynamically as possible? In the examples in ServiceMix, the links between
> endpoints are always hard-coded. Is it possible to route more dynamically?
> Are there code examples available of this?
>

The only real way to do dynamic routing is to use a content based router.
You could use drools, a groovy script or an xslt stylesheet for that (but
the xslt does not support in-out mep currently).

- Should the PXE-system.xml export only one port (the one of the logger
> component)? And must the messages then be content-based-routed after they
> pass through
>    the logger? Or are there other possibilities?
>

First, if PXE sends all exchanges to the same target endpoint, you will have
to use content-based routing somewhere.
If this is possible, this may be the easiest solution.
Depending on what kind of logging component you use, an improvement could be
to use a ChainedComponent (which receives an exchange and route it to
several endpoints, the input of the next one being the output of the
previous one), so that the logging component will be isolated from the rest
of the flow.

- Which HTTP SOAP-component from the 3.0 snapshot could replace the
> SAAJ-binding to remove and add the SOAP-headers and allow the synchronous
> communication?
>

You should use the servicemix-http binding component.  This is not well
documented yet, but you will be able to find examples in the distribution
(soap-binding example) or in the tests of this component.

- Is it possible to realize this setup by registering the WSDLs of the
> WebServices as endpoints in one SOAP-binding? In the previous answer, you
> suggested to bundle two service units into a single service assembly. Does
> this mean that it is possible to create a service unit for every WSDL from
> the external WebServices and bundle them into a SA? So in our case, we make
> 4 service units (for each of the WebServices) and combine them into a
> service assembly together with the HTTP SOAP-components to make 4
> JBI-endpoints available for the logging component?
>

The WSDLs *are the soap endpoints so you just need to deploy them onto the
servicemix-http component.  It will activate endpoints and will handles all
the soap stuff for you.

- Can endpoints be created on-the-fly? If for example a UDDI registry is
> available (and polled once in a while), can endpoints be created and removed
> as more or less WebServices are registered in the UDDI? Or are there any
> alternatives available in ServiceMix? And in this way, can new service units
> be created and on-the-fly bundled into an existing service assembly?
>

Yes, endpoints are not tied to service units.  They can be created on the
fly, and polling an UDDI registry is definitely an option, though this has
not been done yet.

Guillaume

Thanks in advance,
> Tom
>
>
> Guillaume Nodet schreef:
>
> Hi Tom,
>
> A BPEL engine integrated in a JBI container should not directly invoke
> external web services over http.  It should go through an http binding
> component.
> In the pxe-system.xml, you can specify services to export (with the <exports
> /> tag).  It means that PXE will send a JBI MessageExchange to the specified
> JBI endpoint to handle the invocation.  The binding informations on the wsdl
> are not used by PXE.  To route your request to the url you want, you have to
> use a lightweight http or soap binding (see http://servicemix.org/HTTP),
> specifying the informations you need (service and endpoint name, url).
> You can also use the servicemix-http component to deploy a service unit
> (using a wsdl), which would use the binding informations to retrieve the url
> of the service and bundle the two service units in a single service
> assembly.
>
> Cheers,
> Guillaume Nodet
>
>
> On 2/27/06, Tom <u0...@gmail.com> <u0...@gmail.com> wrote:
>
>  Hello all,
>
> I'm relatively new to ServiceMix. I am trying to get the following
> working :
> 1. A BPEL process (that is deployed on the PXE-engine in ServiceMix)
> generates result messages and these should be routed to an external Java
> WebService (later multiple webservices depending on the resulting
> message). Normally, based on the binding in the WSDL from the extrenal
> webservice, the message would be routed from the JBI-endpoint (of the
> BPELprocess deployed in ServiceMix) to the URL specified in this
> binding. How is it possible to let the routing first go to the
> http-binding component and then to the URL? Is there a dynamic solution
> or does it have to be hard-coded?
> 2. Additional, when multiple external webservices must be invoked : When
> the messages pass from the BPEL process through the http-binding
> component, how can this http-binding component determine which external
> webservice to invoke? Should the binding component act as a
> content-based router or are there alternatives?
>
> Thanks in advance.
> Greetz,
>
> Tom
>
>
>

Re: Routing to external WebServices from ServiceMix

Posted by Tom <u0...@gmail.com>.
Apparently, the .jpg of the setup wasn't accepted by the mailing list.
The diagram can be found here : http://www.boza.be/SetupDiagram.jpg

Tom


Tom schreef:

> Hello,
>
> First of all, thanx for the previous help Guillaume.
> Now I've got some more questions. Our setup is as follows (see 
> attachment) :
> There are (currently) 4 WebServices available. A BPEL process that is 
> running on the PXE needs to communicate with all four of the services. 
> Before any message from the BPEL process is passed to the appropriate 
> WS, it must pass first through a single logging-component and then via 
> a SAAJ-binding-component to the correct endpoint.
>
> Currently, we could realize this setup as follows :
> - The PXE-system.xml of the BPEL process exports 4 ports, each for one 
> external WebService.
> - We had to create 4 logging components (as service assemblies in a 
> lightweight container), where the servicename and endpoint corresponds 
> to the exported ports of the pxe-system.xml
> - Then each logging component forwards the message through a SAAJ 
> component to each WebService (resulting in 4 SAAJ components)
> - The logging component removes the SOAP-header from the SOAP-messages 
> that are returned from the WebServices.
> - All communication is synchronous : the client gets the resulting 
> answer in a synchronous way
>
> Problems :
> - We want to have only one logging component and one SAAJ-component 
> instead of 4 each
> - We would like to replace the SAAJ-component with a SOAP-component 
> because the WebServices return SOAP answers.
> - We would like to have a loose coupling to the WSDLs of the 
> WebServices (so we won't have to hard code the locations of the WSDLs)
>
> Questions :
> - What are the possibilities in ServiceMix to realize the scenario as 
> dynamically as possible? In the examples in ServiceMix, the links 
> between endpoints are always hard-coded. Is it possible to route more 
> dynamically? Are there code examples available of this?
> - Should the PXE-system.xml export only one port (the one of the 
> logger component)? And must the messages then be content-based-routed 
> after they pass through
>    the logger? Or are there other possibilities?
> - Which HTTP SOAP-component from the 3.0 snapshot could replace the 
> SAAJ-binding to remove and add the SOAP-headers and allow the 
> synchronous communication?
> - Is it possible to realize this setup by registering the WSDLs of the 
> WebServices as endpoints in one SOAP-binding? In the previous answer, 
> you  suggested to bundle two service units into a single service 
> assembly. Does this mean that it is possible to create a service unit 
> for every WSDL from the external WebServices and bundle them into a 
> SA? So in our case, we make 4 service units (for each of the 
> WebServices) and combine them into a service assembly together with 
> the HTTP SOAP-components to make 4 JBI-endpoints available for the 
> logging component?
> - Can endpoints be created on-the-fly? If for example a UDDI registry 
> is available (and polled once in a while), can endpoints be created 
> and removed as more or less WebServices are registered in the UDDI? Or 
> are there any alternatives available in ServiceMix? And in this way, 
> can new service units be created and on-the-fly bundled into an 
> existing service assembly?
>
> Thanks in advance,
> Tom
>
>
> Guillaume Nodet schreef:
>
>>Hi Tom,
>>
>>A BPEL engine integrated in a JBI container should not directly invoke
>>external web services over http.  It should go through an http binding
>>component.
>>In the pxe-system.xml, you can specify services to export (with the <exports
>>/> tag).  It means that PXE will send a JBI MessageExchange to the specified
>>JBI endpoint to handle the invocation.  The binding informations on the wsdl
>>are not used by PXE.  To route your request to the url you want, you have to
>>use a lightweight http or soap binding (see http://servicemix.org/HTTP),
>>specifying the informations you need (service and endpoint name, url).
>>You can also use the servicemix-http component to deploy a service unit
>>(using a wsdl), which would use the binding informations to retrieve the url
>>of the service and bundle the two service units in a single service
>>assembly.
>>
>>Cheers,
>>Guillaume Nodet
>>
>>
>>On 2/27/06, Tom <u0...@gmail.com> wrote:
>>  
>>
>>>Hello all,
>>>
>>>I'm relatively new to ServiceMix. I am trying to get the following
>>>working :
>>>1. A BPEL process (that is deployed on the PXE-engine in ServiceMix)
>>>generates result messages and these should be routed to an external Java
>>>WebService (later multiple webservices depending on the resulting
>>>message). Normally, based on the binding in the WSDL from the extrenal
>>>webservice, the message would be routed from the JBI-endpoint (of the
>>>BPELprocess deployed in ServiceMix) to the URL specified in this
>>>binding. How is it possible to let the routing first go to the
>>>http-binding component and then to the URL? Is there a dynamic solution
>>>or does it have to be hard-coded?
>>>2. Additional, when multiple external webservices must be invoked : When
>>>the messages pass from the BPEL process through the http-binding
>>>component, how can this http-binding component determine which external
>>>webservice to invoke? Should the binding component act as a
>>>content-based router or are there alternatives?
>>>
>>>Thanks in advance.
>>>Greetz,
>>>
>>>Tom
>>>
>>>    
>>>
>>
>>  
>>
>


Re: Routing to external WebServices from ServiceMix

Posted by Tom <u0...@gmail.com>.
Hello,

First of all, thanx for the previous help Guillaume.
Now I've got some more questions. Our setup is as follows (see 
attachment) :
There are (currently) 4 WebServices available. A BPEL process that is 
running on the PXE needs to communicate with all four of the services. 
Before any message from the BPEL process is passed to the appropriate 
WS, it must pass first through a single logging-component and then via a 
SAAJ-binding-component to the correct endpoint.

Currently, we could realize this setup as follows :
- The PXE-system.xml of the BPEL process exports 4 ports, each for one 
external WebService.
- We had to create 4 logging components (as service assemblies in a 
lightweight container), where the servicename and endpoint corresponds 
to the exported ports of the pxe-system.xml
- Then each logging component forwards the message through a SAAJ 
component to each WebService (resulting in 4 SAAJ components)
- The logging component removes the SOAP-header from the SOAP-messages 
that are returned from the WebServices.
- All communication is synchronous : the client gets the resulting 
answer in a synchronous way

Problems :
- We want to have only one logging component and one SAAJ-component 
instead of 4 each
- We would like to replace the SAAJ-component with a SOAP-component 
because the WebServices return SOAP answers.
- We would like to have a loose coupling to the WSDLs of the WebServices 
(so we won't have to hard code the locations of the WSDLs)

Questions :
- What are the possibilities in ServiceMix to realize the scenario as 
dynamically as possible? In the examples in ServiceMix, the links 
between endpoints are always hard-coded. Is it possible to route more 
dynamically? Are there code examples available of this?
- Should the PXE-system.xml export only one port (the one of the logger 
component)? And must the messages then be content-based-routed after 
they pass through
   the logger? Or are there other possibilities?
- Which HTTP SOAP-component from the 3.0 snapshot could replace the 
SAAJ-binding to remove and add the SOAP-headers and allow the 
synchronous communication?
- Is it possible to realize this setup by registering the WSDLs of the 
WebServices as endpoints in one SOAP-binding? In the previous answer, 
you  suggested to bundle two service units into a single service 
assembly. Does this mean that it is possible to create a service unit 
for every WSDL from the external WebServices and bundle them into a SA? 
So in our case, we make 4 service units (for each of the WebServices) 
and combine them into a service assembly together with the HTTP 
SOAP-components to make 4 JBI-endpoints available for the logging component?
- Can endpoints be created on-the-fly? If for example a UDDI registry is 
available (and polled once in a while), can endpoints be created and 
removed as more or less WebServices are registered in the UDDI? Or are 
there any alternatives available in ServiceMix? And in this way, can new 
service units be created and on-the-fly bundled into an existing service 
assembly?

Thanks in advance,
Tom


Guillaume Nodet schreef:

>Hi Tom,
>
>A BPEL engine integrated in a JBI container should not directly invoke
>external web services over http.  It should go through an http binding
>component.
>In the pxe-system.xml, you can specify services to export (with the <exports
>/> tag).  It means that PXE will send a JBI MessageExchange to the specified
>JBI endpoint to handle the invocation.  The binding informations on the wsdl
>are not used by PXE.  To route your request to the url you want, you have to
>use a lightweight http or soap binding (see http://servicemix.org/HTTP),
>specifying the informations you need (service and endpoint name, url).
>You can also use the servicemix-http component to deploy a service unit
>(using a wsdl), which would use the binding informations to retrieve the url
>of the service and bundle the two service units in a single service
>assembly.
>
>Cheers,
>Guillaume Nodet
>
>
>On 2/27/06, Tom <u0...@gmail.com> wrote:
>  
>
>>Hello all,
>>
>>I'm relatively new to ServiceMix. I am trying to get the following
>>working :
>>1. A BPEL process (that is deployed on the PXE-engine in ServiceMix)
>>generates result messages and these should be routed to an external Java
>>WebService (later multiple webservices depending on the resulting
>>message). Normally, based on the binding in the WSDL from the extrenal
>>webservice, the message would be routed from the JBI-endpoint (of the
>>BPELprocess deployed in ServiceMix) to the URL specified in this
>>binding. How is it possible to let the routing first go to the
>>http-binding component and then to the URL? Is there a dynamic solution
>>or does it have to be hard-coded?
>>2. Additional, when multiple external webservices must be invoked : When
>>the messages pass from the BPEL process through the http-binding
>>component, how can this http-binding component determine which external
>>webservice to invoke? Should the binding component act as a
>>content-based router or are there alternatives?
>>
>>Thanks in advance.
>>Greetz,
>>
>>Tom
>>
>>    
>>
>
>  
>


Re: Routing to external WebServices from ServiceMix

Posted by Guillaume Nodet <gn...@gmail.com>.
Hi Tom,

A BPEL engine integrated in a JBI container should not directly invoke
external web services over http.  It should go through an http binding
component.
In the pxe-system.xml, you can specify services to export (with the <exports
/> tag).  It means that PXE will send a JBI MessageExchange to the specified
JBI endpoint to handle the invocation.  The binding informations on the wsdl
are not used by PXE.  To route your request to the url you want, you have to
use a lightweight http or soap binding (see http://servicemix.org/HTTP),
specifying the informations you need (service and endpoint name, url).
You can also use the servicemix-http component to deploy a service unit
(using a wsdl), which would use the binding informations to retrieve the url
of the service and bundle the two service units in a single service
assembly.

Cheers,
Guillaume Nodet


On 2/27/06, Tom <u0...@gmail.com> wrote:
>
> Hello all,
>
> I'm relatively new to ServiceMix. I am trying to get the following
> working :
> 1. A BPEL process (that is deployed on the PXE-engine in ServiceMix)
> generates result messages and these should be routed to an external Java
> WebService (later multiple webservices depending on the resulting
> message). Normally, based on the binding in the WSDL from the extrenal
> webservice, the message would be routed from the JBI-endpoint (of the
> BPELprocess deployed in ServiceMix) to the URL specified in this
> binding. How is it possible to let the routing first go to the
> http-binding component and then to the URL? Is there a dynamic solution
> or does it have to be hard-coded?
> 2. Additional, when multiple external webservices must be invoked : When
> the messages pass from the BPEL process through the http-binding
> component, how can this http-binding component determine which external
> webservice to invoke? Should the binding component act as a
> content-based router or are there alternatives?
>
> Thanks in advance.
> Greetz,
>
> Tom
>