You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by roshansn <sn...@gmail.com> on 2010/01/18 10:35:55 UTC

How to pass additional parameters to a WSDL

Hi,
I need to pass some information like application id in additional to the
soap body. How I can configure this. When request comes for a web service i
need to get the that additional information from a service engine.

Thanks
-- 
View this message in context: http://old.nabble.com/How-to-pass-additional-parameters-to-a-WSDL-tp27207998p27207998.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to pass additional parameters to a WSDL

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

You have two ways to do it:
- the EIP one. Using Camel, you can setup a content enricher. With the 
content enricher, you can add data to the message in transit.
It looks like:
from("jbi:A").setBody(body().append("<appid>12</appid>")).to("jbi:B");
You can find more information here:
http://camel.apache.org/content-enricher.html
- the other way is to use the programmatic one. Using the 
servicemix-bean you can deploy a bean that get the message content and 
apply the transformation that you need.
For example, you have a HTTP endpoint define like this:
<http:soap-consumer service="test:my" endpoint="soap"
	targetService="test:my" targetEndpoint="bean"
	locationURI="http://0.0.0.0:8192/test"/>
You can see that it routes to a bean endpoint defined like this:
<bean:endpoint service="test:my" endpoint="bean" bean="#listenerBean"/>
<bean id="listenerBean" class="org.apache.servicemix.bean.ListenerBean"/>
The ListenerBean looks like this:

import org.apache.servicemix.jbi.listener.MessageExchangeListener;
import org.apache.servicemix.jbi.util.MessageUtil;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;

import javax.annotation.Resource;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.xml.transform.Source;

public class ListenerBean implements MessageExchangeListener {

     @Resource
     private DeliveryChannel channel;

     public void onMessageExchange(MessageExchange exchange) throws 
MessagingException {
         if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
                         NormalizedMessage message = 
exchange.getMessage("in");
		        Source content = message.getContent();
			String body = (new SourceTransformer()).toString(content);
			body = body + "<appid>test</appid>";

			message.setContent(content);
			exchange.setMessage(message, "out");
			channel.send(exchange);
         }
     }

}

Like this ServiceMix can embed transformation logic or BAM.

Regards
JB


roshansn wrote:
> Hi,
> I need to pass some information like application id in additional to the
> soap body. How I can configure this. When request comes for a web service i
> need to get the that additional information from a service engine.
> 
> Thanks

Re: How to pass additional parameters to a WSDL

Posted by tranchida <gi...@tranchida.ch>.
You can use a camel pipeline to invoke your service engine use the out
message and enrich / transform your body message.

You can also add a custom marshaler to your soap endpoint 


roshansn wrote:
> 
> Hi,
> I need to pass some information like application id in additional to the
> soap body. How I can configure this. When request comes for a web service
> i need to get the that additional information from a service engine.
> 
> Thanks
> 

-- 
View this message in context: http://old.nabble.com/How-to-pass-additional-parameters-to-a-WSDL-tp27207998p27215573.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.