Web service provider

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Web service provider

wänä
Hello,

I have a problem to figure out, how to call a web service provider (web service external to camel) from within a camel route:

  <camel:camelContext id="xyz-context">
    <camel:route>
      <camel:from uri="cxf:bean:get-file-list"/>
      <camel:interceptor ref="foo-service">
        <camel:interceptor ref="bar-service">
          <camel:to uri="<a href="http://a-host:a-port/a-path&quot;/&gt;">http://a-host:a-port/a-path"/>
        </camel:interceptor>
      </camel:interceptor>
    </camel:route>
  </camel:camelContext>

This gives me an error during startup:

No endpoint could be found for: <a href="http://a-host:a-port/a-path">http://a-host:a-port/a-path

I understand, that I didn't configure an endpoint at http://a-host:8080/a-path, but I have no idea how to do that.

The camel manual only shows how to directly use an http URL in the DSL way.

To give some context, the situation is as follows:
- A web service consumer into camel (camel should offer a wsdl interface), this works and is the cxf:bean thing above in the from element
- Some pojos massaging the content, which works also
- A web service provider, which needs to be adapted, which doesn't work for me at the moment

I first thought, I could use the cxf component to stand for the consumer and the provider (different wsdls), but this didn't work either, because as far as I understand, it only works as a consumer.

Any help is appreciated, possibly with concrete links or examples.

Thank you!

Best regards, Werner

Reply | Threaded
Open this post in threaded view
|

Re: Web service provider

Willem.Jiang
Administrator
Hi ,

Did you put the camel-http jar into your class path?
It looks like the camel context can resolve the http endpoint .

Willem
wänä wrote:

> Hello,
>
> I have a problem to figure out, how to call a web service provider (web
> service external to camel) from within a camel route:
>
>   <camel:camelContext id="xyz-context">
>     <camel:route>
>       <camel:from uri="cxf:bean:get-file-list"/>
>       <camel:interceptor ref="foo-service">
>         <camel:interceptor ref="bar-service">
>           <camel:to uri="<a href="http://a-host:a-port/a-path">http://a-host:a-port/a-path"/>
>         </camel:interceptor>
>       </camel:interceptor>
>     </camel:route>
>   </camel:camelContext>
>
> This gives me an error during startup:
>
> No endpoint could be found for: <a href="http://a-host:a-port/a-path">http://a-host:a-port/a-path
>
> I understand, that I didn't configure an endpoint at
> http://a-host:8080/a-path, but I have no idea how to do that.
>
> The camel manual only shows how to directly use an http URL in the DSL way.
>
> To give some context, the situation is as follows:
> - A web service consumer into camel (camel should offer a wsdl interface),
> this works and is the cxf:bean thing above in the from element
> - Some pojos massaging the content, which works also
> - A web service provider, which needs to be adapted, which doesn't work for
> me at the moment
>
> I first thought, I could use the cxf component to stand for the consumer and
> the provider (different wsdls), but this didn't work either, because as far
> as I understand, it only works as a consumer.
>
> Any help is appreciated, possibly with concrete links or examples.
>
> Thank you!
>
> Best regards, Werner
>
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Web service provider

wänä
Hello Willem,

thank you for that, at least the bus now starts. But then, I am still completely lost. Having received the message through CXF, it now arrives in the component which should prepare the SOAP call. I am able to change the element in the MessageContentsList, but from the error I receive now, and the things I see in the debugger, I am certain that this is not sufficient, because the stack trace tells me something like

java.lang.ClassCastException: providerpackage.ProviderRequestObject cannot be cast to consumerpackage.ConsumerRequestObject

I am perfectly ok with that, this is not possible, but I do not see why the request object for the provider should be cast into the request object from the consumer.

CXF Entry into Bus -> ConsumerRequestObject -> My transform -> ProviderRequestObject -> Http callout to external web service

I guess I am still far away from what I want to do. So a pointer to an example, where one either transforms an incoming web service request into an outgoing request, or where one builds a completely new web service request from scratch would help me a lot.

Thank you for any help!

Best regards, Werner

willem.jiang wrote
Hi ,

Did you put the camel-http jar into your class path?
It looks like the camel context can resolve the http endpoint .

Willem
wänä wrote:
> Hello,
>
> I have a problem to figure out, how to call a web service provider (web
> service external to camel) from within a camel route:
>
>   <camel:camelContext id="xyz-context">
>     <camel:route>
>       <camel:from uri="cxf:bean:get-file-list"/>
>       <camel:interceptor ref="foo-service">
>         <camel:interceptor ref="bar-service">
>           <camel:to uri="<a href="http://a-host:a-port/a-path&quot;/&gt;">http://a-host:a-port/a-path"/>
>         </camel:interceptor>
>       </camel:interceptor>
>     </camel:route>
>   </camel:camelContext>
>
> This gives me an error during startup:
>
> No endpoint could be found for: <a href="http://a-host:a-port/a-path">http://a-host:a-port/a-path
>
> I understand, that I didn't configure an endpoint at
> http://a-host:8080/a-path, but I have no idea how to do that.
>
> The camel manual only shows how to directly use an http URL in the DSL way.
>
> To give some context, the situation is as follows:
> - A web service consumer into camel (camel should offer a wsdl interface),
> this works and is the cxf:bean thing above in the from element
> - Some pojos massaging the content, which works also
> - A web service provider, which needs to be adapted, which doesn't work for
> me at the moment
>
> I first thought, I could use the cxf component to stand for the consumer and
> the provider (different wsdls), but this didn't work either, because as far
> as I understand, it only works as a consumer.
>
> Any help is appreciated, possibly with concrete links or examples.
>
> Thank you!
>
> Best regards, Werner
>
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: Web service provider

wänä
Hello all,

forget some conclusions from the previous mail. The class cast problem results from the retry operations plus my interactions. Still, the original request fails. I try to investigate this further and post my findings then.

Best regards, Werner

wänä wrote
Hello Willem,

thank you for that, at least the bus now starts. But then, I am still completely lost. Having received the message through CXF, it now arrives in the component which should prepare the SOAP call. I am able to change the element in the MessageContentsList, but from the error I receive now, and the things I see in the debugger, I am certain that this is not sufficient, because the stack trace tells me something like

java.lang.ClassCastException: providerpackage.ProviderRequestObject cannot be cast to consumerpackage.ConsumerRequestObject

I am perfectly ok with that, this is not possible, but I do not see why the request object for the provider should be cast into the request object from the consumer.

CXF Entry into Bus -> ConsumerRequestObject -> My transform -> ProviderRequestObject -> Http callout to external web service

I guess I am still far away from what I want to do. So a pointer to an example, where one either transforms an incoming web service request into an outgoing request, or where one builds a completely new web service request from scratch would help me a lot.

Thank you for any help!

Best regards, Werner

willem.jiang wrote
Hi ,

Did you put the camel-http jar into your class path?
It looks like the camel context can resolve the http endpoint .

Willem
wänä wrote:
> Hello,
>
> I have a problem to figure out, how to call a web service provider (web
> service external to camel) from within a camel route:
>
>   <camel:camelContext id="xyz-context">
>     <camel:route>
>       <camel:from uri="cxf:bean:get-file-list"/>
>       <camel:interceptor ref="foo-service">
>         <camel:interceptor ref="bar-service">
>           <camel:to uri="<a href="http://a-host:a-port/a-path&quot;/&gt;">http://a-host:a-port/a-path"/>
>         </camel:interceptor>
>       </camel:interceptor>
>     </camel:route>
>   </camel:camelContext>
>
> This gives me an error during startup:
>
> No endpoint could be found for: <a href="http://a-host:a-port/a-path">http://a-host:a-port/a-path
>
> I understand, that I didn't configure an endpoint at
> http://a-host:8080/a-path, but I have no idea how to do that.
>
> The camel manual only shows how to directly use an http URL in the DSL way.
>
> To give some context, the situation is as follows:
> - A web service consumer into camel (camel should offer a wsdl interface),
> this works and is the cxf:bean thing above in the from element
> - Some pojos massaging the content, which works also
> - A web service provider, which needs to be adapted, which doesn't work for
> me at the moment
>
> I first thought, I could use the cxf component to stand for the consumer and
> the provider (different wsdls), but this didn't work either, because as far
> as I understand, it only works as a consumer.
>
> Any help is appreciated, possibly with concrete links or examples.
>
> Thank you!
>
> Best regards, Werner
>
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: Web service provider

Willem.Jiang
Administrator
In reply to this post by wänä
Hi

My comments are in the mail.
wänä wrote:

> Hello Willem,
>
> thank you for that, at least the bus now starts. But then, I am still
> completely lost. Having received the message through CXF, it now arrives in
> the component which should prepare the SOAP call. I am able to change the
> element in the MessageContentsList, but from the error I receive now, and
> the things I see in the debugger, I am certain that this is not sufficient,
> because the stack trace tells me something like
>
> java.lang.ClassCastException: providerpackage.ProviderRequestObject cannot
> be cast to consumerpackage.ConsumerRequestObject
>  
Can you show me the transform code?
> I am perfectly ok with that, this is not possible, but I do not see why the
> request object for the provider should be cast into the request object from
> the consumer.
>
> CXF Entry into Bus -> ConsumerRequestObject -> My transform ->
> ProviderRequestObject -> Http callout to external web service
>  
If you want to turn a ProviderRequestObject into a Http request, you
need to use CxfProducer for marshaling ProviderRequestObject.
> I guess I am still far away from what I want to do. So a pointer to an
> example, where one either transforms an incoming web service request into an
> outgoing request, or where one builds a completely new web service request
> from scratch would help me a lot.
>  
CXFExample[1] shows how to turn a soap over http request into a soap
over jms request.
CxfProducerTest[2] is the test to show how to prepare the a new web
service request from scratch.

> Thank you for any help!
>
> Best regards, Werner
>
>  
[1] http://activemq.apache.org/camel/cxf-example.html
[2]
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java

Willem

> willem.jiang wrote:
>  
>> Hi ,
>>
>> Did you put the camel-http jar into your class path?
>> It looks like the camel context can resolve the http endpoint .
>>
>> Willem
>> wänä wrote:
>>    
>>> Hello,
>>>
>>> I have a problem to figure out, how to call a web service provider (web
>>> service external to camel) from within a camel route:
>>>
>>>   <camel:camelContext id="xyz-context">
>>>     <camel:route>
>>>       <camel:from uri="cxf:bean:get-file-list"/>
>>>       <camel:interceptor ref="foo-service">
>>>         <camel:interceptor ref="bar-service">
>>>           <camel:to uri="<a href="http://a-host:a-port/a-path">http://a-host:a-port/a-path"/>
>>>         </camel:interceptor>
>>>       </camel:interceptor>
>>>     </camel:route>
>>>   </camel:camelContext>
>>>
>>> This gives me an error during startup:
>>>
>>> No endpoint could be found for: <a href="http://a-host:a-port/a-path">http://a-host:a-port/a-path
>>>
>>> I understand, that I didn't configure an endpoint at
>>> http://a-host:8080/a-path, but I have no idea how to do that.
>>>
>>> The camel manual only shows how to directly use an http URL in the DSL
>>> way.
>>>
>>> To give some context, the situation is as follows:
>>> - A web service consumer into camel (camel should offer a wsdl
>>> interface),
>>> this works and is the cxf:bean thing above in the from element
>>> - Some pojos massaging the content, which works also
>>> - A web service provider, which needs to be adapted, which doesn't work
>>> for
>>> me at the moment
>>>
>>> I first thought, I could use the cxf component to stand for the consumer
>>> and
>>> the provider (different wsdls), but this didn't work either, because as
>>> far
>>> as I understand, it only works as a consumer.
>>>
>>> Any help is appreciated, possibly with concrete links or examples.
>>>
>>> Thank you!
>>>
>>> Best regards, Werner
>>>
>>>
>>>  
>>>      
>>
>>    
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Web service provider

wänä
Hello Willem,

there were basically two things wrong:
- missing camel-http in the classpath
- wrong Operation name set in the header

                result.setHeader(
                                CxfConstants.OPERATION_NAME,
                                "an-operation-name");
                result.setHeader(
                                CxfConstants.OPERATION_NAMESPACE,
                                "http://a-host/a-path");

The second error was really a problem of mine, shame on me.

Thank you for your help!

Best regards, Werner