Re: Support for CXF dispatch api in the latest release of camel
I am not still sure what you mean by using the dispatch API in camel. Willem already answered to your question and I am adding a few info. The actual dispatching part (i.e., sending out a generic message) is there in Camel. The message constructing part isn't there because in camel, you typically construct a message elsewhere as a payload or a SOAP-envelope and simply forwarding it to a cxf endpoint that can send that message. If that is what you can use, you can find the examples in these tests https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob;f=components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfDispatchPayloadTest.java https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob;f=components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfDispatchMessageTest.java regards, aki 2014-11-12 5:54 GMT+01:00 santosh das santoshdas1...@gmail.com: Thanks a lot for the suggestion, do we have any samples specific to cxf that i can try out? I need some more clarification between the relationship of the beans and processors and how they fit in together? I believe we can have an anonymous innerclass of processor to define the custom business logic, are you proposing to hook in CXF dispatch code in there? Also is there a plan to support CXF dispatch API out of the box from camel in the near future. I find it really encouraging to get suggestions from an active community group. Appreciate for all the help provided so far and going forward. Thanks, Santosh On Wed, Nov 12, 2014 at 8:10 AM, Willem Jiang willem.ji...@gmail.com wrote: Current camel-cxf doesn’t support the dispatch API, you can use the PAYLOAD message data format to do the something. BTW, if you still want to use the CXF dispatch API, you can use bean[1] or processor[2] to integration the invocation within Camel route. [1]http://camel.apache.org/bean.html [2]http://camel.apache.org/processor.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 11, 2014 at 5:41:52 PM, santoshdas1984 ( santoshdas1...@gmail.com) wrote: Hi , Could you please elaborate a bit more about the Camel CXF endpoint. We dont want to use the spring based configuration as we are evaluating this for our product The same reason we have used CXF For e.g. For Ws-Addressing we are using the dispatch api as follows import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES; import java.io.FileNotFoundException; import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.DispatchImpl; import org.apache.cxf.ws.addressing.AddressingProperties; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.ObjectFactory; import org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl; import org.apache.cxf.ws.addressing.soap.MAPCodec; import com.pega.pegarules.priv.ModuleVersion; public class TestCXFAddressing { public static final String VERSION = ModuleVersion.register($Id$); private static final ObjectFactory WSA_OBJECT_FACTORY = new ObjectFactory(); /** * @param args * @throws SOAPException * @throws IOException */ public static void main(String[] args) throws IOException, SOAPException { testService(); } private static void testService() throws FileNotFoundException, IOException, SOAPException { QName serviceName = new QName(, ); Service s = Service.create(serviceName); QName portName = new QName(, ); s.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, http://localhost:9000/SoapContext/SoapPort;); Dispatch dispatch = s.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); Client client = ((DispatchImpl) dispatch).getClient(); // engage addressing interceptors MAPCodec mapCodec = new MAPCodec(); MAPAggregatorImpl mapAggregator = new MAPAggregatorImpl(); client.getOutInterceptors().add(mapCodec); client.getOutInterceptors().add(mapAggregator); client.getInInterceptors().add(mapCodec); client.getInInterceptors().add(mapAggregator); // set addressing property in request context dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES, createMaps()); // Create a message. This example works with the SOAPPART. MessageFactory mf = MessageFactory .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); SOAPMessage
Re: Support for CXF dispatch api in the latest release of camel
Hi , Could you please elaborate a bit more about the Camel CXF endpoint. We dont want to use the spring based configuration as we are evaluating this for our product The same reason we have used CXF For e.g. For Ws-Addressing we are using the dispatch api as follows import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES; import java.io.FileNotFoundException; import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.DispatchImpl; import org.apache.cxf.ws.addressing.AddressingProperties; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.ObjectFactory; import org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl; import org.apache.cxf.ws.addressing.soap.MAPCodec; import com.pega.pegarules.priv.ModuleVersion; public class TestCXFAddressing { public static final String VERSION = ModuleVersion.register($Id$); private static final ObjectFactory WSA_OBJECT_FACTORY = new ObjectFactory(); /** * @param args * @throws SOAPException * @throws IOException */ public static void main(String[] args) throws IOException, SOAPException { testService(); } private static void testService() throws FileNotFoundException, IOException, SOAPException { QName serviceName = new QName(, ); Service s = Service.create(serviceName); QName portName = new QName(, ); s.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, http://localhost:9000/SoapContext/SoapPort;); DispatchSOAPMessage dispatch = s.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); Client client = ((DispatchImplSOAPMessage) dispatch).getClient(); // engage addressing interceptors MAPCodec mapCodec = new MAPCodec(); MAPAggregatorImpl mapAggregator = new MAPAggregatorImpl(); client.getOutInterceptors().add(mapCodec); client.getOutInterceptors().add(mapAggregator); client.getInInterceptors().add(mapCodec); client.getInInterceptors().add(mapAggregator); // set addressing property in request context dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES, createMaps()); // Create a message. This example works with the SOAPPART. MessageFactory mf = MessageFactory .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); SOAPMessage request = mf.createMessage(); SOAPPart part = request.getSOAPPart(); // Obtain the SOAPEnvelope and header and body elements. SOAPEnvelope env = part.getEnvelope(); SOAPBody body = env.getBody(); // Construct the message payload. SOAPElement operation = body.addChildElement(greetMe, tns, http://apache.org/hello_world_soap_http/types;); SOAPElement value = operation.addChildElement(requestType, tns, http://apache.org/hello_world_soap_http/types;); value.addTextNode(World); request.saveChanges(); SOAPMessage response = dispatch.invoke(request); System.out.println(response.getSOAPBody().getTextContent()); } private static AddressingProperties createMaps() { // get Message Addressing Properties instance AddressingProperties maps = new AddressingProperties(); // set MessageID property AttributedURIType messageID = WSA_OBJECT_FACTORY .createAttributedURIType(); // AttributedURIType action = // WSA_OBJECT_FACTORY.createAttributedURIType(); messageID.setValue(urn:uuid: + System.currentTimeMillis()); maps.setMessageID(messageID); return maps; } } Now i am interested to know if we can use CAMEL routing capabilities by having such a programming model in CXF and we are not so inclined towards using spring configuration approach. So basic question is if i were to use CAMEL as a layer to add routing mechanism and use CXF dispatch as a web service engine , how can i do that?
Re: Support for CXF dispatch api in the latest release of camel
Current camel-cxf doesn’t support the dispatch API, you can use the PAYLOAD message data format to do the something. BTW, if you still want to use the CXF dispatch API, you can use bean[1] or processor[2] to integration the invocation within Camel route. [1]http://camel.apache.org/bean.html [2]http://camel.apache.org/processor.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 11, 2014 at 5:41:52 PM, santoshdas1984 (santoshdas1...@gmail.com) wrote: Hi , Could you please elaborate a bit more about the Camel CXF endpoint. We dont want to use the spring based configuration as we are evaluating this for our product The same reason we have used CXF For e.g. For Ws-Addressing we are using the dispatch api as follows import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES; import java.io.FileNotFoundException; import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.DispatchImpl; import org.apache.cxf.ws.addressing.AddressingProperties; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.ObjectFactory; import org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl; import org.apache.cxf.ws.addressing.soap.MAPCodec; import com.pega.pegarules.priv.ModuleVersion; public class TestCXFAddressing { public static final String VERSION = ModuleVersion.register($Id$); private static final ObjectFactory WSA_OBJECT_FACTORY = new ObjectFactory(); /** * @param args * @throws SOAPException * @throws IOException */ public static void main(String[] args) throws IOException, SOAPException { testService(); } private static void testService() throws FileNotFoundException, IOException, SOAPException { QName serviceName = new QName(, ); Service s = Service.create(serviceName); QName portName = new QName(, ); s.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, http://localhost:9000/SoapContext/SoapPort;); Dispatch dispatch = s.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); Client client = ((DispatchImpl) dispatch).getClient(); // engage addressing interceptors MAPCodec mapCodec = new MAPCodec(); MAPAggregatorImpl mapAggregator = new MAPAggregatorImpl(); client.getOutInterceptors().add(mapCodec); client.getOutInterceptors().add(mapAggregator); client.getInInterceptors().add(mapCodec); client.getInInterceptors().add(mapAggregator); // set addressing property in request context dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES, createMaps()); // Create a message. This example works with the SOAPPART. MessageFactory mf = MessageFactory .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); SOAPMessage request = mf.createMessage(); SOAPPart part = request.getSOAPPart(); // Obtain the SOAPEnvelope and header and body elements. SOAPEnvelope env = part.getEnvelope(); SOAPBody body = env.getBody(); // Construct the message payload. SOAPElement operation = body.addChildElement(greetMe, tns, http://apache.org/hello_world_soap_http/types;); SOAPElement value = operation.addChildElement(requestType, tns, http://apache.org/hello_world_soap_http/types;); value.addTextNode(World); request.saveChanges(); SOAPMessage response = dispatch.invoke(request); System.out.println(response.getSOAPBody().getTextContent()); } private static AddressingProperties createMaps() { // get Message Addressing Properties instance AddressingProperties maps = new AddressingProperties(); // set MessageID property AttributedURIType messageID = WSA_OBJECT_FACTORY .createAttributedURIType(); // AttributedURIType action = // WSA_OBJECT_FACTORY.createAttributedURIType(); messageID.setValue(urn:uuid: + System.currentTimeMillis()); maps.setMessageID(messageID); return maps; } } Now i am interested to know if we can use CAMEL routing capabilities by having such a programming model in CXF and we are not so inclined towards using spring configuration approach. So basic question is if i were to use CAMEL as a layer to add routing mechanism and use CXF dispatch as a web service engine , how can i do that? -- View this message in context: http://camel.465427.n5.nabble.com/Support-for-CXF-dispatch-api-in-the-latest-release-of-camel-tp5758569p5758892.html Sent from the Camel - Users mailing list archive at
Re: Support for CXF dispatch api in the latest release of camel
Thanks a lot for the suggestion, do we have any samples specific to cxf that i can try out? I need some more clarification between the relationship of the beans and processors and how they fit in together? I believe we can have an anonymous innerclass of processor to define the custom business logic, are you proposing to hook in CXF dispatch code in there? Also is there a plan to support CXF dispatch API out of the box from camel in the near future. I find it really encouraging to get suggestions from an active community group. Appreciate for all the help provided so far and going forward. Thanks, Santosh On Wed, Nov 12, 2014 at 8:10 AM, Willem Jiang willem.ji...@gmail.com wrote: Current camel-cxf doesn’t support the dispatch API, you can use the PAYLOAD message data format to do the something. BTW, if you still want to use the CXF dispatch API, you can use bean[1] or processor[2] to integration the invocation within Camel route. [1]http://camel.apache.org/bean.html [2]http://camel.apache.org/processor.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 11, 2014 at 5:41:52 PM, santoshdas1984 ( santoshdas1...@gmail.com) wrote: Hi , Could you please elaborate a bit more about the Camel CXF endpoint. We dont want to use the spring based configuration as we are evaluating this for our product The same reason we have used CXF For e.g. For Ws-Addressing we are using the dispatch api as follows import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES; import java.io.FileNotFoundException; import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.DispatchImpl; import org.apache.cxf.ws.addressing.AddressingProperties; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.ObjectFactory; import org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl; import org.apache.cxf.ws.addressing.soap.MAPCodec; import com.pega.pegarules.priv.ModuleVersion; public class TestCXFAddressing { public static final String VERSION = ModuleVersion.register($Id$); private static final ObjectFactory WSA_OBJECT_FACTORY = new ObjectFactory(); /** * @param args * @throws SOAPException * @throws IOException */ public static void main(String[] args) throws IOException, SOAPException { testService(); } private static void testService() throws FileNotFoundException, IOException, SOAPException { QName serviceName = new QName(, ); Service s = Service.create(serviceName); QName portName = new QName(, ); s.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, http://localhost:9000/SoapContext/SoapPort;); Dispatch dispatch = s.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); Client client = ((DispatchImpl) dispatch).getClient(); // engage addressing interceptors MAPCodec mapCodec = new MAPCodec(); MAPAggregatorImpl mapAggregator = new MAPAggregatorImpl(); client.getOutInterceptors().add(mapCodec); client.getOutInterceptors().add(mapAggregator); client.getInInterceptors().add(mapCodec); client.getInInterceptors().add(mapAggregator); // set addressing property in request context dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES, createMaps()); // Create a message. This example works with the SOAPPART. MessageFactory mf = MessageFactory .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); SOAPMessage request = mf.createMessage(); SOAPPart part = request.getSOAPPart(); // Obtain the SOAPEnvelope and header and body elements. SOAPEnvelope env = part.getEnvelope(); SOAPBody body = env.getBody(); // Construct the message payload. SOAPElement operation = body.addChildElement(greetMe, tns, http://apache.org/hello_world_soap_http/types;); SOAPElement value = operation.addChildElement(requestType, tns, http://apache.org/hello_world_soap_http/types;); value.addTextNode(World); request.saveChanges(); SOAPMessage response = dispatch.invoke(request); System.out.println(response.getSOAPBody().getTextContent()); } private static AddressingProperties createMaps() { // get Message Addressing Properties instance AddressingProperties maps = new AddressingProperties(); // set MessageID property AttributedURIType messageID = WSA_OBJECT_FACTORY
Re: Support for CXF dispatch api in the latest release of camel
Here are some discussions[1] about the different between the bean and processor. An anonymous interclass can do the job for you. As Current camel-cxf is using CXF client to send the invocation and PAYLOAD data format can do the same job, we don’t have the plan to leverage the dispatch API to send the request in camel-cxf model. [1]http://camel.465427.n5.nabble.com/Preferring-bean-or-processor-invocations-on-a-route-td5756652.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 12, 2014 at 12:55:33 PM, santosh das (santoshdas1...@gmail.com) wrote: Thanks a lot for the suggestion, do we have any samples specific to cxf that i can try out? I need some more clarification between the relationship of the beans and processors and how they fit in together? I believe we can have an anonymous innerclass of processor to define the custom business logic, are you proposing to hook in CXF dispatch code in there? Also is there a plan to support CXF dispatch API out of the box from camel in the near future. I find it really encouraging to get suggestions from an active community group. Appreciate for all the help provided so far and going forward. Thanks, Santosh On Wed, Nov 12, 2014 at 8:10 AM, Willem Jiang wrote: Current camel-cxf doesn’t support the dispatch API, you can use the PAYLOAD message data format to do the something. BTW, if you still want to use the CXF dispatch API, you can use bean[1] or processor[2] to integration the invocation within Camel route. [1]http://camel.apache.org/bean.html [2]http://camel.apache.org/processor.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 11, 2014 at 5:41:52 PM, santoshdas1984 ( santoshdas1...@gmail.com) wrote: Hi , Could you please elaborate a bit more about the Camel CXF endpoint. We dont want to use the spring based configuration as we are evaluating this for our product The same reason we have used CXF For e.g. For Ws-Addressing we are using the dispatch api as follows import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES; import java.io.FileNotFoundException; import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.DispatchImpl; import org.apache.cxf.ws.addressing.AddressingProperties; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.ObjectFactory; import org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl; import org.apache.cxf.ws.addressing.soap.MAPCodec; import com.pega.pegarules.priv.ModuleVersion; public class TestCXFAddressing { public static final String VERSION = ModuleVersion.register($Id$); private static final ObjectFactory WSA_OBJECT_FACTORY = new ObjectFactory(); /** * @param args * @throws SOAPException * @throws IOException */ public static void main(String[] args) throws IOException, SOAPException { testService(); } private static void testService() throws FileNotFoundException, IOException, SOAPException { QName serviceName = new QName(, ); Service s = Service.create(serviceName); QName portName = new QName(, ); s.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, http://localhost:9000/SoapContext/SoapPort;); Dispatch dispatch = s.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); Client client = ((DispatchImpl) dispatch).getClient(); // engage addressing interceptors MAPCodec mapCodec = new MAPCodec(); MAPAggregatorImpl mapAggregator = new MAPAggregatorImpl(); client.getOutInterceptors().add(mapCodec); client.getOutInterceptors().add(mapAggregator); client.getInInterceptors().add(mapCodec); client.getInInterceptors().add(mapAggregator); // set addressing property in request context dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES, createMaps()); // Create a message. This example works with the SOAPPART. MessageFactory mf = MessageFactory .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); SOAPMessage request = mf.createMessage(); SOAPPart part = request.getSOAPPart(); // Obtain
Support for CXF dispatch api in the latest release of camel
Our application is already using its webservice engine as CXF via the dispatch api, Now we are evaluating to add camel to utilize its EIP capabilities and still yse CXF. I could find no documentation whatsoever for using Camel with CXF dispatch API. Any hep is highly appreciated in this regard.