I have tried to use HTML form, Java code and XMLSpy to POST soap request,
but the inbound message in HTTP component are all empty if use
request.getParameter(""), it's strange that seems only my SMX has this
problem...
Jean-Baptiste Onofré wrote:
>
> Well,
>
> I have understood what's happen.
>
> In the HttpSoapConsumerMarshaler, in the createExchange method, the
> message content is set only for the POST method:
>
> headers.put(HttpConstants.REQUEST_URI,
> request.getRequestURL().toString());
> headers.put(HttpConstants.CONTENT_TYPE,
> request.getContentType());
> headers.put(HttpConstants.REQUEST_METHOD, method);
> if (HttpConstants.METHOD_POST.equals(method) ||
> HttpConstants.METHOD_PUT.equals(method)) {
> msg.setContent(InputStream.class, request.getInputStream());
> }
>
> So, if you try to submit using GET method, the message setContent()
> method is never called. And so the message content is null.
> That's why the interceptor raise the NullPointerException.
>
> Could you try using the POST method ?
>
> Nevertheless, I think that you can raise a jira, at least to raise a
> better exception message.
>
> Regards
> JB
>
> laolong wrote:
>>
>> Hi JB,
>>
>> Now I believe the problem is caused by HTTP component/Jetty issue, the
>> HTTP component cannot get POST data from HTTP request.
>> 1. I create a SOAP marshaler and overwrite function createExchange
>> using
>> the source code from
>> org.apache.servicemix.http.endpoints.HttpSoapConsumerMarshaler.java like
>> below and remove REQUESt method checking (in red), then I can get correct
>> SOAP response from XMLSpy.
>>
>> public MessageExchange createExchange(HttpServletRequest request,
>> ComponentContext context) throws Exception {
>> String method = request.getMethod();
>> System.out.println(method);
>> Message msg = super.getBinding().createMessage();
>> msg.put(ComponentContext.class, context);
>> msg.put(JbiConstants.USE_JBI_WRAPPER, super.isUseJbiWrapper());
>> msg.put(Message.CONTENT_TYPE, request.getContentType());
>> Map<String, String> headers = msg.getTransportHeaders();
>> for (Enumeration<?> e = request.getHeaderNames();
>> e.hasMoreElements();)
>> {
>> String name = (String) e.nextElement();
>> String value = request.getHeader(name);
>> headers.put(name, value);
>> }
>> headers.put(HttpConstants.REQUEST_URI, request.getRequestURL()
>> .toString());
>> headers.put(HttpConstants.CONTENT_TYPE,
>> request.getContentType());
>> headers.put(HttpConstants.REQUEST_METHOD, method);
>> // if (HttpConstants.METHOD_POST.equals(method)
>> // || HttpConstants.METHOD_PUT.equals(method)) {
>> msg.setContent(InputStream.class,
>> request.getInputStream());
>> // }
>> request.setAttribute(Message.class.getName(), msg);
>> InterceptorChain phase = getChain(Phase.ServerIn);
>> phase.doIntercept(msg);
>> return msg.getContent(MessageExchange.class);
>>
>> }
>> 2. I also tried to use <http:endpoint>, it also get following error
>> message
>>
>> <pre>org.apache.cxf.interceptor.Fault: no jbi message element
>> at
>> org.apache.cxf.binding.jbi.interceptor.JBIWrapperInInterceptor.handleMessage(JBIWrapperInInterceptor.java:102)
>> at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
>> at
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
>> at
>> org.apache.cxf.transport.jbi.JBIDispatcherUtil.dispatch(JBIDispatcherUtil.java:156)
>> at
>> org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java:364)
>> 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$Worker.runTask(ThreadPoolExecutor.java:650)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>> at java.lang.Thread.run(Thread.java:595)
>> </pre>
>>
>>
>> Thanks.
>> Long
>>
>>
>>
>> Jean-Baptiste Onofré wrote:
>>> OK,
>>>
>>> The NullPointerException is raised into the Soap marshaler.
>>>
>>> Could you make a quick test using the "old" HTTP endpoint like this:
>>> <http:endpoint service="service"
>>> endpoint="http"
>>> role="consumer"
>>> targetService="service"
>>> targetEndpoint="ejb"
>>> locationURI="http://0.0.0.0:8181/what/you/want"
>>> defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>>> soap="true"
>>> />
>>>
>>> During this time, I take a look on the interceptor usage in the default
>>> SOAP marshaler.
>>>
>>> Regards
>>> JB
>>>
>>> laolong wrote:
>>>> Hi JB,
>>>> Yes, I think CXF-SU internal endpoint should be working.
>>>> I tried servicemix-http-2009.01.0.1-fuse-installer.zip (FUSE
>>>> 3.4.0.2)
>>>> and
>>>> servicemix-http-2008.01-installer.zip(Servicemix3.3) , got same
>>>> 'InputStream
>>>> content not found' error.
>>>>
>>>> Thanks,
>>>> Long
>>>>
>>>>
>>>>
>>>> Jean-Baptiste Onofré wrote:
>>>>> If you can get the WSDL generated by CXF, the CXF-SU should be OK.
>>>>>
>>>>> I'm going to check in the HTTP component source code where is raised
>>>>> the
>>>>> NullPointerException.
>>>>> What's the version of the HTTP component that you use ?
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> laolong wrote:
>>>>>> I guess the problem also caused by Http/Jetty issue, the request
>>>>>> message
>>>>>> cannot be processed, message content is lost due to the SOAP message
>>>>>> POST
>>>>>> by
>>>>>> XMLSpy is received with wrong method 'GET'
>>>>>>
>>>>>> SMX log---------------------------------------------
>>>>>>
>>>>>> DEBUG - HttpComponent - Receiving HTTP request: GET
>>>>>> /LoginServiceService/main.wsdl HTTP/1.1
>>>>>> Accept: */*
>>>>>> User-Agent: XML Spy
>>>>>> Host: bjc-d-xp:8199
>>>>>> Connection: Keep-Alive
>>>>>> Cache-Control: no-cache
>>>>>>
>>>>>>
>>>>>> DEBUG - JettyContextManager - Dispatching job:
>>>>>> s...@10234051[d=true,io=0,w=true,b=false|false]
>>>>>> DEBUG - JettyContextManager - Dispatching job:
>>>>>> s...@10234051[d=true,io=1,w=true,b=false|false]
>>>>>> DEBUG - JettyContextManager - Dispatching job:
>>>>>> s...@10234051[d=true,io=1,w=true,b=false|false]
>>>>>> DEBUG - HttpComponent - Receiving HTTP request: GET
>>>>>> /LoginServiceService/ HTTP/1.1
>>>>>> User-Agent: XML Spy
>>>>>> SOAPAction: "urn:Login"
>>>>>> Host: localhost:8199
>>>>>> Connection: Keep-Alive
>>>>>> Cache-Control: no-cache
>>>>>>
>>>>>>
>>>>>> DEBUG - PhaseInterceptorChain - Invoking handleMessage on
>>>>>> interceptor
>>>>>> org.apache.servicemix.soap.interceptors.mime.AttachmentsInInterceptor
>>>>>> INFO - PhaseInterceptorChain - Interceptor has thrown
>>>>>> exception,
>>>>>> unwinding now
>>>>>> java.lang.NullPointerException: InputStream content not found
>>>>>> at
>>>>>> org.apache.servicemix.soap.interceptors.mime.AttachmentsInInterceptor.handleMessage(AttachmentsInInterceptor.java:46)
>>>>>> at
>>>>>> org.apache.servicemix.soap.core.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:85)
>>>>>> at
>>>>>> org.apache.servicemix.http.endpoints.HttpSoapConsumerMarshaler.createExchange(HttpSoapConsumerMarshaler.java:107)
>>>>>> at
>>>>>> org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.createExchange(HttpConsumerEndpoint.java:488)
>>>>>> at
>>>>>> org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.process(HttpConsumerEndpoint.java:293)
>>>>>> at
>>>>>> org.apache.servicemix.http.HttpBridgeServlet.service(HttpBridgeServlet.java:56)
>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>>>> at
>>>>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
>>>>>> at
>>>>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
>>>>>> at
>>>>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>>>>>> at
>>>>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
>>>>>> at
>>>>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>>>>>> at
>>>>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>>>>> at org.mortbay.jetty.Server.handle(Server.java:324)
>>>>>> at
>>>>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
>>>>>> at
>>>>>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
>>>>>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
>>>>>> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
>>>>>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
>>>>>> at
>>>>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>>>>>> at
>>>>>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
>>>>>> DEBUG - PhaseInterceptorChain - Invoking handleFault on
>>>>>> interceptor
>>>>>> org.apache.servicemix.soap.interceptors.mime.AttachmentsInInterceptor
>>>>>> DEBUG - HttpSoapConsumerMarshaler - Using default response
>>>>>> content
>>>>>> encoding.
>>>>>> DEBUG - PhaseInterceptorChain - Invoking handleMessage on
>>>>>> interceptor
>>>>>> org.apache.servicemix.soap.interceptors.xml.StaxOutInterceptor
>>>>>> DEBUG - PhaseInterceptorChain - Invoking handleMessage on
>>>>>> interceptor
>>>>>> org.apache.servicemix.soap.bindings.soap.interceptors.SoapOutInterceptor
>>>>>> DEBUG - PhaseInterceptorChain - Invoking handleMessage on
>>>>>> interceptor
>>>>>> org.apache.servicemix.soap.bindings.soap.interceptors.SoapFaultOutInterceptor
>>>>>>
>>>>>>
>>>>>> Jean-Baptiste Onofré wrote:
>>>>>>> Hi Long,
>>>>>>>
>>>>>>> In your CXF-SE xbean.xml, I see that you try to make the JNDI lookup
>>>>>>> on
>>>>>>> a Weblogic application server.
>>>>>>>
>>>>>>> Nevertheless, I can't see the weblogic.jar file into your SU lib
>>>>>>> directory.
>>>>>>>
>>>>>>> To be able to make JNDI lookup and RMI-IIOP, you need the weblogic
>>>>>>> client lib.
>>>>>>>
>>>>>>> In your pom.xml, you should have a dependency like this:
>>>>>>>
>>>>>>> <dependency>
>>>>>>> <groupId>com.oracle.weblogic</groupId>
>>>>>>> <artifactId>server</artifactId>
>>>>>>> <version>10.3</version>
>>>>>>> </dependency>
>>>>>>>
>>>>>>> You can install the weblogic.jar into your maven working copy using:
>>>>>>> mvn install:install-file -DgroupId=com.oracle.weblogic
>>>>>>> -DartifactId=server -Dfile=$WLS_HOME/server/lib/weblogic.jar
>>>>>>> -Dversion=10.3 -Dpackaging=jar
>>>>>>>
>>>>>>> Could you make a try adding the weblogic.jar into the SU ?
>>>>>>>
>>>>>>> Regards
>>>>>>> JB
>>>>>>>
>>>>>>> laolong wrote:
>>>>>>>> Hi JB,
>>>>>>>>
>>>>>>>> http://www.nabble.com/file/p23978791/demo.zip demo.zip
>>>>>>>>
>>>>>>>> I built a test EJB but got same error again, all java code and
>>>>>>>> bean
>>>>>>>> defination are in attached, could you please review it?
>>>>>>>>
>>>>>>>> I'm sorry that cannot find a way to send email with attachement
>>>>>>>> to
>>>>>>>> you
>>>>>>>> alone, so I have to use 'Reply' page to upload the file.
>>>>>>>>
>>>>>>>> Thanks a lot.
>>>>>>>>
>>>>>>>> Long
>>>>>>>>
>>>>>>>>
>>>>>>>> Hummm, weird.
>>>>>>>>
>>>>>>>> Could you provide the annotate in the your LoginService class (and
>>>>>>>> the
>>>>>>>> corresponding interface) ?
>>>>>>>> It looks like that the CXF-SE side is not deployed correctly (and
>>>>>>>> so
>>>>>>>> the
>>>>>>>> HTTP component can't find it).
>>>>>>>> Have you all EJB proxy requirements present in your SU zip (EJBs
>>>>>>>> stub,
>>>>>>>> etc) ?
>>>>>>>> Is it possible to provide your cxf-se zip file (only to my, not on
>>>>>>>> the
>>>>>>>> mailing list) ?
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>
>>
>
>
--
View this message in context:
http://www.nabble.com/How-to-invoke-EJB-and-How-to-disable-WSDL-validation-in-http%3Asoap-consumer-provider--tp23963883p23994315.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.