[
https://issues.apache.org/jira/browse/CXF-741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508442
]
Freeman Fang commented on CXF-741:
----------------------------------
The InputStream is consumed when build XmlStreamReader in StaxInInterceptor
which is invoked before ProviderInDatabindingInterceptor.
For DataSource provider, it should skip AttachmentInInterceptor which extract
attachment from message and StaxInInterceptor which create XmlStreamReader from
message InputStream
Then After add code in ProviderInDatabindingInterceptor
if (SOAPMessage.class.equals(type)) {
SOAPMessage msg = message.getContent(SOAPMessage.class);
params.add(msg);
+ } else if (DataSource.class.equals(type)) {
+ InputStream is = message.getContent(InputStream.class);
+ try {
+ params.add(new ByteArrayDataSource(is, (String)
+message.get(Message.CONTENT_TYPE)));
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
}
I almost get your testcode work since I can get message with multi-part mime
attachments in Post method of TestProvider. But seems the multi-part mime
messasge is not correct because multipart.getCount() is 0 in my case.
The message I print in post method of TestProvider is
------=_Part_4_701508.1145579811786
Content-Type: text/xml
Content-ID: <attachmentData>
<foo>
<bar baz="wibble"/>
</foo>
------=_Part_4_701508.1145579811786
Content-Type: application/base64
Content-ID: <base64>
TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg
dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu
dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo
ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=
> cannot invoke on endpoint implemented using Provider<DataSource>
> ----------------------------------------------------------------
>
> Key: CXF-741
> URL: https://issues.apache.org/jira/browse/CXF-741
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Conrad O'Dea
> Assignee: Freeman Fang
> Attachments: cxf-datasource-test-2.tgz, cxf-datasource-test.tgz
>
>
> Invoking on an XML/HTTP service implemented with the following provider:
> @WebServiceProvider(serviceName = "TestProvider")
> @ServiceMode(value = Service.Mode.PAYLOAD)
> @BindingType(value = "http://cxf.apache.org/bindings/xformat")
> public class TestProvider extends AbstractProvider<DataSource> implements
> Provider<DataSource> {
> ....
> }
> Results in the following stack trace:
> java.lang.NullPointerException
> at
> org.apache.cxf.frontend.SimpleMethodDispatcher.getMethod(SimpleMethodDispatcher.java:92)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:51)
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
> at
> org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:87)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:67)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:255)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:214)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:54)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> at org.mortbay.jetty.Server.handle(Server.java:285)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:821)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:208)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:368)
> at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.