Hi,
I also had this problem, I hope there will be soon a better way to do this
but i will explain how I am doing it currently.
routing from jsr181 to the rest of servicemix:
I deployed a pojo jsr181 endpoint.
<jsr181:endpoint ... >
<jsr181:pojo>
<bean class="com.test.TestWebService">
<property name="myProperty">
<ref bean="myBean" />
</property>
</bean>
</jsr181:pojo>
</jsr181:endpoint>
fortunately, the jsr181 component code injects your JBI component context if
you have a ComponentContext property in your pojo declared, something like
this:
private ComponentContext context;
@WebMethod(exclude = true)
public ComponentContext getContext() {
return context;
}
@WebMethod(exclude = true)
public void setContext(ComponentContext context) {
this.context = context;
}
Im not sure if you need the property accessor methods but I have them.
Now, if you know where is your message going to forward to (i.e. if you know
where is located your business component ) then you can proceed and use the
context to deliver the message. Something like this:
protected void forward(NormalizedMessage msg) {
EndpointDeliveryChannel channel;
try {
channel = (EndpointDeliveryChannel) context.getDeliveryChannel();
ServiceEndpoint se = context.getEndpoint( new QName("foo:test"),
"myEndpoint");
InOnly exch = channel.createExchangeFactory(se)
.createInOnlyExchange();
exch.setInMessage(msg);
context.getDeliveryChannel().send(exch);
}
} catch (MessagingException e) {
e.printStackTrace();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
with that method you can manually create your NormalizedMessage and send it
to the deliverychannel to the service you specify. Note that this approach
doesnt involve any security at all (i.e. you might have chained your jsr181
endpoint with a servicemix-http endpoint. If you have done this and you need
any info such as username/password, you will find that with
JBIContext.getMessageExchange() )
reply if you have any issues or if this didn't work at all :)
Eduardo Burgos
On 2/19/07, Vinod Chhabria <[EMAIL PROTECTED]> wrote:
Hi,
I have a need to create a flow by routing through various components of
servicemix. Please guide me.
Here are my requirements:
1. A web service is exposed for clients.
2. This web service is the starting point of the flow.
3. From this web service I need to call another business component
/ service that does some validation
4. Then another business component / service that executes some
business logic
5. Then there is a router to be called that conditionally routes to
different transformation components.
6. After the transformation component a web service of an external
application needs to be invoked.
7. The response of this web service then needs to be transformed
and sent back as a response to the client that invoked our web service
that was invoked.
I need to understand how to configure this flow.
1. Do I expose the business components as web services using
servicemix-jsr181?
2. If yes, but from one servicemix-jsr181 component how do I route
to another servicemix-jsr181 without calling it in the code?
3. I know bpel is used for web services orchestration, but can I
use it to orchestrate part of my flow i.e. I use bpel only to
orchestrate the first 3 services and then I use some routing component
to route to other transformation components further on?
Regards,
Vinod.
<http://dataexchange.sterlingtesting.com/images/sigs/image001.gif>
<http://dataexchange.sterlingtesting.com/images/sigs/image000.gif>
Vinod H. Chhabria :: Senior Developer, Integration Services
Sterling Testing Systems :: 249 West 17th Street :: 6th Floor :: New
York :: NY :: 10011
646-435-2208 (t) :: 646-435-2281 (f)
www.sterlingtesting.com <http://www.sterlingtesting.com>
This email (and any attachments) is intended only for the use of the
individual or entity named above and may contain information that is
privileged and confidential. If you are not the intended recipient, or have
unauthorized access, you are hereby notified that copying, disseminating,
distributing or taking any action in reliance on this email is strictly
prohibited<br />
Opinions, conclusions and other information in this message that do not
relate to the official business of our firm shall be understood as neither
given nor endorsed by it.