0 Replies Latest reply on Mar 11, 2011 4:47 PM by tjain2011

    How to dev a camel route having cxfendpoint- I am new to camel please help

    tjain2011

      Hi

      I am new to camel and cxf and I have no idea if i am doing the right way. Please help.

       

      I have this cxfendpoint in camel and i am trying to route from that endpoint to myprocessor where i do some changes request and forward to the other cxf endpoint.

       

       

      <cxf:cxfEndpoint id="releasePOEndpoint"

        address="http://localhost:58992/workflow/release_purchase_order_service/ReleasePurchaseOrderPortType"

        serviceClass="com.company.pehz.workflow.release_purchase_order_service.ReleasePurchaseOrderPortType"/>

       

      Now the cxfendpoint takes an object of ReleasePuchaseOrderRequestType.

       

      No here is how my camel route looks like:

       

      from("cxf:bean:releasePOEndpoint")

                .to("log:incoming?showAll=true");

                   .to("mock:end");

       

      My test case looks like this

       

      ReleasePurchaseOrderRequestType request = new ReleasePurchaseOrderRequestType();

               request.setContactId(2970);

               request.setPurchaseOrderId(602562);

               request.setLastKnownUpdateTimestamp(xmlGregorianCalendar);

               

       

               MockEndpoint quote = getMockEndpoint("mock:end");

               quote.expectedMessageCount(1);

               template.sendBody("cxf:bean:releasePOEndpoint", request);

              quote.assertIsSatisfied();

       

      The wsdl part is like this

       

      <wsdl:message name="PurchaseOrderLifecycleFaultMessage">

          <wsdl:part element="ns1:purchaseOrderLifecycleFault" name="PurchaseOrderLifecycleFaultMessage">

          </wsdl:part>

        </wsdl:message>

        <wsdl:message name="releasePurchaseOrderResponse">

          <wsdl:part element="ns1:releasePurchaseOrderResponse" name="response">

          </wsdl:part>

        </wsdl:message>

        <wsdl:message name="SecurityFault">

          <wsdl:part element="ns2:securityFault" name="SecurityFault">

          </wsdl:part>

        </wsdl:message>

        <wsdl:message name="releasePurchaseOrder">

          <wsdl:part element="ns1:releasePurchaseOrderRequest" name="request">

          </wsdl:part>

        </wsdl:message>

        <wsdl:portType name="ReleasePurchaseOrderPortType">

          <wsdl:operation name="releasePurchaseOrder">

            <wsdl:input message="tns:releasePurchaseOrder" name="releasePurchaseOrder">

          </wsdl:input>

            <wsdl:output message="tns:releasePurchaseOrderResponse" name="releasePurchaseOrderResponse">

          </wsdl:output>

            <wsdl:fault message="tns:SecurityFault" name="SecurityFault">

          </wsdl:fault>

            <wsdl:fault message="tns:PurchaseOrderLifecycleFaultMessage" name="PurchaseOrderLifecycleFaultMessage">

          </wsdl:fault>

          </wsdl:operation>

        </wsdl:portType>

        <wsdl:binding name="ReleasePurchaseOrderPortTypeServiceSoapBinding" type="tns:ReleasePurchaseOrderPortType">

          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

          <wsdl:operation name="releasePurchaseOrder">

            <soap:operation soapAction="" style="document"/>

            <wsdl:input name="releasePurchaseOrder">

              <soap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="releasePurchaseOrderResponse">

              <soap:body use="literal"/>

            </wsdl:output>

            <wsdl:fault name="SecurityFault">

              <soap:fault name="SecurityFault" use="literal"/>

            </wsdl:fault>

            <wsdl:fault name="PurchaseOrderLifecycleFaultMessage">

              <soap:fault name="PurchaseOrderLifecycleFaultMessage" use="literal"/>

            </wsdl:fault>

          </wsdl:operation>

        </wsdl:binding>

        <wsdl:service name="ReleasePurchaseOrderPortTypeService">

          <wsdl:port binding="tns:ReleasePurchaseOrderPortTypeServiceSoapBinding" name="ReleasePurchaseOrderPortTypePort">

            <soap:address location="http://localhost:58992/workflow/release_purchase_order_service/ReleasePurchaseOrderPortType"/>

          </wsdl:port>

        </wsdl:service>

      </wsdl:definitions>

       

      now when I run this test case my test case fails and I am having this exception

       

      org.apache.cxf.binding.soap.SoapFault: Error writing to XMLStreamWriter.

           at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:288)

           at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:270)

           at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)

           at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:99)

           at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:315)

           at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)

           at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:311)

           at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:280)

           at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)

           at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:931)

           at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:868)

           at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)

           at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:185)

           at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)

           at org.eclipse.jetty.server.Server.handleAsync(Server.java:397)

           at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:601)

           at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1068)

           at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:805)

           at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)

           at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)

           at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:508)

           at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)

           at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)

           at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)

           at java.lang.Thread.run(Thread.java:680)

      Caused by: javax.xml.stream.XMLStreamException: No open start element, when trying to write end element

           at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547)

           at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576)

           at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteEndTag(BaseNsStreamWriter.java:644)

           at com.ctc.wstx.sw.BaseNsStreamWriter.writeEndElement(BaseNsStreamWriter.java:276)

           at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:279)

           ... 24 more

       

      can you please tell me whts going wrong. Please?

       

      Edited by: tjain2011 on Mar 11, 2011 9:45 PM