You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by João Luz <jl...@sinfic.pt> on 2006/05/03 13:07:29 UTC
Can't obtain response from sm...
Hello,
I’ve tried RemoteServiceClient and now I’m trying with HttpConnector as a binding component..
I’m using lwcontainer and deploying on it a service assembly.
The client is like this:
HttpClient client = new HttpClient();
GetMethod get = new GetMethod("http://localhost:8912/test?testProperty=111");
try {
client.executeMethod(get);
→ System.out.println(get.getResponseBodyAsString());
} catch (Exception e) {
e.printStackTrace();
}finally {
get.releaseConnection();
}
Component bean is:
public class TestBroker extends TransformComponentSupport {
private static final Log log = LogFactory.getLog(TestBroker.class);
protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException {
String test = (String) in.getProperty("testProperty");
System.out.println("Property received:" + test);
out.setProperty("testProperty", test + " -- added");
return true;
}
}
HttpConnector and Component are configured like this:
<sm:activationSpec componentName="loanBrokerHttpBinding"
destinationService="lb:test-broker">
<sm:component>
<bean class="org.apache.servicemix.components.http.HttpConnector">
<property name="host" value="localhost"/>
<property name="port" value="8912"/>
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="test-broker"
service="lb:test-broker">
<sm:component>
<bean class="loanbroker.TestBroker" />
</sm:component>
</sm:activationSpec>
My problem is that I don’t receive the message back, but the component receive the request since it print “Property Received: 111”
Thanks in advance,
João
Re: Can't obtain response from sm...
Posted by Guillaume Nodet <gn...@gmail.com>.
Properties are not returned back from the http component.
You should set an xml content on the out message and you will receive it...
Cheers,
Guillaume Nodet
On 5/3/06, João Luz <jl...@sinfic.pt> wrote:
> Hello,
>
> I've tried RemoteServiceClient and now I'm trying with HttpConnector as a binding component..
> I'm using lwcontainer and deploying on it a service assembly.
>
> The client is like this:
> HttpClient client = new HttpClient();
> GetMethod get = new GetMethod("http://localhost:8912/test?testProperty=111");
> try {
> client.executeMethod(get);
> → System.out.println(get.getResponseBodyAsString());
> } catch (Exception e) {
> e.printStackTrace();
> }finally {
> get.releaseConnection();
> }
>
>
> Component bean is:
> public class TestBroker extends TransformComponentSupport {
>
> private static final Log log = LogFactory.getLog(TestBroker.class);
>
> protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException {
> String test = (String) in.getProperty("testProperty");
> System.out.println("Property received:" + test);
> out.setProperty("testProperty", test + " -- added");
> return true;
> }
> }
>
> HttpConnector and Component are configured like this:
>
> <sm:activationSpec componentName="loanBrokerHttpBinding"
> destinationService="lb:test-broker">
> <sm:component>
> <bean class="org.apache.servicemix.components.http.HttpConnector">
> <property name="host" value="localhost"/>
> <property name="port" value="8912"/>
> </bean>
> </sm:component>
> </sm:activationSpec>
> <sm:activationSpec componentName="test-broker"
> service="lb:test-broker">
> <sm:component>
> <bean class="loanbroker.TestBroker" />
> </sm:component>
> </sm:activationSpec>
>
> My problem is that I don't receive the message back, but the component receive the request since it print "Property Received: 111"
>
>
> Thanks in advance,
> João
>