Hi,
I started implementing the solution that you outlined but ran in to some
hurdles, mostly through my lack of understanding.
1) From what you said this technique is only for dynamically resolving
endpoints. Does this mean that for each unique web service call I have
to add a matching HttpProvider endpoint to the servicemix.xml config
file?
2) I wrote my router based on AbstractContentBasedRouter as you
suggested
public class MyRouter extends AbstractContentBasedRouter {
protected ExchangeTarget getDestination(MessageExchange exchange)
throws
Exception {
String locationUri = "http://dynamic.webservice.to.call";
String soapAction = "MyAction";
ExchangeTarget target = new ExchangeTarget();
target.setUri(locationUri + "?soapAction=" + soapAction);
return target;
}
}
and I am able to build the locationUri and soapAction from the
normalised message and set that on the exchange target. What I don't
understand is how that target is resolved to a specific HttpProvider
endpoint. So for e.g. if my URI resolves to
http://dynamic.webservice.to.call then do I need a provider endpoint in
the servicemix config with a matching URI for its name?
3) Where do I use the epr fragment in this scenario?
Thanks
Sufyan
-----Original Message-----
From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
Sent: 07 August 2006 17:24
To: [email protected]
Subject: Re: Servicemix-http configuring soapAction and locationURI
dynamically
I was talking mainly about endpoint resolution.
You should write a custom component which would be used as the target
for your jbi exchanges (instead of the http provider endpoint).
This component would use endpoint resolution as shown in the code
snippet:
DocumentFragment epr =
URIResolver.createWSAEPR("http://host/path?http.soapAction=myAction");
ServiceEndpoint se = getContext().resolveEndpointReference(epr);
exchange.setEndpoint(se);
send(exchange);
Then, you can create the URI the way you want by extracting these
informations from the incoming exchange
and give it to the createWSAEPR call.
The component would just forward the incoming exchange to the dynamic
endpoint.
As this is the role of the EIP ContentBasedRouter, I have just
refactored it
in an abstract class so it should be easier to extend.
You could define you own EIP router:
<eip:component>
<eip:endpoints>
<bean class="com.my.company.MyRouter" />
</eip:endpoints>
</eip:component>
And have
public class MyRouter extends AbstractContentBasedRouter {
protected ExchangeTarget getDestination(MessageExchange exchange)
throws
Exception {
String locationUri = xxx;
String soapAction = xxx;
ExchangeTarget target = new ExchangeTarget();
target.setUri(locationUri + "?soapAction=" + soapAction);
return target;
}
}
Does it make more sense ?
On 8/7/06, Sufyan Arif <[EMAIL PROTECTED]> wrote:
>
> Ok thanks I can try using that approach but it's not very clear how I
do
> that.
>
> So let me get this clear on the provider I set something like
>
> locationURI="interface:http://somenamespace/MyInterface"
>
>
> Do I then have to write an implementation of MyInterface and deploy it
> as a servicemix component? Does the interface need to implement a
> specific callback method?
>
>
> Thanks
>
>
> Sufyan
>
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
> Sent: 07 August 2006 16:35
> To: [email protected]
> Subject: Re: Servicemix-http configuring soapAction and locationURI
> dynamically
>
> Mmm, the soapAction could be easily done, but the locationURI would
> conflict
> with the consumer endpoint. We would need to first split the consumer
> endpoints
> and provider endpoints, but this is not planned for the next release.
>
> Have you tried using URIs / dynamic endpoint resolution instead ?
> See http://servicemix.goopen.org/site/uris.html
>
> On 8/7/06, Sufyan Arif <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> >
> >
> > Is it possible to configure the Provider endpoint soapAction and
> > locationURI using Xpath expressions?
> >
> >
> >
> > What I want to do is to define the end point once in servicemix.xml
> and
> > then examine the normalised message using xpath to obtain the
> > locationURI and pass this to the Provider.
> >
> >
> >
> > Thanks
> >
> >
> >
> >
> >
> > Sufyan
> >
> >
> > This transmission is confidential and intended solely for the person
> or
> > organisation to whom it is addressed. It may contain privileged and
> > confidential information. If you are not the intended recipient, you
> should
> > not copy, distribute or take any action in reliance on it. If you
have
> > received this transmission in error, please notify the sender
> immediately.
> > Any opinions or advice contained in this e-mail are those of the
> individual
> > sender except where they are stated to be the views of RDF Group
plc.
> All
> > messages passing through this gateway are virus scanned.
> >
> >
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
--
Cheers,
Guillaume Nodet