|
I have a WSDL-first web service generated by the cxf-codegen-plugin's wsdl2java (and implemented). I have configured to use it within a spring beans.xml as such:
<cxf:cxfEndpoint xmlns:msv="http://company.com/infrastructure/services/hash" id="HashService-InVMBinding" wsdlURL="HashService.wsdl" serviceName="hsi:HashService" endpointName="hsi:HashServicePort"> <cxf:properties> <entry key="dataFormat" value="PAYLOAD"/> </cxf:properties> </cxf:cxfEndpoint> When I attempt to call this endpoint, I get an HTTP 401 error stating resource not found but I don't want it using any wire protocol. Is there anyway to get this cxf endpoint to make the call in-vm? Thanks ahead, Brian |
|
Correction...the msv is an hsi:
<cxf:cxfEndpoint xmlns:hsi="http://vediscovery.com/infrastructure/services/hash" id="HashService-InVMBinding" wsdlURL="HashService.wsdl" serviceName="hsi:HashService" endpointName="hsi:HashServicePort"> <cxf:properties> <entry key="dataFormat" value="PAYLOAD"/> </cxf:properties> </cxf:cxfEndpoint> |
|
I tried adding the serviceClass too (figured that was important):
<cxf:cxfEndpoint xmlns:hsi="http://company.com/infrastructure/services/hash" id="HashService-InVMBinding" wsdlURL="HashService.wsdl" serviceName="hsi:HashService" endpointName="hsi:HashServicePort" serviceClass="com.company.infrastructure.services.hash.HashServiceImpl"> <cxf:properties> <entry key="dataFormat" value="PAYLOAD"/> </cxf:properties> </cxf:cxfEndpoint> |
|
In reply to this post by objectorange
Sorry, I didn't catch your question...
Sent from a mobile device Am 03.08.2012 17:48 schrieb "objectorange" <[hidden email]>: > I have a WSDL-first web service generated by the cxf-codegen-plugin's > wsdl2java (and implemented). I have configured to use it within a spring > beans.xml as such: > > <cxf:cxfEndpoint > xmlns:msv="http://company.com/infrastructure/services/hash" > id="HashService-InVMBinding" > wsdlURL="HashService.wsdl" > serviceName="hsi:HashService" > endpointName="hsi:HashServicePort"> > <cxf:properties> > <entry key="dataFormat" value="PAYLOAD"/> > </cxf:properties> > </cxf:cxfEndpoint> > > When I attempt to call this endpoint, I get an HTTP 401 error stating > resource not found but I don't want it using any wire protocol. Is there > anyway to get this cxf endpoint to make the call in-vm? > > Thanks ahead, > Brian > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772.html > Sent from the Camel - Users mailing list archive at Nabble.com. > |
|
In reply to this post by objectorange
Hi,
It looks like you are not specify the address attribute in the cxfEndpoint element. -- Willem Jiang On Friday, August 3, 2012 at 11:48 PM, objectorange wrote: > I have a WSDL-first web service generated by the cxf-codegen-plugin's > wsdl2java (and implemented). I have configured to use it within a spring > beans.xml as such: > > <cxf:cxfEndpoint > xmlns:msv="http://company.com/infrastructure/services/hash" > id="HashService-InVMBinding" > wsdlURL="HashService.wsdl" > serviceName="hsi:HashService" > endpointName="hsi:HashServicePort"> > <cxf:properties> > <entry key="dataFormat" value="PAYLOAD"/> > </cxf:properties> > </cxf:cxfEndpoint> > > When I attempt to call this endpoint, I get an HTTP 401 error stating > resource not found but I don't want it using any wire protocol. Is there > anyway to get this cxf endpoint to make the call in-vm? > > Thanks ahead, > Brian > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772.html > Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com). > > |
|
Will this value for the address attribute work to invoke through the in-vm protocol?
local://company.com/app/services/HelloWorldService |
|
...or to keep with the flow of the example:
local://company.com/infrastructure/services/hash/HashService |
|
I get this error:
java.lang.IllegalStateException: Local destination does not have a MessageObserver on address local://company.com/infrastructure/services/hash/HashService Here is my beans.xml content: <cxf:cxfEndpoint xmlns:hsi="http://company.com/infrastructure/services/hash" id="HashServiceEndpoint" wsdlURL="HashService.wsdl" address="local://company.com/infrastructure/services/hash/HashService" serviceName="hsi:HashService" endpointName="hsi:HashServicePort" serviceClass="com.company.infrastructure.services.hash.HashServiceImpl"> <cxf:properties> <entry key="dataFormat" value="PAYLOAD"/> </cxf:properties> </cxf:cxfEndpoint> <camel:camelContext id="HashService"> <camel:route id="HashService-Route" trace="false"> <camel:from uri="vm:HashService" /> <camel:throttle timePeriodMillis="1000" id="HashService-Throttle"> <camel:constant>100</camel:constant> <camel:threads threadName="HashService-Thread" keepAliveTime="300" poolSize="20" maxPoolSize="40" maxQueueSize="40" rejectedPolicy="CallerRuns" id="HashService-ThreadPool"> <camel:to uri="cxf:bean:HashServiceEndpoint" id="HashServiceEndpoint-To"/> </camel:threads> </camel:throttle> </camel:route> </camel:camelContext> |
|
In reply to this post by objectorange
I didn't understand what you try to do.
I assume you want publish a web service via CXF. In this case, you can choose HTTP or JMS as wire protocol. There is no "in vm" protocol as far as I know. Camel support some "in vm" protocols (which are independent from CXF): direct seda vm direct-vm Best, Christian On Wed, Aug 8, 2012 at 8:55 PM, objectorange <[hidden email]> wrote: > Will this value for the address attribute work to invoke through the in-vm > protocol? > > local://company.com/app/services/HelloWorldService > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772p5717008.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- |
|
In reply to this post by objectorange
I don't suggest you to use the local transport, as you need to make sure the client and server are in the same JVM and they are sharing the same bus.
Did you have any chance to use the traditional http address ? -- Willem Jiang FuseSource Web: http://www.fusesource.com (http://www.fusesource.com/) Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: willemjiang On Thursday, August 9, 2012 at 3:47 AM, objectorange wrote: > I get this error: > > java.lang.IllegalStateException: Local destination does not have a > MessageObserver on address > local://company.com/infrastructure/services/hash/HashService (http://company.com/infrastructure/services/hash/HashService) > > Here is my beans.xml content: > > <cxf:cxfEndpoint xmlns:hsi="http://company.com/infrastructure/services/hash" > id="HashServiceEndpoint" > wsdlURL="HashService.wsdl" > > address="local://company.com/infrastructure/services/hash/HashService (http://company.com/infrastructure/services/hash/HashService)" > serviceName="hsi:HashService" > endpointName="hsi:HashServicePort" > > serviceClass="com.company.infrastructure.services.hash.HashServiceImpl"> > <cxf:properties> > <entry key="dataFormat" value="PAYLOAD"/> > </cxf:properties> > </cxf:cxfEndpoint> > > <camel:camelContext id="HashService"> > > <camel:route id="HashService-Route" trace="false"> > <camel:from uri="vm:HashService" /> > > <camel:throttle timePeriodMillis="1000" > id="HashService-Throttle"> > <camel:constant>100</camel:constant> > <camel:threads threadName="HashService-Thread" > keepAliveTime="300" > poolSize="20" > maxPoolSize="40" > maxQueueSize="40" > rejectedPolicy="CallerRuns" > id="HashService-ThreadPool"> > > <camel:to uri="cxf:bean:HashServiceEndpoint" > id="HashServiceEndpoint-To"/> > > </camel:threads> > </camel:throttle> > </camel:route> > > </camel:camelContext> > > > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772p5717011.html > Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com). |
|
In reply to this post by Christian Mueller
We need to leverage the CXF Camel transport[1] to connect the work of Camel supported "in vm" protocols.
[1]http://camel.apache.org/camel-transport-for-cxf.html -- Willem Jiang FuseSource Web: http://www.fusesource.com (http://www.fusesource.com/) Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: willemjiang On Thursday, August 9, 2012 at 6:05 AM, Christian Müller wrote: > I didn't understand what you try to do. > I assume you want publish a web service via CXF. In this case, you can > choose HTTP or JMS as wire protocol. There is no "in vm" protocol as far as > I know. > Camel support some "in vm" protocols (which are independent from CXF): > direct > seda > vm > direct-vm > > Best, > Christian > > On Wed, Aug 8, 2012 at 8:55 PM, objectorange <[hidden email] (mailto:[hidden email])> wrote: > > > Will this value for the address attribute work to invoke through the in-vm > > protocol? > > > > local://company.com/app/services/HelloWorldService (http://company.com/app/services/HelloWorldService) > > > > > > > > -- > > View this message in context: > > http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772p5717008.html > > Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com). > > > > > > -- |
|
I currently need for this service to be called only within the same vm.
|
|
In reply to this post by Willem.Jiang
Thanks William, but I don't see from that URL how to set up a local in-vm address. Here's CXF's URL (non-camel) on it: http://cxf.apache.org/docs/local-transport.html
I just don't see how to get that to work as a CXF Endpoint. I basically want to use the CXF framework with our services using Camel as a client without having to make an out-of-process call EVERY time. That's completely unnecessary overhead for what I'm working on. These services aren't being exposed to external wire protocols, they're just being 'wired' together as a service orchestration in-vm by Camel. Is there some other way to support calling an internal web service with Camel as the client without going over a wire-protocol? Am I completely missing something here? |
|
forgot to add...these cxf services need to be easily configured to be exposed by wire protocols in addition to the local address.
|
|
Have you considered using OSGi services instead?
In case you haven't heard of them, they are: 1) Simple POJOs which contain your business logic, 2) exposed inside your container (in-VM) for direct method-to-method invocations, 3) can be looked up dynamically in the OSGi Service Registry, 4) you can attach attributes to services to express metadata, 5) can search services by using LDAP-like filters, 6) eventually you can consider exposing them remotely via Distributed OSGi. Otherwise, if you decide to stick with the local CXF transport, this exception "java.lang.IllegalStateException: Local destination does not have a MessageObserver on address" seems to indicate that there's no service provider attached in the same VM to that address. This makes a lot of sense. Try to instantiate a CXF endpoint (service provider) on that address, either by using Spring or the CXF API. As Willem suggested, you need to instantiate it inside the same VM. But really, my tip is that you look in the OSGi services direction instead. Hope that helps, *Raúl Kripalani* *Principal Consultant | FuseSource Corp. [hidden email] | fusesource.com <http://www.fusesource.com/> skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>, @fusenews<http://twitter.com/fusenews> * blog: F3 - Flashes From the Field<http://blog.raulkr.net/?utm_source=fusesourceemail&utm_medium=email&utm_campaign=fusesourcemail> <http://twitter.com/fusenews> On 9 August 2012 14:06, objectorange <[hidden email]> wrote: > forgot to add...these cxf services need to be easily configured to be > exposed > by wire protocols in addition to the local address. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772p5717075.html > Sent from the Camel - Users mailing list archive at Nabble.com. > |
|
I looked into Camel:Bean but all of the examples show RPC-like method calls with String as the parameters. Does it support Object parameters? How would JAXB be used or would we have to parse incoming XML ourselves in the service implementation?
|
|
In reply to this post by Raul Kripalani-2
Thanks Raul, I have that working...and we can use CXF when we want to expose that class as a web service over HTTP and JMS. BTW, how do you get access to the instance of CamelContext when using the XPathBuilder described on this page: http://camel.apache.org/xpath.html
|
|
I ended up extending org.apache.camel.component.bean.BeanEndpoint then called getCamelContext().
|
|
In reply to this post by objectorange
Hi,
Yes, Camel supports any kind of object as message bodies. Your bean can declare any type of parameter in methods, including business DTOs, e.g.: public class CartHandler { public CartDTO createCartForOrder(OrderDTO order) { ... return cartDto; } } Then instantiate CartHandler in your Spring application context definition: <bean name="cartHandler" class="org.mycompany.CartHandler" /> You can then use "cartHandler" in your bean endpoint URI, e.g. <to uri="bean:cartHandler" />, or you could also use the bean DSL as shown in [1]. With either option, you can specify the method to invoke. If you happen to receive the DTO in a serialised format in your route (e.g. XML, JSON, etc.), you can use Data Formats to unmarshal it into an object, or implement custom logic to process it. Remember that Camel also has an automatic, transparent type conversion mechanism you could leverage [2]. IIRC, it is capable of applying JAXB transformations automatically. [1] http://camel.apache.org/bean-binding.html#BeanBinding-Parameterbindingusingmethodoption [2] http://camel.apache.org/type-converter.html Regards, *Raúl Kripalani* *Principal Consultant | FuseSource Corp. [hidden email] | fusesource.com <http://www.fusesource.com/> skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>, @fusenews<http://twitter.com/fusenews> * blog: F3 - Flashes From the Field<http://blog.raulkr.net/?utm_source=fusesourceemail&utm_medium=email&utm_campaign=fusesourcemail> | aboutme: http://about.me/raulkripalani <http://twitter.com/fusenews> On 9 August 2012 22:48, objectorange <[hidden email]> wrote: > I looked into Camel:Bean but all of the examples show RPC-like method calls > with String as the parameters. Does it support Object parameters? How would > JAXB be used or would we have to parse incoming XML ourselves in the > service > implementation? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772p5717098.html > Sent from the Camel - Users mailing list archive at Nabble.com. > |
| Powered by Nabble | Edit this page |
