Re: Support for CXF dispatch api in the latest release of camel

2014-11-11 Thread santosh das
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
  

Support for CXF dispatch api in the latest release of camel

2014-11-05 Thread santosh das
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.