Hi All, 
   
    I am trying to expose a sample CXF SOAP based webservice using camel
cxfbean component. I am using JBoss Fuse for deploying camel route as
bundle. I am folllowing the bottom up approach. I created the WSDL file
first then I use the CXF code gen maven plugin to generate the java class
using the goal wsdl2java.  

I have given the pastebin link for all the files 

wsdl file : http://pastebin.com/v0aKgNTy

Camel Context : http://pastebin.com/SXYzNd0S

Processor Class : http://pastebin.com/T2e4vHir

SOAP Request and Response : http://pastebin.com/BiH9Au6P

I am trying to set the response back to the caller (SOAP UI in this case)
who invokes my webservice which is being exposed by camel from endpoint. 

I am using <transform> in the camel route to send the response back to the
caller as 

<transform>
    <simple></simple>
</transform>  

But the behavior of the above mentioned is not stable. Sometimes I get the
response properly as expected in the SOAP UI as follows

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
   <soap:Body>
        <ns2:calculatorResponse
xmlns:ns2="http://www.example.org/calculatorWS/";>
                <response>Response from calculate operation is ::: 2 * 3 =
6</response>
        </ns2:calculatorResponse>
    </soap:Body>
</soap:Envelope>

And most of the time I am getting response with no content in the soap body.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
   <soap:Body/>
</soap:Envelope>

Also, when I checked the fuse.log I could see the renspone as 
 
23:49:12,403 | INFO  | qtp1067936275-65 | route13                          |
142 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | Request Body
<cal:calculatorRequest xmlns:cal="http://www.example.org/calculatorWS/";>
         <operand1>2</operand1>
         <operand2>3</operand2>
         <operation>*</operation>
      </cal:calculatorRequest>
23:49:12,405 | INFO  | qtp1067936275-65 | route13                          |
142 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | Request Headers
{operationNamespace=http://www.example.org/calculatorWS/,
accept-encoding=gzip,deflate,
breadcrumbId=ID-Soleil-Laptop-64876-1403016788154-12-1,
content-type=text/xml;charset=UTF-8, operationName=calculate,
CamelCxfMessage={javax.xml.ws.wsdl.port={http://www.example.org/calculatorWS/}calculatorWSPort,
org.apache.cxf.service.model.MessageInfo=[MessageInfo INPUT:
{http://www.example.org/calculatorWS/}calculatorWSRequest],
org.apache.cxf.message.Message.PROTOCOL_HEADERS={accept-encoding=[gzip,deflate],
connection=[keep-alive], Content-Length=[371],
content-type=[text/xml;charset=UTF-8], Host=[localhost:8181],
SOAPAction=["http://www.example.org/calculatorWS/calculate";],
User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]},
HTTP_CONTEXT_MATCH_STRATEGY=stem, http.service.redirection=null,
org.apache.cxf.request.url=http://localhost:8181/cxf/calculatorWS,
javax.xml.ws.wsdl.interface={http://www.example.org/calculatorWS/}calculatorWS,
org.apache.cxf.request.uri=/cxf/calculatorWS, HTTP.REQUEST=(POST
/cxf/calculatorWS)@1459710162 org.eclipse.jetty.server.Request@570168d2,
org.apache.cxf.transport.https.CertConstraints=null,
HTTP.CONFIG=org.eclipse.jetty.servlet.ServletHolder$Config@79eee92e,
Accept=null, org.apache.cxf.headers.Header.list=[],
org.apache.cxf.message.Message.BASE_PATH=/cxf/calculatorWS,
org.apache.cxf.message.Message.PATH_INFO=/cxf/calculatorWS,
org.apache.cxf.interceptor.DocLiteralInInterceptor.DocLiteralInInterceptor.keep-parameters-wrapper=true,
org.apache.cxf.continuations.ContinuationProvider=org.apache.cxf.transport.http.Servlet3ContinuationProvider@1d88df9e,
javax.xml.ws.wsdl.service={http://www.example.org/calculatorWS/}calculatorWS,
org.apache.cxf.message.Message.IN_INTERCEPTORS=[org.apache.cxf.transport.https.CertConstraintsInterceptor@473be107],
org.apache.cxf.binding.soap.SoapVersion=org.apache.cxf.binding.soap.Soap11@2c32b71a,
org.apache.cxf.message.Message.ENCODING=UTF-8,
org.apache.cxf.message.Message.QUERY_STRING=null, HTTP.RESPONSE=HTTP/1.1 200
 
,
org.apache.cxf.security.SecurityContext=org.apache.cxf.transport.http.AbstractHTTPDestination$2@5110d38,
org.apache.cxf.configuration.security.AuthorizationPolicy=null,
org.apache.cxf.async.post.response.dispatch=true,
org.apache.cxf.request.method=POST,
javax.xml.ws.wsdl.operation={http://www.example.org/calculatorWS/}calculate,
org.apache.cxf.transport.Destination=org.apache.cxf.transport.servlet.ServletDestination@227ada21,
org.apache.cxf.message.MessageFIXED_PARAMETER_ORDER=false,
SOAPAction=http://www.example.org/calculatorWS/calculate,
javax.xml.ws.wsdl.description=http://localhost:8181/cxf/calculatorWS?wsdl,
http.base.path=http://localhost:8181,
HTTP.CONTEXT=ServletContext@HttpServiceContext{httpContext=DefaultHttpContext{org.apache.cxf.cxf-rt-transports-http
- 170}}, Content-Type=text/xml;charset=UTF-8},
SOAPAction=http://www.example.org/calculatorWS/calculate,
org.apache.cxf.headers.Header.list=[], Host=localhost:8181,
connection=keep-alive, User-Agent=Apache-HttpClient/4.1.1 (java 1.5)}
23:49:12,414 | INFO  | qtp1067936275-65 | route13                          |
142 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | *Response Body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:calculatorResponse xmlns:ns2="http://www.example.org/calculatorWS/";>
    <response>Response from calculate operation is ::: 2 * 3 = 6</response>
</ns2:calculatorResponse>
 *

I am bit confused here, why the response is not getting generated properly.
Am I missing something ?

Any suggestion or help will be really helpfull. I have attached the project
as an attachment.  Camel-CXF-Calculator.rar
<http://camel.465427.n5.nabble.com/file/n5752447/Camel-CXF-Calculator.rar>  




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-send-the-response-back-to-the-caller-when-exposing-cxf-webservice-using-camel-tp5752447.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to