You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Andy Katz <ak...@tacpoint.com> on 2006/06/14 16:01:19 UTC
passing key/value pairs for posting into HttpInvoker
Hi everyone -
I'm trying to find an example of how I could pass data into the HttpInvoker
component for posting to the XML defined "url" attribute.
I'm trying to invoke a geo-coding service (same URL), but with different
*address* content on each message.
Many thanks!
Andy
Re: passing key/value pairs for posting into HttpInvoker
Posted by Guillaume Nodet <gn...@gmail.com>.
It seems fine.
Could you try with a recent snapshot ? the endpoint should be displayed
inside the
MessageExchange (when the delivery channel logs at debug level).
If you already have a recent snapshot, it means that:
* you did not call exchange.setEndpoint(se)
* something else, but no idea what currently ....
Cheers,
Guillaume Nodet
On 6/20/06, apinke <ap...@gmail.com> wrote:
>
>
> Guillaume ,
>
> The SE does not seem to be null , but I am not sure of the servicename
> format ..
>
> >> EPR is : [#document-fragment: null]
> >> EPR namespaceuri : null
> >> EPR prefix : null
> >> SE is : org.apache.servicemix.jbi.servicedesc.DynamicEndpoint@e0c7c3
> >> SE endpoint is :
> >> http://localhost:8080/ServiceMixTest/MockServlet?TEST1=VALUE1
> >> SE servicename is : {urn:servicemix:http}HttpComponent
> DEBUG - DeliveryChannel - Sent: MessageExchange[
> id: ID:blrkec72278D-1303-1150793366401-5:0
> status: Active
> role: consumer
> in: <?xml version="1.0" encoding="UTF-8"?>
> <value>TEST</value>
> ]
>
> Pat
> --
> View this message in context:
> http://www.nabble.com/passing-key-value-pairs-for-posting-into-HttpInvoker-t1786326.html#a4952205
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
Re: passing key/value pairs for posting into HttpInvoker
Posted by apinke <ap...@gmail.com>.
Guillaume ,
The SE does not seem to be null , but I am not sure of the servicename
format ..
>> EPR is : [#document-fragment: null]
>> EPR namespaceuri : null
>> EPR prefix : null
>> SE is : org.apache.servicemix.jbi.servicedesc.DynamicEndpoint@e0c7c3
>> SE endpoint is :
>> http://localhost:8080/ServiceMixTest/MockServlet?TEST1=VALUE1
>> SE servicename is : {urn:servicemix:http}HttpComponent
DEBUG - DeliveryChannel - Sent: MessageExchange[
id: ID:blrkec72278D-1303-1150793366401-5:0
status: Active
role: consumer
in: <?xml version="1.0" encoding="UTF-8"?>
<value>TEST</value>
]
Pat
--
View this message in context: http://www.nabble.com/passing-key-value-pairs-for-posting-into-HttpInvoker-t1786326.html#a4952205
Sent from the ServiceMix - User forum at Nabble.com.
Re: passing key/value pairs for posting into HttpInvoker
Posted by Guillaume Nodet <gn...@gmail.com>.
It does not replace any URI on a deployed endpoint, it dynamically creates
an endpoint,
so you do not need to deploy an endpoint.
Could you check that the epr and se variables are not null ?
Cheers,
Guillaume Nodet
On 6/20/06, apinke <ap...@gmail.com> wrote:
>
>
> Hi Guillaume ,
>
> I tried the way you have suggested , but heres the error I get :
> -----
> DEBUG - DeliveryChannel - Sent: MessageExchange[
> id: ID:PATPC-4463-1150773519872-5:0
> status: Active
> role: consumer
> in: <?xml version="1.0" encoding="UTF-8"?>
> <value>TEST</value>
> ]
> DEBUG - DefaultBroker - Routing exchange
> org.apache.servicemix.jbi.messaging.InOutI
> mpl@57ae58 to: null
> DEBUG - DeliveryChannel - Exception processing:
> ID:blrkec72278D-4463-1150773519872-5:
> 0 in DeliveryChannel{index-service}
> ERROR - SedaQueue -
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@8beff2
> got error processing org.apache.servicemix.jbi.messaging.InOutImpl@1128f5a
> javax.jbi.messaging.MessagingException: Could not find route for exchange:
> org.apache.servicemix.jbi
> .messaging.InOutImpl@57ae58 for service: null and interface: null
> -----
>
> I did install the servicemix-http component. I dropped the zip file in
> the
> directory that was being monitored by SM :
>
> DEBUG - InstallationService - Moved
> D:\servicemix\incubating-servicemix-3.0-SNAPSHOT\exam
> ples\http-binding\rootDir\tmp\servicemix-http-3.0-SNAPSHOT-installer.0.tmp
> to D:\servicemix\incubati
>
> ng-servicemix-3.0-SNAPSHOT\examples\http-binding\rootDir\components\servicemix-http\version_1
> DEBUG - HttpBootstrap - Initializing bootstrap
> DEBUG - HttpBootstrap - Bootstrap initialized
> DEBUG - HttpBootstrap - Bootstrap onInstall
> DEBUG - HttpBootstrap - Bootstrap onInstall done
> INFO - JBIContainer - Activating component for:
> [container=ServiceMix,name=servic
> emix-http] with service: null component:
> org.apache.servicemix.http.HttpComponent@d12eea
> DEBUG - HttpBootstrap - Cleaning up bootstrap
> DEBUG - HttpBootstrap - Bootstrap cleaned up
> INFO - ComponentMBeanImpl - Starting component:
> servicemix-http
> INFO - ComponentMBeanImpl - Initializing component:
> servicemix-http
> DEBUG - HttpComponent - Initializing component
> DEBUG - HttpComponent - Component initialized
> DEBUG - HttpComponent - Starting component
> DEBUG - HttpComponent - Component started
> DEBUG - SedaFlow - Called Flow resume
> INFO - AutoDeploymentService - Directory: install: Finished
> installation of archive: serv
> icemix-http-3.0-SNAPSHOT-installer.zip
>
> ---
> Heres how the activation spec in servicemix.xml looks like :
> <sm:activationSpec>
> <sm:component>
> <http:component>
> <http:endpoints>
> <http:endpoint service="foo:hservice"
> endpoint="hservice"
> role="provider"
> locationURI="http://toreplace" />
> </http:endpoints>
> </http:component>
> </sm:component>
> </sm:activationSpec>
>
> --
> Looks like the service is not being set.
> Any help will be appreciated.
>
> Thanks
> Pat
> --
> View this message in context:
> http://www.nabble.com/passing-key-value-pairs-for-posting-into-HttpInvoker-t1786326.html#a4948565
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
Re: passing key/value pairs for posting into HttpInvoker
Posted by apinke <ap...@gmail.com>.
Hi Guillaume ,
I tried the way you have suggested , but heres the error I get :
-----
DEBUG - DeliveryChannel - Sent: MessageExchange[
id: ID:PATPC-4463-1150773519872-5:0
status: Active
role: consumer
in: <?xml version="1.0" encoding="UTF-8"?>
<value>TEST</value>
]
DEBUG - DefaultBroker - Routing exchange
org.apache.servicemix.jbi.messaging.InOutI
mpl@57ae58 to: null
DEBUG - DeliveryChannel - Exception processing:
ID:blrkec72278D-4463-1150773519872-5:
0 in DeliveryChannel{index-service}
ERROR - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@8beff2
got error processing org.apache.servicemix.jbi.messaging.InOutImpl@1128f5a
javax.jbi.messaging.MessagingException: Could not find route for exchange:
org.apache.servicemix.jbi
.messaging.InOutImpl@57ae58 for service: null and interface: null
-----
I did install the servicemix-http component. I dropped the zip file in the
directory that was being monitored by SM :
DEBUG - InstallationService - Moved
D:\servicemix\incubating-servicemix-3.0-SNAPSHOT\exam
ples\http-binding\rootDir\tmp\servicemix-http-3.0-SNAPSHOT-installer.0.tmp
to D:\servicemix\incubati
ng-servicemix-3.0-SNAPSHOT\examples\http-binding\rootDir\components\servicemix-http\version_1
DEBUG - HttpBootstrap - Initializing bootstrap
DEBUG - HttpBootstrap - Bootstrap initialized
DEBUG - HttpBootstrap - Bootstrap onInstall
DEBUG - HttpBootstrap - Bootstrap onInstall done
INFO - JBIContainer - Activating component for:
[container=ServiceMix,name=servic
emix-http] with service: null component:
org.apache.servicemix.http.HttpComponent@d12eea
DEBUG - HttpBootstrap - Cleaning up bootstrap
DEBUG - HttpBootstrap - Bootstrap cleaned up
INFO - ComponentMBeanImpl - Starting component: servicemix-http
INFO - ComponentMBeanImpl - Initializing component:
servicemix-http
DEBUG - HttpComponent - Initializing component
DEBUG - HttpComponent - Component initialized
DEBUG - HttpComponent - Starting component
DEBUG - HttpComponent - Component started
DEBUG - SedaFlow - Called Flow resume
INFO - AutoDeploymentService - Directory: install: Finished
installation of archive: serv
icemix-http-3.0-SNAPSHOT-installer.zip
---
Heres how the activation spec in servicemix.xml looks like :
<sm:activationSpec>
<sm:component>
<http:component>
<http:endpoints>
<http:endpoint service="foo:hservice"
endpoint="hservice"
role="provider"
locationURI="http://toreplace" />
</http:endpoints>
</http:component>
</sm:component>
</sm:activationSpec>
--
Looks like the service is not being set.
Any help will be appreciated.
Thanks
Pat
--
View this message in context: http://www.nabble.com/passing-key-value-pairs-for-posting-into-HttpInvoker-t1786326.html#a4948565
Sent from the ServiceMix - User forum at Nabble.com.
Re: passing key/value pairs for posting into HttpInvoker
Posted by Guillaume Nodet <gn...@gmail.com>.
Try something like
InOut exchange =
getContext().getDeliveryChannel().createExchangeFactory().createInOutExchange();
DocumentFragment epr =
URIResolver.createWSAEPR("http://localhost:8080/ServiceMixTest/MockServlet?KEY1=VALUE1");
ServiceEndpoint se = getContext().resolveEndpointReference(epr);
exchange.setEndpoint(se);
NormalizedMessage msg = exchange.createMessage();
msg.setContent(new StringSource("<value>TEST</value>"));
exchange.setInMessage(msg);
getContext().getDeliveryChannel().send(exchange);
You will need an installed servicemix-http component for this to work.
Cheers,
Guillaume Nodet
On 6/19/06, apinke <ap...@gmail.com> wrote:
>
>
> Hi Guillaume ,
>
> I too have this requirement but I am not able to understand how to apply
> whats mentioned on
> http://servicemix.goopen.org/site/uris.html.
>
> I am currently creating messages like this :
> InOut inout = createInOutExchange(new QName(Constants.MY_NAMESPACE,
> Constants.HSERVICE), null, null);
> inout.setProperty(Constants.PROPERTY_CORRELATIONID, id);
>
> inout.setProperty("locationURI","
> http://localhost:8080/ServiceMixTest/MockServlet?KEY1=VALUE1");
> //this did not work
>
> NormalizedMessage msg = inout.createMessage();
> msg.setContent(new StringSource("<value>TEST</value>"));
> inout.setInMessage(msg);
> send(inout);
>
> I was expecting that I could change the locationURI of the InOut but that
> is
> not working.
>
> Can you explain how I can change the URL that I am setting in the
> servicemix.xml ?
>
> Thanks
> Pat
> --
> View this message in context:
> http://www.nabble.com/passing-key-value-pairs-for-posting-into-HttpInvoker-t1786326.html#a4936024
> Sent from the ServiceMix - User forum at Nabble.com.
>
>
Re: passing key/value pairs for posting into HttpInvoker
Posted by apinke <ap...@gmail.com>.
Hi Guillaume ,
I too have this requirement but I am not able to understand how to apply
whats mentioned on
http://servicemix.goopen.org/site/uris.html.
I am currently creating messages like this :
InOut inout = createInOutExchange(new QName(Constants.MY_NAMESPACE,
Constants.HSERVICE), null, null);
inout.setProperty(Constants.PROPERTY_CORRELATIONID, id);
inout.setProperty("locationURI","http://localhost:8080/ServiceMixTest/MockServlet?KEY1=VALUE1");
//this did not work
NormalizedMessage msg = inout.createMessage();
msg.setContent(new StringSource("<value>TEST</value>"));
inout.setInMessage(msg);
send(inout);
I was expecting that I could change the locationURI of the InOut but that is
not working.
Can you explain how I can change the URL that I am setting in the
servicemix.xml ?
Thanks
Pat
--
View this message in context: http://www.nabble.com/passing-key-value-pairs-for-posting-into-HttpInvoker-t1786326.html#a4936024
Sent from the ServiceMix - User forum at Nabble.com.
Re: passing key/value pairs for posting into HttpInvoker
Posted by Guillaume Nodet <gn...@gmail.com>.
Take a look at http://servicemix.goopen.org/site/uris.html
The servicemix-http can handle dynamic endpoints, I think it should solve
your problem.
Cheers,
Guillaume Nodet
On 6/14/06, Andy Katz <ak...@tacpoint.com> wrote:
>
> Yes, I need only pass in different key/value pair(s). For example, the
> url
> defined in my servicemix.xml is -
>
> <property name="url" value="http://geocoder.us/service/rest"/>
>
> Now I need to pass in some form data, for example -
>
> address=1600+Pennsylvania+Ave,+Washington+DC
>
> Each request will have a different *address* value.
>
> Thank you.
>
> Andy
>
>
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Wednesday, June 14, 2006 7:06 AM
> To: servicemix-users@geronimo.apache.org
> Subject: Re: passing key/value pairs for posting into HttpInvoker
>
> Sorry, i' m a bit confused on what you need.
> Is the url which is invoked the same for all exchanges ?
>
> Cheers,
> Guillaume Nodet
>
> On 6/14/06, Andy Katz <ak...@tacpoint.com> wrote:
> >
> > Hi everyone -
> >
> >
> >
> > I'm trying to find an example of how I could pass data into the
> > HttpInvoker
> > component for posting to the XML defined "url" attribute.
> >
> >
> >
> > I'm trying to invoke a geo-coding service (same URL), but with different
> > *address* content on each message.
> >
> >
> >
> > Many thanks!
> >
> >
> >
> > Andy
> >
> >
> >
> >
> >
> >
> >
>
>
RE: passing key/value pairs for posting into HttpInvoker
Posted by Andy Katz <ak...@tacpoint.com>.
Yes, I need only pass in different key/value pair(s). For example, the url
defined in my servicemix.xml is -
<property name="url" value="http://geocoder.us/service/rest"/>
Now I need to pass in some form data, for example -
address=1600+Pennsylvania+Ave,+Washington+DC
Each request will have a different *address* value.
Thank you.
Andy
-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com]
Sent: Wednesday, June 14, 2006 7:06 AM
To: servicemix-users@geronimo.apache.org
Subject: Re: passing key/value pairs for posting into HttpInvoker
Sorry, i' m a bit confused on what you need.
Is the url which is invoked the same for all exchanges ?
Cheers,
Guillaume Nodet
On 6/14/06, Andy Katz <ak...@tacpoint.com> wrote:
>
> Hi everyone -
>
>
>
> I'm trying to find an example of how I could pass data into the
> HttpInvoker
> component for posting to the XML defined "url" attribute.
>
>
>
> I'm trying to invoke a geo-coding service (same URL), but with different
> *address* content on each message.
>
>
>
> Many thanks!
>
>
>
> Andy
>
>
>
>
>
>
>
Re: passing key/value pairs for posting into HttpInvoker
Posted by Guillaume Nodet <gn...@gmail.com>.
Sorry, i' m a bit confused on what you need.
Is the url which is invoked the same for all exchanges ?
Cheers,
Guillaume Nodet
On 6/14/06, Andy Katz <ak...@tacpoint.com> wrote:
>
> Hi everyone -
>
>
>
> I'm trying to find an example of how I could pass data into the
> HttpInvoker
> component for posting to the XML defined "url" attribute.
>
>
>
> I'm trying to invoke a geo-coding service (same URL), but with different
> *address* content on each message.
>
>
>
> Many thanks!
>
>
>
> Andy
>
>
>
>
>
>
>