Re: How to include additional data to soap header (WSSE,WSA) with camel-cxf
http://camel.apache.org/cxf.html#CXF-HowtogetandsetSOAPheadersinPOJOmode, possibly http://camel.apache.org/cxf.html#CXF-HowtogetandsetSOAPheadersinPAYLOADmode should help you. Glen On 02/13/2012 07:32 AM, Filippo Balicchia wrote: Hello i need to includewsa:Action header in my soap request with camel-cxf I have route like this from(timer://foo?fixedRate=trueperiod=1).process(new Processor() { @Override public void process(Exchange exchange) throws Exception { InputReportIncident newIncident = new InputReportIncident(); newIncident.setFamilyName(ciao); newIncident.setGivenName(mondo); newIncident.setEmail(myem...@gmail.com); newIncident.setSummary(first test); newIncident.setIncidentId(45677); newIncident.setIncidentDate(2011-03-05); newIncident.setDetails(detaild); newIncident.setPhone(0049 69 1234567); exchange.getOut().setBody(newIncident); } }).to(cxf:bean:reportIncident).convertBodyTo(OutputReportIncident.class) where in my spring file the configuration is link this cxf:cxfEndpoint id=reportIncident address=http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident; wsdlURL=META-INF/wsdl/report_incident.wsdl serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint /cxf:cxfEndpoint Could you tell me please if possible and how to to add that header in declarative manner or in programmatic manner Thanks for help --Filippo -- Glen Mazza Talend Community Coders - coders.talend.com blog: www.jroller.com/gmazza
Re: error executing mvn exec:java
Which sample are you talking about (can you provide a URL)? Glen On 02/07/2012 12:41 PM, Samruben wrote: Hi, I am new user to apache camel. I am very much interested to learn it. I just treied to implement the walk through sample(first example) using java dsl. Bu when i execute mvn exec:java I am getting this error. [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default-cli) on project camel-example-jms-file: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java are missing or invalid - [Help 1] Kindly give me a solution to solve it. It will very helpful to proceed -- View this message in context: http://camel.465427.n5.nabble.com/error-executing-mvn-exec-java-tp5463930p5463930.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Glen Mazza Talend Community Coders - coders.talend.com blog: www.jroller.com/gmazza
Re: Blueprint bundle + plain Main class from the same project?
(XMLSchemaValidator.java:3182) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1927) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) ... 23 more -- Glen Mazza Talend Community Coders http://coders.talend.com blog: http://www.jroller.com/gmazza
Re: Spring AMQP Apache Camel Component Released
Hi, your GitHub intro for this component says: An Apache Camel http://camel.apache.org/ Component that will natively communicate with a RabbitMQ http://www.rabbitmq.com/ broker. This is implemented using Spring's AMQP project, so it should ultimately become vendor-agnostic. I guess you mean *broker*-agnostic, i.e., it should be able to work with the Qpid broker if you're not using native RabbitMQ features. Is there anything preventing it from working now with the Qpid broker, or you just haven't had time to test it yet? Also, what do you mean by ...instead of a JMS-AMQP interface via Qpid When you say Qpid I guess you mean Camel's AMQP component (http://camel.apache.org/amqp.html) which uses the Qpid client libraries. Is there something suboptimal with using Qpid's client library to implement an AMQP client (i.e., it's doing a strange JMS-AMQP mapping instead of pure AMQP) or it's just that you can't take advantage of any native RabbitMQ features when using it? Thanks, Glen On 11/28/2011 12:03 AM, deckerego wrote: For those who might be interested, I've posted a Camel component based on Spring AMQP for those who wish to use more AMQP semantics instead of a JMS-AMQP interface via Qpid. Source is now available at https://github.com/Bluelock/camel-spring-amqp While the Qpid component is great for those who might be migrating from JMS to AMQP, a few on the list have suggested that they were interested in having more direct access to native RabbitMQ features, leveraging header exchanges, etc. This camel-spring-amqp component was created to expose RabbitMQ features natively within a Camel endpoint but still provide a path towards a vendor-independent implementation. After receiving feedback from the Camel team I decided to implement the component using Spring AMQP. Since Spring AMQP performs JSON marshalling with Jackson, I've also included an XStream marshaller with this component so that messages can be formatted using the XStream JSON libraries prior to being sent over the wire. You could of course do the same thing with the Camel dataFormat filters as well, but this offers another way to do object wire marshalling within the Spring AMQP framework. I'm open to any feedback, testing or pull requests for camel-spring-amqp. If you find the URI format to be a bit odd let me know - I'm open to new ideas on how to better format the endpoint string. Thanks! -- View this message in context: http://camel.465427.n5.nabble.com/Spring-AMQP-Apache-Camel-Component-Released-tp5027785p5027785.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Glen Mazza Talend Community Coders http://coders.talend.com blog: http://www.jroller.com/gmazza
Re: Basic cxf-tomcat-example.html: need explaination. 1M Thanks.
Hi, for a CXF-only web service hosted on Tomcat (sans Camel), Note #2 here: http://www.jroller.com/gmazza/entry/web_service_tutorial#notes shows how the URL is constructed. With Camel, (A), (B), and (C) are the same, but for (D), one of the links that you gave (http://camel.apache.org/cxf-tomcat-example.html) has this text: All we have to do is to define an endpoint uri in the format cxf:/incident?serviceClass=org.apache.camel.example.cxf.incident.IncidentService This means Camel will expose the web service using the relative address /incident... So if you look in CamelRoute.java, that from(uri) statement is what causes /incident to be used as part of the URL string. ?wsdl is the JAX-WS default, the URL to access to obtain a WSDL from the web service provider. HTH, Glen On 11/06/2011 12:26 PM, H Paul wrote: In this example http://camel.apache.org/cxf-tomcat-example.html http://camel.apache.org/cxf-tomcat-example.html No problem with web.xml No problem with CamelRoute.java Not sure How thing tie together? camel-config.xml and http://localhost:8080/camel-example-cxf-tomcat-2.8.1/webservices/incident?wsdl how incident (incident?wsdl) come into the picture? (some thing is implicit that I can not see or read properly) (I can see the tie in the Apache CXF web service without using Camel) -- View this message in context: http://camel.465427.n5.nabble.com/Basic-cxf-tomcat-example-html-need-explaination-1M-Thanks-tp4969057p4969057.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza/ Twitter - glenmazza
Re: Questions on Camel camel-example-cxf-osgi sample
I reinstalled Karaf, switched to Equinox, example works fine now. I submitted a patch to this example's README that was applied by Willem. Thanks, Glen On 11/03/2011 02:23 PM, Daniel Kulp wrote: On Thursday, November 03, 2011 2:03:15 PM Glen Mazza wrote: Hi all, two questions: 1.) Line #51 of the camel-example-cxf-osgi sample's README[1] hosts a CXF web service at the following URL: http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl However, the default string for OOTB Karaf would have services instead of CXF: http://localhost:8181/services/camel-example-cxf-osgi/webservices/incident http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl I have a patch to update the README and can have the URL changed to services but was wondering where cxf came from--is that the default string if it is hosted on ServiceMix (only Karaf uses services by default?), or does ServiceMix use services too by default? Then we can switch the README to have them use services instead so no special container configuration would be needed. /cxf is the default for CXF and is likely the right URL. It sounds like you have a kind of mixed up OSGi container thing. Likely you are trying to use something like CXF 2.4.3 with Felix (which has some issues that will be fixed in 2.4.4, use Equinox) or possibly using some karaf configs from Talend products. Definitely retry with a more vanilla install of Karaf.You can follow instructions from my blog: http://www.dankulp.com/blog/?p=352 to get Camel/CXF setup and try that. I just gave that a try with that example and it seemed to show up fine at : http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl Dan 2.) I cannot get this sample to work using either cxf or services above in the URL string. Karaf log error message is: Can't find the the request for http://localhost:8181/services/camel-example-cxf-osgi/webservices/incident's Observer which may mean CXF configuration isn't being properly detected. Line #32 of the Spring camel-context.xml configuration here: *http://tinyurl.com/3bumwtx* seems suspect: * *address=/camel-example-cxf-osgi/webservices/incident Shouldn't it be the entire address, like so: address=http://localhost:8181/services/camel-example-cxf-osgi/webservices/i ncident http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsd l (although that didn't seem to work for me either, same error!) The address value of the camel-context.xml for *test* cases has the full URL as above. Thanks, Glen [1] http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf-osgi/REA DME.txt?annotate=1147432 -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza/ Twitter - glenmazza
Questions on Camel camel-example-cxf-osgi sample
Hi all, two questions: 1.) Line #51 of the camel-example-cxf-osgi sample's README[1] hosts a CXF web service at the following URL: http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl However, the default string for OOTB Karaf would have services instead of CXF: http://localhost:8181/services/camel-example-cxf-osgi/webservices/incident http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl I have a patch to update the README and can have the URL changed to services but was wondering where cxf came from--is that the default string if it is hosted on ServiceMix (only Karaf uses services by default?), or does ServiceMix use services too by default? Then we can switch the README to have them use services instead so no special container configuration would be needed. 2.) I cannot get this sample to work using either cxf or services above in the URL string. Karaf log error message is: Can't find the the request for http://localhost:8181/services/camel-example-cxf-osgi/webservices/incident's Observer which may mean CXF configuration isn't being properly detected. Line #32 of the Spring camel-context.xml configuration here: *http://tinyurl.com/3bumwtx* seems suspect: * *address=/camel-example-cxf-osgi/webservices/incident Shouldn't it be the entire address, like so: address=http://localhost:8181/services/camel-example-cxf-osgi/webservices/incident http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl (although that didn't seem to work for me either, same error!) The address value of the camel-context.xml for *test* cases has the full URL as above. Thanks, Glen [1] http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf-osgi/README.txt?annotate=1147432 -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza/ Twitter - glenmazza
Re: Problem running camel-example-cxf-osgi
Thanks--that worked--sort of. Making your recommended changes now reports the following error when I do features:install camel-cxf: karaf@root features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.8.2/xml/fe atures karaf@root features:install war karaf@root features:install camel-spring karaf@root features:install camel-jaxb karaf@root features:install camel-cxf Refreshing bundles org.springframework.context (84), org.springframework.context.support (85), org.apache.camel.camel-core (97), org.apache.servicemix.bundles.jaxb-impl (95) ERROR: Bundle org.springframework.osgi.extender [89] Error stopping bundle. (java.lang.NoClassDefFoundError: org/osgi/framework/ServiceRegistration) java.lang.NoClassDefFoundError: org/osgi/framework/ServiceRegistration at org.springframework.osgi.util.OsgiServiceUtils.unregisterService(OsgiServiceUtils.java:41) at org.springframework.osgi.extender.internal.support.NamespaceManager.unregisterResolverService(NamespaceManager.java:195) at org.springframework.osgi.extender.internal.support.NamespaceManager.destroy(NamespaceManager.java:223) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.shutdown(ContextLoaderListener.java:547) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.stop(ContextLoaderListener.java:431) at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:651) at org.apache.felix.framework.Felix.stopBundle(Felix.java:2216) at org.apache.felix.framework.Felix$RefreshHelper.stop(Felix.java:4489) at org.apache.felix.framework.Felix.refreshPackages(Felix.java:3581) at org.apache.felix.framework.PackageAdminImpl.run(PackageAdminImpl.java:363) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.ClassNotFoundException: org.osgi.framework.ServiceRegistration not found by org.springframework.osgi.core [88] at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787) at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71) at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 11 more Any more ideas? Glen On 10/30/2011 09:53 PM, Daniel Kulp wrote: The README.txt needs updating. You need to edit the jre.properties and comment out a bunch of the javax.* things that are provided by the bundles. That would include javax.xml.bind*, javax.jws*, javax.xml.soap*, javax.xml.ws*, I think javax.mail, javax.activation. Dan On Sunday, October 30, 2011 7:10:21 PM Glen Mazza wrote: Hello, I'm trying to run the Camel 2.8.2 sample camel-example-cxf-osgi on Apache Karaf 2.2.4. Following these instructions: https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf-osgi /README.txt, I'm able to run the first four of these five commands with no problem: features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.8.2/xml/features features:install war features:install camel-spring features:install camel-jaxb features:install camel-cxf The last command above, however, reports this error: karaf@root features:install camel-cxf Error executing command: Could not start bundle mvn:org.apache.camel/camel-cxf-transport/2.8.2 in feature(s) camel-cxf-2.8.2: Unable to resolve module org.apache.cxf.bundle [137.0] because it is exposed to package 'javax.xml.bind.attachment' from org.apache.felix.framework [0] and org.apache.servicemix.specs.jaxb-api-2.2 [53.0] via two dependency chains. Chain 1: org.apache.cxf.bundle [137.0] import: (package=javax.xml.bind.attachment) export: package=javax.xml.bind.attachment org.apache.felix.framework [0] Chain 2: org.apache.cxf.bundle [137.0] import: (package=com.sun.tools.xjc.reader.xmlschema.parser) export: package=com.sun.tools.xjc.reader.xmlschema.parser; uses:=javax.xml.bind org.apache.servicemix.bundles.jaxb-xjc [58.0] import: ((package=javax.xml.bind)(version=2.2.0)(!(version=3.0.0))) export: package=javax.xml.bind; uses:=javax.xml.bind.attachment export: package=javax.xml.bind.attachment org.apache.servicemix.specs.jaxb-api-2.2 [53.0] Any idea what the solution would be? Thanks, Glen -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza/ Twitter - glenmazza
Problem running camel-example-cxf-osgi
Hello, I'm trying to run the Camel 2.8.2 sample camel-example-cxf-osgi on Apache Karaf 2.2.4. Following these instructions: https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf-osgi/README.txt, I'm able to run the first four of these five commands with no problem: features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.8.2/xml/features features:install war features:install camel-spring features:install camel-jaxb features:install camel-cxf The last command above, however, reports this error: karaf@root features:install camel-cxf Error executing command: Could not start bundle mvn:org.apache.camel/camel-cxf-transport/2.8.2 in feature(s) camel-cxf-2.8.2: Unable to resolve module org.apache.cxf.bundle [137.0] because it is exposed to package 'javax.xml.bind.attachment' from org.apache.felix.framework [0] and org.apache.servicemix.specs.jaxb-api-2.2 [53.0] via two dependency chains. Chain 1: org.apache.cxf.bundle [137.0] import: (package=javax.xml.bind.attachment) | export: package=javax.xml.bind.attachment org.apache.felix.framework [0] Chain 2: org.apache.cxf.bundle [137.0] import: (package=com.sun.tools.xjc.reader.xmlschema.parser) | export: package=com.sun.tools.xjc.reader.xmlschema.parser; uses:=javax.xml.bind org.apache.servicemix.bundles.jaxb-xjc [58.0] import: ((package=javax.xml.bind)(version=2.2.0)(!(version=3.0.0))) | export: package=javax.xml.bind; uses:=javax.xml.bind.attachment export: package=javax.xml.bind.attachment org.apache.servicemix.specs.jaxb-api-2.2 [53.0] Any idea what the solution would be? Thanks, Glen -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza/ Twitter - glenmazza
Re: Configuring cxfEndpoint to make secure (HTTPS) : need help
Looking here[1] in a CXF example its httpj:engine port value is 9001, while you have yours set to 0 (see arrows below). Could that be the problem? Glen [1] http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first_https/src/main/java/demo/hw_https/server/CherryServer.xml?revision=1173027view=markup On 10/07/2011 07:02 AM, amarnath.chavva wrote: Hi every one, Am using cxfEndpoint to expose my services as web services, now I would like make this as secure by marking those HTTPS. the following is my spring context file, cxf:cxfEndpoint id=httpEndpoint address=https://0.0.0.0:9001/MyService; serviceClass=com.mycompany.WebServiceInerface endpointName=httpttrans:httptransferServiceEndpoint serviceName=httpttrans:httptransferService xmlns:httpttrans=https://httptransfer.mycompany.com/; /cxf:cxfEndpoint httpj:engine-factory bus=cxf httpj:identifiedTLSServerParameters id=secure httpj:tlsServerParameters sec:keyManagers keyPassword=password sec:keyStore type=JKS password=password file=server.jks / /sec:keyManagers sec:trustManagers sec:keyStore type=JKS password=password file=truststore.jks / /sec:trustManagers /httpj:tlsServerParameters /httpj:identifiedTLSServerParameters httpj:engine port=0- httpj:tlsServerParametersRef id=secure / httpj:threadingParameters minThreads=5 maxThreads=10 / httpj:connector beans:bean class=org.mortbay.jetty.bio.SocketConnector beans:property name=port value=9001 / /beans:bean /httpj:connector httpj:handlers beans:bean class=org.mortbay.jetty.handler.DefaultHandler / /httpj:handlers httpj:sessionSupporttrue/httpj:sessionSupport /httpj:engine /httpj:engine-factory When trying to run as server to publish my serivices, the following error is observed. Protocol mismatch for port 9001: engine's protocol is http, the url protocol is https Please guide me to resolve this issue ASAP. Regards, Chavva. -- View this message in context: http://camel.465427.n5.nabble.com/Configuring-cxfEndpoint-to-make-secure-HTTPS-need-help-tp4879695p4879695.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza Twitter - glenmazza
Re: Using the SOAP DataFormat with JMS queues
It is only a SOAP call if a web service is listening on that queue, correct? And if no web service is listening there, then it's just a simple matter of an XML message (that just happens to be a SOAP call) being sent to the queue, correct again? OK, I'll update the SOAP page (or you may do so) later on today. Thanks, Glen Christian Schneider wrote: Hi Glen, at my employer we are hosting the complete web services using jms instead of http. So if you have a webservice listening on the jms queue you can make soap calls using the soap dataformat. CXF also provides SOAP / JMS. We even have services running on tibco business works that can be directly called on jms. If your service method is one way then the simple route below will implement a complete sop call. For request reply you of course need the more complicated route shown in the other examples of the soap dataformat. Regards Christian Am 09.09.2010 02:54, schrieb Glen Mazza: Hello, another question on the SOAP DataFormat text. In the Using the Java DSL section[1], the example given is as follows: SoapJaxbDataFormat soap = new SoapJaxbDataFormat(com.example.customerservice,new ServiceInterfaceStrategy(CustomerService.class)); from(direct:start) .marshal(soap) .to(jms:myQueue); I'm not sure what the above route is doing. Is it: 1.) Making a SOAP over JMS call (i.e., jms:myQueue will need to be a web service provider that will return a response) or 2.) Just marshalling the Java object holding the SOAP call data into an XML SOAP Envelope and placing the latter on a queue (for perhaps a later feed to the actual web service call, but it does not have to be). Thanks, Glen [1] https://cwiki.apache.org/confluence/display/CAMEL/SOAP#SOAP-UsingtheJavaDSL
Re: Using the SOAP DataFormat with JMS queues
I reworded it--see if you find it acceptable. We may need to compromise with you giving your interpretation in German and me giving mine in English. :) As for you could also say that sending a message that contains soap content is a one way soap call even if no one listens for it, no, I wouldn't say you could say that. Placing an XML message on a queue is not a SOAP call, it has to be listened to by a web service provider for that to be a SOAP call. Further: As the call is asnychronous the caller will not know if anyone listens to the call anyway, true, but I don't think that's the point, one-way SOAP calls are still intended to be processed. When I first read the SOAP DataFormat, I thought it made actual SOAP calls, perhaps just using the JAX-WS RI instead of CXF. Then I realized it just creates SOAP messages, it's really an enhanced version of the JAXB DataFormat. To limit confusion, I think it would be good to disabuse the reader early on of the notion that it is making SOAP calls. Glen Christian Schneider wrote: Hi Glen, you can see it this way. On the other hand you could also say that sending a message that contains soap content is a one way soap call even if no one listens for it. As the call is asnychronous the caller will not know if anyone listens to the call anyway ;-) Regards Christian Am 09.09.2010 09:46, schrieb Glen Mazza: It is only a SOAP call if a web service is listening on that queue, correct? And if no web service is listening there, then it's just a simple matter of an XML message (that just happens to be a SOAP call) being sent to the queue, correct again? OK, I'll update the SOAP page (or you may do so) later on today. Thanks, Glen Christian Schneider wrote: Hi Glen, at my employer we are hosting the complete web services using jms instead of http. So if you have a webservice listening on the jms queue you can make soap calls using the soap dataformat. CXF also provides SOAP / JMS. We even have services running on tibco business works that can be directly called on jms. If your service method is one way then the simple route below will implement a complete sop call. For request reply you of course need the more complicated route shown in the other examples of the soap dataformat. Regards Christian Am 09.09.2010 02:54, schrieb Glen Mazza: Hello, another question on the SOAP DataFormat text. In the Using the Java DSL section[1], the example given is as follows: SoapJaxbDataFormat soap = new SoapJaxbDataFormat(com.example.customerservice,new ServiceInterfaceStrategy(CustomerService.class)); from(direct:start) .marshal(soap) .to(jms:myQueue); I'm not sure what the above route is doing. Is it: 1.) Making a SOAP over JMS call (i.e., jms:myQueue will need to be a web service provider that will return a response) or 2.) Just marshalling the Java object holding the SOAP call data into an XML SOAP Envelope and placing the latter on a queue (for perhaps a later feed to the actual web service call, but it does not have to be). Thanks, Glen [1] https://cwiki.apache.org/confluence/display/CAMEL/SOAP#SOAP-UsingtheJavaDSL
Questions on the SOAP DataFormat
Hi, I have a couple of questions on the SOAP DataFormat[1]: 1.) The documentation says this DataFormat provides the basic features of Apache CXF without need for the CXF Stack. Does that mean it internally uses the JAX-WS Reference Implementation which is in the JDK by default? 2.) The section on the Webservice Client[2] shows a code snippet on making a SOAP call and also a potential route for doing the same. Are *both* simultaneously needed to make the SOAP call, or just one or the other will do? I think you need both, but just wish to confirm. Thanks, Glen [1] https://cwiki.apache.org/confluence/display/CAMEL/SOAP [2] https://cwiki.apache.org/confluence/display/CAMEL/SOAP#SOAP-Webserviceclient
Using the SOAP DataFormat with JMS queues
Hello, another question on the SOAP DataFormat text. In the Using the Java DSL section[1], the example given is as follows: SoapJaxbDataFormat soap = new SoapJaxbDataFormat(com.example.customerservice, new ServiceInterfaceStrategy(CustomerService.class)); from(direct:start) .marshal(soap) .to(jms:myQueue); I'm not sure what the above route is doing. Is it: 1.) Making a SOAP over JMS call (i.e., jms:myQueue will need to be a web service provider that will return a response) or 2.) Just marshalling the Java object holding the SOAP call data into an XML SOAP Envelope and placing the latter on a queue (for perhaps a later feed to the actual web service call, but it does not have to be). Thanks, Glen [1] https://cwiki.apache.org/confluence/display/CAMEL/SOAP#SOAP-UsingtheJavaDSL
Re: Questions on the SOAP DataFormat
I updated the docs, thanks. Willem Jiang wrote: On 9/9/10 8:00 AM, Glen Mazza wrote: Hi, I have a couple of questions on the SOAP DataFormat[1]: 1.) The documentation says this DataFormat provides the basic features of Apache CXF without need for the CXF Stack. Does that mean it internally uses the JAX-WS Reference Implementation which is in the JDK by default? No, it just uses the JAXB to do the marshal and unmarshal work. 2.) The section on the Webservice Client[2] shows a code snippet on making a SOAP call and also a potential route for doing the same. Are *both* simultaneously needed to make the SOAP call, or just one or the other will do? I think you need both, but just wish to confirm. Yeah, you need these two part code to perform the invocation. Thanks, Glen [1] https://cwiki.apache.org/confluence/display/CAMEL/SOAP [2] https://cwiki.apache.org/confluence/display/CAMEL/SOAP#SOAP-Webserviceclient Willem
Sending POJOs on Message Queues?
Hello, I'm new to ActiveMQ messaging queues and unsure if I can place and subsequently read POJO's from them. I have no problems getting Strings to work it's just using POJO's that is creating the problem for me. Here's how I place a DoubleIt POJO on the queue in Camel: ProducerTemplate template = context.createProducerTemplate(); context.start(); DoubleIt doubleIt = new DoubleIt(); doubleIt.setNumberToDouble(5); template.sendBody(jms:queue:numbersToDouble, doubleIt); Thread.sleep(24000); context.stop(); Here's my route: from(jms:queue:numbersToDouble).process(new DoubleItReader()); And here's my implementation of DoubleItReader: public class DoubleItReader implements Processor { @Override public void process(Exchange e) { DoubleIt response = e.getIn().getBody(DoubleIt.class); System.out.println(This was returned - Body: + response.getNumberToDouble()); } } The above returns this error when I try to run Camel: [INFO] [aultMessageListenerContainer-1] DefaultErrorHandler ERROR Failed delivery for exchangeId: ID:gmazza-desktop-54558-1283773608538-2:1:1:1:1. Exhausted after delivery attempt: 1 caught: java.lang.NullPointerException [INFO] java.lang.NullPointerException [INFO] at camel.SOAPResponseReader.process(SOAPResponseReader.java:12) [INFO] at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50) [INFO] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) If I try this conversion line instead: DoubleIt response = (DoubleIt) e.getIn().getBody(Object.class); I get this error: [INFO] Caused by: java.lang.ClassCastException: org.apache.camel.component.jms.JmsMessage cannot be cast to org.example.schema.doubleit.DoubleIt [INFO] at camel.SOAPResponseReader.process(SOAPResponseReader.java:11) [INFO] at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50) [INFO] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70) [INFO] at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) Does this mean I'm basically limited only to Strings (or to what?) for the second parameter of the template.sendBody(jms:queue:numbersToDouble, ???) command--or am I doing something else wrong? Thanks, Glen
Re: Sending POJOs on Message Queues?
No, it's not serializable, but I believe with some effort I can make it so (The class is JAXB-generated to support a web service call; JAXB has some extensions to allow for serializability). Right now I'm trying to get the JAXB DataFormat to work (after sending the object to the queue I plan on marshalling it to XML) just for the sake of seeing JAXB working. @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = , propOrder = { numberToDouble }) @XmlRootElement(name = DoubleIt) public class DoubleIt { protected int numberToDouble; ... setter and getter for above... } I can look into JSON and/or Protobuf next -- is it primarily speed, or ease-of-use (don't have to worry about making the class serializable), or smaller message size that you recommend those other formats? Thanks, Glen Tarjei Huse wrote: Hi, On 09/06/2010 02:00 PM, Glen Mazza wrote: Hello, I'm new to ActiveMQ messaging queues and unsure if I can place and subsequently read POJO's from them. I have no problems getting Strings to work it's just using POJO's that is creating the problem for me. You should be able to send Serializable objects through the queues, but I would like to suggest you look into other serialization methods like Protobufs or JSON. Is DoubleIt serializable? Regards, Tarjei
Re: Sending POJOs on Message Queues?
Oh! I was thinking of sending the POJO to the queue where it would be subsequently read and marshalled into XML, but I can have the client-side marshal into XML and send the XML to the queue instead. Makes sense... Thanks again, Glen Tarjei Huse wrote: On 09/06/2010 02:35 PM, Glen Mazza wrote: No, it's not serializable, but I believe with some effort I can make it so (The class is JAXB-generated to support a web service call; JAXB has some extensions to allow for serializability). Right now I'm trying to get the JAXB DataFormat to work (after sending the object to the queue I plan on marshalling it to XML) just for the sake of seeing JAXB working. @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = , propOrder = { numberToDouble }) @XmlRootElement(name = DoubleIt) public class DoubleIt { protected int numberToDouble; ... setter and getter for above... } I can look into JSON and/or Protobuf next -- is it primarily speed, or ease-of-use (don't have to worry about making the class serializable), or smaller message size that you recommend those other formats? In my experience using a format that is not dependent on both the client and server having the same version of the java object class makes it far easier to do updates and deployments. If you got an xml format that works that may fit the bill just fine. Another bonus is that you can use other languages to process the objects if needed. Regards, Tarjei Thanks, Glen Tarjei Huse wrote: Hi, On 09/06/2010 02:00 PM, Glen Mazza wrote: Hello, I'm new to ActiveMQ messaging queues and unsure if I can place and subsequently read POJO's from them. I have no problems getting Strings to work it's just using POJO's that is creating the problem for me. You should be able to send Serializable objects through the queues, but I would like to suggest you look into other serialization methods like Protobufs or JSON. Is DoubleIt serializable? Regards, Tarjei
where to attach the JMS options
Hello, for the JMS Component, where do I place the options[1] (those settings after the ?) -- within the from(jms:FOO.BAR?options...) of the route or within the Template.sendBody(jms:FOO.BAR?options...) or both places or does it depend on the option I'm setting? For example, to add jmsMessageType=Object, I see it could go in two places but am not sure which one is correct: ProducerTemplate template = context.createProducerTemplate(); MyObject myObj = new MyObject(); template.sendBody(jms:queue:numbersToDouble2?jmsMessageType=Object, myObj); and/or, within the route: from(jms:queue:numbersToDouble2?jmsMessageType=Object) .marshal(jaxbFormat) .to(), etc. Thanks, Glen [1] http://camel.apache.org/jms.html#JMS-Options
Re: AW: Sending POJOs on Message Queues?
Thanks, Christian. It turned out I do need to have the JAXB objects implement the Serializable marker interface (like here[1], but I didn't need toString() as it suggests) if I'm going to be sending them or reading them from a jms queue. But I don't need Serializable if I'm using the direct component. I'll check the soap component next. Glen [1] http://stackoverflow.com/questions/1513972/how-to-generate-a-java-class-which-implements-serializable-interface-from-xsd-usi Schneider Christian wrote: Hi Glen, if you use jaxb then your classes do not have to implement Serializable. Instead they of course need to be serializeable by jaxb. Btw. if you want to call a webservice with the jaxb object (Seems so as you add the soap by using xslt) then you should take a look at the camel soap dataformat. http://camel.apache.org/soap.html Greetings Christian Christian Schneider Informationsverarbeitung Business Solutions Handel und Dispatching Tel : +49-(0)721-63-15482 EnBW Systeme Infrastruktur Support GmbH Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Hans-Günther Meier -Ursprüngliche Nachricht- Von: Glen Mazza [mailto:glen.ma...@gmail.com] Gesendet: Montag, 6. September 2010 16:15 An: users@camel.apache.org Betreff: Re: Sending POJOs on Message Queues? But, just to confirm, do I need to make the JAXB objects serializable if I plan on placing them on a queue or reading them from a queue? If that's the case (makes sense), I will update the Camel JAXB page to highlight that--it presently doesn't say anything about serializability. I'm trying to practice working with JAXB, e.g., from(jms:queue:numbersToDouble) .marshal(jaxbFormat) .to(xslt://AddSOAPEnvelope.xsl) .to(CXF_URI) One more thing--if I needed to make the JAXB object serializable for it to work on a queue but didn't (or couldn't) do so, what could I replace from(jms:queue:numbersToDouble) above with to start the route? The direct component? Thanks, Glen Charles Moulliard wrote: Hi Glen, Using Camel, you can use marshal() or unmarshal() to transform objects -- XML or XML -- objects http://camel.apache.org/jaxb.html Regards, Charles Moulliard Senior Enterprise Architect (J2EE, .NET, SOA) Apache Camel - Karaf - ServiceMix Committer ~~~ Blog : http://cmoulliard.blogspot.com | Twitter : http://twitter.com/cmoulliard Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype: cmoulliard On Mon, Sep 6, 2010 at 2:51 PM, Glen Mazza glen.ma...@gmail.com wrote: Oh! I was thinking of sending the POJO to the queue where it would be subsequently read and marshalled into XML, but I can have the client-side marshal into XML and send the XML to the queue instead. Makes sense... Thanks again, Glen Tarjei Huse wrote: On 09/06/2010 02:35 PM, Glen Mazza wrote: No, it's not serializable, but I believe with some effort I can make it so (The class is JAXB-generated to support a web service call; JAXB has some extensions to allow for serializability). Right now I'm trying to get the JAXB DataFormat to work (after sending the object to the queue I plan on marshalling it to XML) just for the sake of seeing JAXB working. @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = , propOrder = { numberToDouble }) @XmlRootElement(name = DoubleIt) public class DoubleIt { protected int numberToDouble; ... setter and getter for above... } I can look into JSON and/or Protobuf next -- is it primarily speed, or ease-of-use (don't have to worry about making the class serializable), or smaller message size that you recommend those other formats? In my experience using a format that is not dependent on both the client and server having the same version of the java object class makes it far easier to do updates and deployments. If you got an xml format that works that may fit the bill just fine. Another bonus is that you can use other languages to process the objects if needed. Regards, Tarjei Thanks, Glen Tarjei Huse wrote: Hi, On 09/06/2010 02:00 PM, Glen Mazza wrote: Hello, I'm new to ActiveMQ messaging queues and unsure if I can place and subsequently read POJO's from them. I have no problems getting Strings to work it's just using POJO's that is creating the problem for me. You should be able to send Serializable objects through the queues, but I would like to suggest you look into other serialization methods like Protobufs or JSON. Is DoubleIt serializable? Regards, Tarjei
Re: (newbie) process() method eating Exchange packet
Thanks, Willem, the link helped clarify things for me. One more question: in Camel, what is the best way of determining of what type the body instance is, so I will know whether I need to use your suggestions of copying the message back into the body or use convertBodyTo(String.class)? Is it as simple as checking if its instanceof(InputStream) or is there a more generic class I should use for that check? You see, my SOAPMessagePreparer() below is currently identical to my SOAPResponseReader() (just outputs the line for debugging), but for the former, I don't have to convert the body into a string after reading it, presumably because from(jms:queue:numbersToDouble) already converts it to something that can be read multiple times. Glen Willem Jiang wrote: Glen Mazza wrote: Thanks, Willem, but why would String response = e.getIn().getBody(String.class); consume the response? Why does Camel delete the response when you call getBody()? No, Camel didn't delete the response. It's just because the body instance is an instance of InputStream, and it can't be read twice. You can find more information about it here[1] Also, for your second solution, why does converting the Body to a String result in the above call *not* consuming it anymore? Camel seems highly arbitrary in the way it works. Turn the message body into String could make the message body be reread-able. [1]http://camel.apache.org/stream-caching.html Willem Thanks, Glen Willem Jiang wrote: Hi Glen, That's because your SOAPResponseReader consumer the response. you just need to put the Body back as a string like this public class SOAPResponseReader implements Processor { @Override public void process(Exchange e) { String response = e.getIn().getBody(String.class); System.out.println(This was returned - Body: + response); e.getIn().setBody(response); } } Or just turn the Body into String like this from(jms:queue:numbersToDouble) .process(new SOAPMessagePreparer()) .to(CXF_URI) .convertBodyTo(String.class) .process(new SOAPResponseReader()) .to(file://testfile); Willem Glen Mazza wrote: Hello, the following route makes SOAP client calls and places the SOAP responses in files in the given testfile folder: public void configure() { from(jms:queue:numbersToDouble) .process(new SOAPMessagePreparer()) .to(CXF_URI) //.process(new SOAPResponseReader()) .to(file://testfile); } Everything works fine. But when I place a process method between the latter two to methods (i.e., uncomment the line above), the process method will read properly the SOAP response but it seems to eat it so that only blank files end up subsequently getting written to the testfile folder. Here's my SOAPResponseReader: public class SOAPResponseReader implements Processor { @Override public void process(Exchange e) { System.out.println(This was returned - Body: + e.getIn().getBody(String.class)); } } Any idea what's happening? What do I need to do to SOAPResponseReader so that the final to(file://testfile) in the route will store the SOAP response in each file again? Thanks, Glen
Re: (newbie) process() method eating Exchange packet
Thanks, Willem, but why would String response = e.getIn().getBody(String.class); consume the response? Why does Camel delete the response when you call getBody()? Also, for your second solution, why does converting the Body to a String result in the above call *not* consuming it anymore? Camel seems highly arbitrary in the way it works. Thanks, Glen Willem Jiang wrote: Hi Glen, That's because your SOAPResponseReader consumer the response. you just need to put the Body back as a string like this public class SOAPResponseReader implements Processor { @Override public void process(Exchange e) { String response = e.getIn().getBody(String.class); System.out.println(This was returned - Body: + response); e.getIn().setBody(response); } } Or just turn the Body into String like this from(jms:queue:numbersToDouble) .process(new SOAPMessagePreparer()) .to(CXF_URI) .convertBodyTo(String.class) .process(new SOAPResponseReader()) .to(file://testfile); Willem Glen Mazza wrote: Hello, the following route makes SOAP client calls and places the SOAP responses in files in the given testfile folder: public void configure() { from(jms:queue:numbersToDouble) .process(new SOAPMessagePreparer()) .to(CXF_URI) //.process(new SOAPResponseReader()) .to(file://testfile); } Everything works fine. But when I place a process method between the latter two to methods (i.e., uncomment the line above), the process method will read properly the SOAP response but it seems to eat it so that only blank files end up subsequently getting written to the testfile folder. Here's my SOAPResponseReader: public class SOAPResponseReader implements Processor { @Override public void process(Exchange e) { System.out.println(This was returned - Body: + e.getIn().getBody(String.class)); } } Any idea what's happening? What do I need to do to SOAPResponseReader so that the final to(file://testfile) in the route will store the SOAP response in each file again? Thanks, Glen
location of camel-context.xml file
Hello, for a Mavenized camel project, is there a difference between placing it directly under the resources folder compared to resources/META-INF/spring folder (in terms of convenience or default detection by the Camel runtime)? The Camel in Action book and Maven camel-archetype-java archetype do the latter, I was just wondering why. Thanks, Glen