Hi

SMX is more strict with setting the correct exchange pattern
- InOnly
- InOut
etc

We get this from the log
> Error processing exchange InOnly

So you should use InOut from Camel as its a http component that
expects an InOut exchange pattern

This is done by using the requestBody method instread of sendBody in
the producer template

So it should be:
producer.requestBody("jbi:service:http://com.amdocs.oxp/esb/LiavHelloImplSvcService";,
request);



On Mon, Jan 12, 2009 at 12:03 PM, Liav Ezer <liav.e...@gmail.com> wrote:
>
> Hi Claus,
>
> Ok, I progressed a bit but still has the a problem consuming my WS.
>
> Here is my Processor code (producer.sendBody() first arg' has changed).
>
> public void process(Exchange exchange) throws Exception {
>          ProducerTemplate producer =
> exchange.getContext().createProducerTemplate();
>          String payload = exchange.getIn().getBody(String.class); // == liav
>          String request = "<?xml version=\"1.0\"
> encoding=\"UTF-8\"?><soapenv:Body><sayHello><name>"+payload+"</name></sayHello></soapenv:Body>";
>          Object response =
> producer.sendBody("jbi:service:http://com.amdocs.oxp/esb/LiavHelloImplSvcService";,
> request);
> }
>
> This is the xbean of the SMX http Provider:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns:http="http://servicemix.apache.org/http/1.0";
>       xmlns:wsn="http://com.amdocs.oxp/esb";
>       xmlns="http://www.springframework.org/schema/beans";
>       xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance";
>       xsi:schemaLocation="http://servicemix.apache.org/http/1.0
> http://servicemix.apache.org/schema/servicemix-http-3.3.1.3-fuse.xsd
>       http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>
>           <http:endpoint service="wsn:LiavHelloImplSvcService"
>                 endpoint="wsn:LiavHelloImplSvc"
>                 role="provider"
>
> locationURI="http://localhost:8080/LiavHello2/services/LiavHelloImplSvc";
>
> wsdlResource="c:/HTTPReceiverServices/LiavHelloImplSvc.wsdl"
>                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
>                 soap="true" />
> </beans>
>
> My question:
>
> By looking at the end-point invoke (via the producerTemplate) & at the
> end-point config (xbean file),
>
> do you see a reason why my WS (LiavHelloImplSvcService) isn't consumed?
>
> Here is the current SMX log after deployment:
>
> ERROR - HttpComponent                  - Error processing exchange InOnly[
>  id: ID:10.236.11.194-11eca7dd5b2-2:8
>  status: Active
>  role: provider
>  service: {http://com.amdocs.oxp/esb}LiavHelloImplSvcService
>  endpoint: wsn:LiavHelloImplSvc
>  in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:q0="http://service.app.esb.oxp.amdocs.com"; xmlns:xsd="
> http://www.w3.org/2001/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Body><q0:sayHello><q0:name>LiavFromRouterBuilder</q0:name></q0:sayHello></soapenv:B
> ody></soapenv:Envelope>
> ]
> java.lang.Exception: Invalid status response: 500
> Thanks.
>
> Liav Ezer wrote:
>>
>> Hi Claus,
>>
>> What i managed to accomplish is that my producer is 'familiar' with my
>> Provider end-point but from some reason it doesn't invoke my service (WS)
>> & hence report an invalide status response (500).
>>
>> ERROR - HttpComponent                  - Error processing exchange InOnly[
>>   id: ID:10.236.11.194-11ec622522e-2:96
>>   status: Active
>>   role: provider
>>   service: {http://com.amdocs.oxp/esb}LiavHelloImplSvcService
>>   endpoint: wsn:LiavHelloImplSvc
>>   in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http
>> ://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><sayHello><name>Liav</name></sayHello></soapenv:Body></soapenv:Envelope>
>> ]
>>
>> This is my xbean.xml (it must be related to the end-point configuration):
>>
>> <http:endpoint service="wsn:LiavHelloImplSvcService"
>>                  endpoint="wsn:LiavHelloImplSvc"
>>                  role="provider"
>>
>> locationURI="http://localhost:8080/LiavHello2/services/LiavHelloImplSvc";
>>
>> wsdlResource="c:/HTTPReceiverServices/LiavHelloImplSvc.wsdl"
>>                  defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
>>                  soap="true" />
>>
>> Thanks.
>> java.lang.Exception: Invalid status response: 500
>>
>>
>>
>>
>>
>> Liav Ezer wrote:
>>>
>>> Hi Claus,
>>>
>>> I'm stuck with a problem that my servixmix is reporting a try to send a
>>> request to the provider but appearantly it's not able to consume the
>>> Provider's WS.
>>>
>>> Here is the console:
>>>
>>> ERROR - DeadLetterChannel              - Failed delivery for exchangeId:
>>> ID-LIAVE02/1441-1231673232762/0-2. On delivery attempt: 0 caught:
>>> org.apache.camel.RuntimeCamelException: o
>>> rg.apache.servicemix.camel.JbiException:
>>> javax.jbi.messaging.MessagingException: Could not find route for
>>> exchange: InOnly[
>>>   id: ID:10.236.11.194-11ec5713753-2:7
>>>   status: Active
>>>   role: provider
>>> in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
>>> xmlns:q0="http://service.app.esb.oxp.amdocs.com"; xmlns:xsd="
>>> http://www.w3.org/2001/XMLSchema";
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Body><q0:sayHello><q0:name>liav-name</q0:name>
>>> </q0:sayHello></soapenv:Body></soape
>>> nv:Envelope>
>>> ] for service: null and interface: null
>>>
>>> When i develpoed the WS i tested it via eclipse with success.
>>>
>>> Here is the xbean definition:
>>>
>>> <http:endpoint service="wsn:LiavHelloImplSvcService"
>>>                  endpoint="wsn:LiavHelloImplSvc"
>>>                  role="provider"
>>>
>>> locationURI="http://localhost:8080/LiavHello2/services/LiavHelloImplSvc";
>>>
>>> wsdlResource="c:/HTTPReceiverServices/LiavHelloImplSvc.wsdl"
>>>                  defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
>>>                  soap="true" />
>>>
>>> Why does it report null for the service & interface?
>>>
>>> Thanks.
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> On Sun, Jan 11, 2009 at 9:19 AM, Liav Ezer <liav.e...@gmail.com> wrote:
>>>>>
>>>>> Hi Claus,
>>>>>
>>>>> Yes, i changed the body (arg2 in the sendBody method) to be a SOAP
>>>>> request
>>>>> like the following:
>>>>>
>>>>> String request = "<soapenv:Envelope
>>>>> xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
>>>>> xmlns:q0='http://service.app.esb.oxp.liav.com'
>>>>> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
>>>>> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><soapenv:Body><q0:sayHello><q0:name>liav-name</q0:name>
>>>>> </q0:sayHello></soapenv:Body></soapenv:Envelope>";
>>>>>
>>>>> 1. Is it a correct payload to send a request?
>>>> Yeah it should be something like that. You might need the <?xml
>>>> version...> header. But try with and without it.
>>>>
>>>>
>>>>>
>>>>> 2. Does this method will return the provider response - The API shows
>>>>> that
>>>>> it returns an Object - should i cast it to be an 'Exchange' & extract
>>>>> the
>>>>> response from the provider?
>>>> When you use Camel's producer template to do a request/reply then
>>>> Camel will extract the response from the Exchange/IN or OUT/Message,
>>>> so you just get the payload. The type is Object but it can be what SMX
>>>> returns, so it could be some sort of XML holder such as
>>>> org.w3c.Document. But try and see what kind of Object you get back.
>>>>
>>>> There are type converters in Camel that can convert it back to a
>>>> String if you want to use that, or what else there is
>>>> http://activemq.apache.org/camel/type-converter.html
>>>>
>>>>
>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> On Sat, Jan 10, 2009 at 8:51 PM, Liav Ezer <liav.e...@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi Claus,
>>>>>>>
>>>>>>> I changed the notation as needed to:
>>>>>>>
>>>>>>> producer.sendBody("jbi:endpoint:http://localhost:8080/LiavHello/services/LiavHelloImpl";,
>>>>>>> "Netania");
>>>>>>>
>>>>>>>  SMX console now output some wierd error - googling it comes up with
>>>>>>> some
>>>>>>> xml parsing error:
>>>>>>>
>>>>>>> [Fatal Error] :1:1: Content is not allowed in prolog.DEBUG -
>>>>>>> DeliveryChannelImpl            - Exception processing:
>>>>>>> ID:10.236.11.194-11ec1f3a450-2:291 in
>>>>>>> DeliveryChannel{servicemix-camel}
>>>>>>> ERROR - DeadLetterChannel              - Failed delivery for
>>>>>>> exchangeId:
>>>>>>> ID-LIAVE02/4519-1231614935663/0-50. On delivery attempt: 0 caught:
>>>>>>> org.apache
>>>>>>> org.apache.servicemix.camel.JbiException:
>>>>>>> javax.jbi.messaging.MessagingException: Could not find route for
>>>>>>> exchange:
>>>>>>> InOnly[
>>>>>>>  id: ID:10.236.11.194-11ec1f3a450-2:291
>>>>>>>  status: Active
>>>>>>>  role: provider
>>>>>> Yeah when you send data to SMX you must remember that its expecting
>>>>>> the payload to be according to the JBI spec. in XML format. So you
>>>>>> should send the data as XML.
>>>>>>
>>>>>> "Content is not allowed in prolog" is a bit cryptical XML parser error
>>>>>> stating that it could not find the <?xml ... ?> declaration in top of
>>>>>> the content it was parsing.
>>>>>>
>>>>>> So you should send the payload as XML.
>>>>>>
>>>>>> BTW: Which version of SMX and Camel are you using? I think the missing
>>>>>> method from X mails back could be because we added it in Camel 1.4.0
>>>>>> (I think).
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Claus Ibsen-2 wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> This is the SMX Provider xbean:
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <beans xmlns:http="http://servicemix.apache.org/http/1.0";
>>>>>>>>        xmlns:wsn="http://com.amdocs.oxp/esb";
>>>>>>>>        xmlns="http://www.springframework.org/schema/beans";
>>>>>>>>        xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance";
>>>>>>>>        xsi:schemaLocation="http://servicemix.apache.org/http/1.0
>>>>>>>> http://servicemix.apache.org/schema/servicemix-http-3.3.1.3-fuse.xsd
>>>>>>>>        http://www.springframework.org/schema/beans
>>>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>>>>>>>>
>>>>>>>>                 <http:endpoint service="wsn:LiavHelloImplService"
>>>>>>>>                  endpoint="wsn:LiavHelloImpl"
>>>>>>>>                  role="provider"
>>>>>>>>
>>>>>>>> locationURI="http://localhost:8080/LiavHello/services/LiavHelloImpl";
>>>>>>>>
>>>>>>>> wsdlResource="c:/HTTPReceiverServices/LiavHelloImpl.wsdl"
>>>>>>>>                  defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
>>>>>>>>                  soap="true" />
>>>>>>>> </beans>
>>>>>>>> Any clue?
>>>>>>>> On Sat, Jan 10, 2009 at 4:17 PM, Liav Ezer <liav.e...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi Claus,
>>>>>>>>>
>>>>>>>>> Well i'll stick with the Http SMX provider end-point. I guess it's
>>>>>>>>> should
>>>>>>>>> integrate with camel routing with no problem.
>>>>>>>>>
>>>>>>>>> Ok what i did is the advise you gave me a few answers ago:
>>>>>>>>>
>>>>>>>>> ProducerTemplate producer =
>>>>>>>>> exchange.getContext().createProducerTemplate();
>>>>>>>>> Object response =
>>>>>>>>> producer.sendBody("http://localhost:8080/LiavHello/services/LiavHelloImpl";,
>>>>>>>>> "Daviv");
>>>>>>>> See below
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> And got this exception (SMX console after deply):
>>>>>>>>>
>>>>>>>>> : No endpoint could be found for:
>>>>>>>>> http://localhost:8080/LiavHello/services/LiavHelloImpl
>>>>>>>>> org.apache.camel.NoSuchEndpointException: No endpoint could be
>>>>>>>>> found
>>>>>>>>> for:
>>>>>>>>> http://localhost:8080/LiavHello/services/LiavHelloImpl
>>>>>>>>>
>>>>>>>>> LiavHelloImpl is the wsdlsoap:address location of the wsdl file
>>>>>>>>> representing
>>>>>>>>> the LiavHelloImp web project (under a running tomcat 6.0).
>>>>>>>>>
>>>>>>>>> Can you advise? It seems that the routing trying to be accomplished
>>>>>>>>> but
>>>>>>>>> something "configi" is messed up.
>>>>>>>>>
>>>>>>>>> Here is my provider xbean:
>>>>>>>>>
>>>>>>>>> <http:endpoint service="wsn:LiavHelloImplService"
>>>>>>>>>                 endpoint="wsn:LiavHelloImpl"
>>>>>>>>>                 role="provider"
>>>>>>>>>
>>>>>>>>> locationURI="http://localhost:8080/LiavHello/services/LiavHelloImpl";
>>>>>>>>>
>>>>>>>>> wsdlResource="c:/HTTPReceiverServices/LiavHelloImpl.wsdl"
>>>>>>>>>                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
>>>>>>>>>                 soap="true" />
>>>>>>>> When you want from Camel to call service on SMX then you must use
>>>>>>>> the
>>>>>>>> camel-jbi component that delegates to the SU in SMX.
>>>>>>>> So you need to add the jbi prefix in front.
>>>>>>>> See: http://activemq.apache.org/camel/jbi.html
>>>>>>>>
>>>>>>>> It should be something like this. By by all means I am not SMX
>>>>>>>> expert
>>>>>>>> (yet):
>>>>>>>> producer.sendBody("jbi:service:wsn:LiavHelloImplService", "Daviv");
>>>>>>>>
>>>>>>>> The jbi component have different notation so please check it out.
>>>>>>>>
>>>>>>>> If you manage to get it working, then please write back how to, so
>>>>>>>> we
>>>>>>>> can improve the documentation and help others in the future.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Claus Ibsen-2 wrote:
>>>>>>>>>>
>>>>>>>>>> On Sat, Jan 10, 2009 at 3:02 PM, Liav Ezer <liav.e...@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Hi Claus,
>>>>>>>>>>>
>>>>>>>>>>> I did follow this camel example & set up a timer 'from' end-point
>>>>>>>>>>> which
>>>>>>>>>>> my
>>>>>>>>>>> processor 'catched'.
>>>>>>>>>>>
>>>>>>>>>>> My will is to query this 'catched' data by sending it to a
>>>>>>>>>>> different
>>>>>>>>>>> end-point such as a service provider.
>>>>>>>>>>>
>>>>>>>>>>> Therefore, i deployed two SU's in my servicemix: One for the
>>>>>>>>>>> camel
>>>>>>>>>>> routing
>>>>>>>>>>> (timer example) & two is for
>>>>>>>>>>>
>>>>>>>>>>> the HTTP servicemix provider which i want to invoke in the
>>>>>>>>>>> proceesor.
>>>>>>>>>>>
>>>>>>>>>>> My question seems simple as long as an API exists for it:
>>>>>>>>>>>
>>>>>>>>>>> When my Processor class is instansiated than the process() method
>>>>>>>>>>> is
>>>>>>>>>>> invoked:
>>>>>>>>>>>
>>>>>>>>>>> public void process(Exchange exchange) throws Exception {
>>>>>>>>>>>
>>>>>>>>>>> The exchange.getIn() consist my 'from' end-point data (=the
>>>>>>>>>>> timer).
>>>>>>>>>>>
>>>>>>>>>>> I need the API to fetch the Http servicemix provider end-point &
>>>>>>>>>>> to
>>>>>>>>>>> send
>>>>>>>>>>> hime a request with this data.
>>>>>>>>>> If you want to send FROM Camel to SMX then you need to use the
>>>>>>>>>> camel-jbi component. That is you get endpoints FROM Camel starting
>>>>>>>>>> with the "jbi:" prefix. See camel-jbi component.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> One extra small question: Do i need to replace my provider SU
>>>>>>>>>>> with a
>>>>>>>>>>> camel
>>>>>>>>>>> http producer SU?
>>>>>>>>>> If you are using SMX 3.x then you dont as SMX has one SU for
>>>>>>>>>> Camel.
>>>>>>>>>> However if you need to use any of the other camel components from
>>>>>>>>>> SMX
>>>>>>>>>> you need to have them in the classpath as well, such as
>>>>>>>>>> camel-http.jar.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> (In SMX 4.x its all OSGi land and you need to install features
>>>>>>>>>> into
>>>>>>>>>> SMX.)
>>>>>>>>>>
>>>>>>>>>> A bit confused now. Which http provider do you want to use?
>>>>>>>>>> - SMX Http provider
>>>>>>>>>> - Camel http provider
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Thanks.
>>>>>>>>>>>
>>>>>>>>>>> Claus Ibsen-2 wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi
>>>>>>>>>>>>
>>>>>>>>>>>> Yeah its a bit mixed up since Camel and ServiceMix have classes
>>>>>>>>>>>> with
>>>>>>>>>>>> common name: Endpoint, Exchange etc.
>>>>>>>>>>>>
>>>>>>>>>>>> All the code I have shown assumes pure Camel code.
>>>>>>>>>>>>
>>>>>>>>>>>> I advice to check the ServceMix docu about using Camel in
>>>>>>>>>>>> ServiceMix.
>>>>>>>>>>>> And get a basic example running. Such as this example
>>>>>>>>>>>> http://servicemix.apache.org/camel-example.html
>>>>>>>>>>>>
>>>>>>>>>>>> You could use that as a starting point to get Camel invoking
>>>>>>>>>>>> your
>>>>>>>>>>>> HTTP
>>>>>>>>>>>> server. Just let the timer start it.
>>>>>>>>>>>> Then later your can connect using SMX instead of the camel
>>>>>>>>>>>> timer.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Sat, Jan 10, 2009 at 12:53 PM, Liav Ezer
>>>>>>>>>>>> <liav.e...@gmail.com>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Claus again,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I addition to what i asked in my previouse response here is a
>>>>>>>>>>>>> question
>>>>>>>>>>>>> regarding the producer snippet which you gave in your last
>>>>>>>>>>>>> answer:
>>>>>>>>>>>>>
>>>>>>>>>>>>> I indeed wrote the following in my process() method:
>>>>>>>>>>>>>
>>>>>>>>>>>>> ProducerTemplate producer =
>>>>>>>>>>>>>
>>>>>>>>>>>>> exchange.getCamelContext().createProducerTemplate();
>>>>>>>>>>>>>                            Object response =
>>>>>>>>>>>>>
>>>>>>>>>>>>> producer.sendBody("http://myserver.com/myapp?foo=bar";, "Liav
>>>>>>>>>>>>> Camel
>>>>>>>>>>>>> POC");
>>>>>>>>>>>>>
>>>>>>>>>>>>> but i don't have the camel context at hand (saying "The method
>>>>>>>>>>>>> getCamelContext() is undefined for the type Exchange").
>>>>>>>>>>>>>  & also do i need to deploy a camel http producer su instead of
>>>>>>>>>>>>> an
>>>>>>>>>>>>> http
>>>>>>>>>>>>> service mix provider?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Claus Ibsen-2 wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> When you are working with ServiceMix you must use the JBI
>>>>>>>>>>>>>> component
>>>>>>>>>>>>>> in
>>>>>>>>>>>>>> Camel
>>>>>>>>>>>>>> http://activemq.apache.org/camel/jbi.html
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> So your endpoints should starting with "jbi:XXXX"
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> And ServiceMix has some Camel docu here:
>>>>>>>>>>>>>> http://servicemix.apache.org/servicemix-camel.html
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Could you take a look at this docu a bit. There might be some
>>>>>>>>>>>>>> help
>>>>>>>>>>>>>> there.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Try to get something more easier working with SMX and Camel
>>>>>>>>>>>>>> and
>>>>>>>>>>>>>> then
>>>>>>>>>>>>>> later do the stuff you want with the dynamic add a camel
>>>>>>>>>>>>>> context.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sat, Jan 10, 2009 at 12:39 PM, Liav Ezer
>>>>>>>>>>>>>> <liav.e...@gmail.com>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi Claus,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I read your tutorial & learnt from it. Thanks. I adopted the
>>>>>>>>>>>>>>> cxf
>>>>>>>>>>>>>>> framework
>>>>>>>>>>>>>>> for now.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Regarding my project (as stated above in snippets):
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I planted the following camel routing logic at my processor
>>>>>>>>>>>>>>> class:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> process method - with camel:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> public void process(Exchange exchange) throws Exception {
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>  CamelContext camel = new DefaultCamelContext();
>>>>>>>>>>>>>>>  camel.start();
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>  Component component = (Component)
>>>>>>>>>>>>>>> camel.getComponent("http-provider-su");
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>  Endpoint endpoint = (Endpoint) ((org.apache.camel.Component)
>>>>>>>>>>>>>>> component).createEndpoint("provider:com.amdocs.oxp.esb");
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>  exchange.getIn().setBody("Liav testing here!");
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>  Producer producer = ((org.apache.camel.Endpoint)
>>>>>>>>>>>>>>> endpoint).createProducer();
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>  producer.start();
>>>>>>>>>>>>>>>  producer.process(exchange);
>>>>>>>>>>>>>>>  producer.stop();
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>  //System.out.println(exchange.getIn().toString() + "process
>>>>>>>>>>>>>>> activated
>>>>>>>>>>>>>>> by
>>>>>>>>>>>>>>> SU");
>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> And got the following exception while SA's jar was deployed:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ERROR - DeadLetterChannel              - Failed delivery for
>>>>>>>>>>>>>>> exchangeId:
>>>>>>>>>>>>>>> ID-LIAVE02/1885-1231586726193/0-0. On delivery attemp
>>>>>>>>>>>>>>> java.lang.NullPointerException
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.servicemix.tutorial.camel.MyProcessor.process(MyProcessor.java:33)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:92)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:66)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorT
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:75)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:146)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:90)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:91)
>>>>>>>>>>>>>>>        at
>>>>>>>>>>>>>>> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:48)
>>>>>>>>>>>>>>>        at java.util.TimerThread.mainLoop(Timer.java:512)
>>>>>>>>>>>>>>>        at java.util.TimerThread.run(Timer.java:462)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Be advise that line 33 is:Endpoint endpoint = (Endpoint)
>>>>>>>>>>>>>>> ((org.apache.camel.Component)
>>>>>>>>>>>>>>> component).createEndpoint("provider:com.amdocs.oxp.esb");
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> My questions:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 1. As bolded above i "fetched" my provider su component by
>>>>>>>>>>>>>>> staing
>>>>>>>>>>>>>>> it's
>>>>>>>>>>>>>>> name
>>>>>>>>>>>>>>> - is it correct?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 2. I used the following servicemix object (not camel's) since
>>>>>>>>>>>>>>> i
>>>>>>>>>>>>>>> work
>>>>>>>>>>>>>>> with
>>>>>>>>>>>>>>> servicemix provider endpoint. That's the reason for all the
>>>>>>>>>>>>>>> casting
>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>> my
>>>>>>>>>>>>>>> code:
>>>>>>>>>>>>>>> import org.apache.servicemix.jbi.deployment.Component;
>>>>>>>>>>>>>>> import org.apache.servicemix.jbi.framework.Endpoint;
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Is it correct?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thank again,
>>>>>>>>>>>>>>> Liav Ezer.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Claus Ibsen-2 wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> You can use the producer template to call an external http
>>>>>>>>>>>>>>>> server
>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>> get the response.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> See this tutorial:
>>>>>>>>>>>>>>>> http://activemq.apache.org/camel/tutorial-axis-camel.html
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> From the section - integrating Camel
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Its kinda the same but its just uses the producer template
>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>> save
>>>>>>>>>>>>>>>> a
>>>>>>>>>>>>>>>> file. Its the same API for using any of the camel
>>>>>>>>>>>>>>>> components.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Little sidenote:
>>>>>>>>>>>>>>>> And since you use InOut you should use: requestBody instread
>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>> sendBody. However Camel is not to stricky about this yet so
>>>>>>>>>>>>>>>> if
>>>>>>>>>>>>>>>> you
>>>>>>>>>>>>>>>> use
>>>>>>>>>>>>>>>> a send instead of request then it should work as well.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> The demo shows how to inject a producer template from spring
>>>>>>>>>>>>>>>> into
>>>>>>>>>>>>>>>> your
>>>>>>>>>>>>>>>> bean class = your processor. when you have this template you
>>>>>>>>>>>>>>>> can
>>>>>>>>>>>>>>>> call
>>>>>>>>>>>>>>>> the external http server and get the response using the
>>>>>>>>>>>>>>>> requestBody
>>>>>>>>>>>>>>>> method.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Thu, Jan 8, 2009 at 1:46 PM, Liav Ezer
>>>>>>>>>>>>>>>> <liav.e...@gmail.com>
>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Here is my camel-context:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>  <camelContext id="camel"
>>>>>>>>>>>>>>>>> xmlns="http://activemq.apache.org/camel/schema/spring";>
>>>>>>>>>>>>>>>>>    <package>org.apache.servicemix.tutorial.camel</package>
>>>>>>>>>>>>>>>>>  </camelContext>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>  <bean id="myProcessor"
>>>>>>>>>>>>>>>>> class="org.apache.servicemix.tutorial.camel.MyProcessor"/>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Here is my RouteBuilder java file:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> public class MyRouteBuilder extends RouteBuilder {
>>>>>>>>>>>>>>>>>        public void configure() {
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> from("timer://tutorial?fixedRate=true&delay=3000&period=10000")
>>>>>>>>>>>>>>>>>                .setBody(constant(".....................Liav
>>>>>>>>>>>>>>>>> Camel
>>>>>>>>>>>>>>>>> POC......................."))
>>>>>>>>>>>>>>>>>                        .to("myProcessor");
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    }
>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Here is my processor java file:
>>>>>>>>>>>>>>>>> public class MyProcessor implements Processor {
>>>>>>>>>>>>>>>>>          public void process(Exchange exchange) throws
>>>>>>>>>>>>>>>>> Exception
>>>>>>>>>>>>>>>>> {
>>>>>>>>>>>>>>>>>              //WANT TO INITIATE A CALL TO http pROVIDER END
>>>>>>>>>>>>>>>>> POINT
>>>>>>>>>>>>>>>>> &
>>>>>>>>>>>>>>>>> PASS
>>>>>>>>>>>>>>>>> THE
>>>>>>>>>>>>>>>>> 'FROM'
>>>>>>>>>>>>>>>>>                  // PARAMETRS RECIEVED PROIRE TO THE
>>>>>>>>>>>>>>>>> PROCESSOR
>>>>>>>>>>>>>>>>> INVOKE.
>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>>>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21351142.html
>>>>>>>>>>>>>>>>> Sent from the Camel - Users mailing list archive at
>>>>>>>>>>>>>>>>> Nabble.com.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> /Claus Ibsen
>>>>>>>>>>>>>>>> Apache Camel Committer
>>>>>>>>>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21387207.html
>>>>>>>>>>>>>>> Sent from the Camel - Users mailing list archive at
>>>>>>>>>>>>>>> Nabble.com.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> /Claus Ibsen
>>>>>>>>>>>>>> Apache Camel Committer
>>>>>>>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21387318.html
>>>>>>>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> /Claus Ibsen
>>>>>>>>>>>> Apache Camel Committer
>>>>>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> View this message in context:
>>>>>>>>>>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21388391.html
>>>>>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> /Claus Ibsen
>>>>>>>>>> Apache Camel Committer
>>>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21389069.html
>>>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> /Claus Ibsen
>>>>>>>> Apache Camel Committer
>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21390941.html
>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> /Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21396985.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> /Claus Ibsen
>>>> Apache Camel Committer
>>>> Blog: http://davsclaus.blogspot.com/
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21412377.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Reply via email to