1 Reply Latest reply on Oct 28, 2009 7:41 PM by Keith Barlow

    CXF-SE Implementation & Data Binding

    Keith Barlow Newbie

      Hiyas,

       

      I was wondering if you could feild a few questions on getting a service up and running:

       

      I have a simple service which accepts a Duplication object as its parameter.  This service is implemented using JAX-WS annotations and declared in a cxfse:endpoint element.

       

      I have a JMS queue on either side of the service and the goal is to get the JMS Consumer element to read the input queue, invoke the service, and place the repsonse on the output queue...

       

      Here are my service declarations:

       

      Interface:

       

      @WebService(name = "profiler",

                targetNamespace = "http://www.company.com/dupmac")

      @SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.BARE)

      public interface Profiler {

       

           @WebMethod(operationName = "getDirectoryProfile")

           @RequestWrapper(targetNamespace = "urn:com.company.dupmac.domain",

                     className = "com.company.dupmac.domain.Profile")

           @ResponseWrapper(targetNamespace = "urn:com.company.dupmac.domain",

                     className = "com.company.dupmac.domain.Profile")

           @WebResult(name = "profile", targetNamespace = "urn:com.company.dupmac.domain")

           Profile getDirectoryProfile(

                     @WebParam(name = "profile", targetNamespace = "urn:com.company.dupmac.domain") Profile profile);

      }

       

      Implementation:

       

      @WebService(serviceName = "DupmacProfiler",

                portName = "DupmacProfilerPort",

                endpointInterface="com.company.dupmac.cxf.Profiler",

                targetNamespace = "http://www.company.com/dupmac")

      public class ProfilerImpl implements Profiler {

       

           ...(declarations)...

       

           public Profile getDirectoryProfile(Duplication duplication) {

       

                ...(code)...

            

                return profile;

           }

      }

       

      The cxfse:endpoint:

       

       

           

       

      The jms:consumer endpoint:

       

                        

          <jms:consumer service="svcs:MyConsumerService"

                        endpoint="myConsumer"

                        destinationName="test.InQueue"

                        connectionFactory="#connectionFactory"

                        targetService="svcs:DupmacProfiler"

                        targetInterface="svcs:profiler"

                        targetEndpoint="DupmacProfilerPort"

                        replyDestinationName="test.OutQueue"

                        concurrentConsumers="1" />

       

      where svcs="http://www.company.com/dupmac", the namespace declared by the service and implementation

       

      The result:

       

      INFO  - AutoDeploymentService          - Directory: hotdeploy: Archive changed: processing company-dupmac-sa-1.0-SNAPSHOT.zip ...

      INFO  - ServiceAssemblyLifeCycle       - Starting service assembly: company-dupmac-sa

      INFO  - ServiceUnitLifeCycle           - Initializing service unit: company-dupmac-jms

      INFO  - ServiceUnitLifeCycle           - Initializing service unit: company-dupmac-cxf

      INFO  - ServiceUnitLifeCycle           - Starting service unit: company-dupmac-jms

      INFO  - ServiceUnitLifeCycle           - Starting service unit: company-dupmac-cxf

      INFO  - ReflectionServiceFactoryBean   - Creating Service DupmacProfiler from class com.company.dupmac.cxf.Profiler

      INFO  - ConfigurerImpl                 - Could not determine bean name for instance of class org.apache.cxf.transport.jbi.JBIDestination.

      INFO  - ServerImpl                     - Setting the server's publish address to be jbi://ID-172-24-120-143-1249d566876-26-4

      INFO  - AutoDeploymentService          - Directory: hotdeploy: Finished installation of archive:  company-dupmac-sa-1.0-SNAPSHOT.zip

      WARN  - ReflectionServiceFactoryBean   - A JAX-WS Annotation was found on com.company.dupmac.cxf.ProfilerImpl while using the Simple frontend.  For better results, use the JAX-WS frontend.

      INFO  - ReflectionServiceFactoryBean   - Creating Service ProfilerImpl from class com.company.dupmac.cxf.ProfilerImpl

      INFO  - ServerImpl                     - Setting the server's publish address to be local://dummy

      ERROR - CxfSeComponent                 - Error processing exchange InOnly[

        id: ID:172.24.120.143-1249d566876-19:3

        status: Active

        role: provider

        interface: profiler

        service: DupmacProfiler

        endpoint: DupmacProfilerPort

        in: <?xml version="1.0" encoding="UTF-8"?>

      ]

      java.lang.NullPointerException

           at org.apache.servicemix.cxfse.CxfSeEndpoint.findOperation(CxfSeEndpoint.java:512)

           at org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java:372)

           at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)

           at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)

           at org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)

           at org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)

           at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)

           at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)

           at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)

           at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)

           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

       

       

      Question 1: Are my endpoints correctly configured - i.e. am I using the proper names to reference the JAX-WS service?  I seem to get the same output now as when I tried to declare the service and endpoint attributes on the cxfse:endpoint element so I am assuming so but would like to verify.

       

      Question 2: Is the error message I am getting because I do not have either DataBinding or MTOM configured?  It appears as though I can do this with or without data binding...  I would prefer to do this without DataBinding and save my self the overhead of marshalling... however, configuration with DataBinding looks like it might be easier since it seems like MTOM support relies on transport level customizations.

      For a Data Binding mechanism, I would like to use the Aegis mashalling support inherent to CXF.  Is this a valid option with the JAX-WS frontend?

       

      Thanks.

       

      Keith

       

      Edited by: kbarlow on Oct 28, 2009 7:07 PM