No clue.  Hmm......

Any chance you can produce a testcase for this? Maybe have the test generate a big byte[] or something to try it? I know I've sent "medium sized" attachments back and forth, around 2-3MB. How big are you talking?

Dan



Bharath Thippireddy wrote:
Thanks a lot Dan.That helps/works.
But when the soap attachment is too long i see the following exception on the server, when i invoke an other service after the attachment service.Any clue?

--------------------------------------
<ns1:Fault xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/";><faultcode>ns1 Server</faultcode><faultstring>Exception occurred while marshalling Dispatch ob ect to stream</faultstring></ns1:Fault>--------------------------------------

Apr 30, 2008 4:47:29 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEnd
ngInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep
orChain.java:207)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMes
age(AbstractFaultChainInitiatorObserver.java:90)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep
orChain.java:224)
at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(Ou
goingChainInterceptor.java:74)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep
orChain.java:207)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInit
ationObserver.java:73)
at org.apache.cxf.transport.servlet.ServletDestination.doMessage(Servle
Destination.java:79)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination
ServletController.java:256)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletCon
roller.java:160)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractC
FServlet.java:170)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractC
FServlet.java:148)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
icationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
ilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper
alve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContext
alve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.
ava:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa
ve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.ja
a:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.jav
:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.
rocessConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndp
int.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFo
lowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Thread
ool.java:689)
        at java.lang.Thread.run(Thread.java:595)
Caused by: ClientAbortException: java.net.SocketException: Connection reset by
peer: socket write error
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuff
r.java:366)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:432) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java
314)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:2
8)
at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputS
ream.java:104)
at org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputS
ream.close(AbstractHTTPDestination.java:426)
at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteO
tputStream.java:47)
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:1
7)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:
6)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEnd
ngInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        ... 27 more
Caused by: java.net.SocketException: Connection reset by peer: socket write err
r
        at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(Interna
OutputBuffer.java:747)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:432)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:347)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuff
r.doWrite(InternalOutputBuffer.java:770)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(Chunked
utputFilter.java:124)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutput
uffer.java:580)
        at org.apache.coyote.Response.doWrite(Response.java:560)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuff
r.java:361)
        ... 36 more

thanks and regards,
Bharath

Daniel Kulp <[EMAIL PROTECTED]> wrote on 04/30/2008 04:11:05 PM:


Assuming you added the interceptor onto the clients IN chain, it should add them to the response context. That said, it won't be a Map<String<List<String>>. It will be a "List<Attachment>" (technically, a LazyAttachmentCollection). Get the responseContext EntrySet iterator and iterate over what is in there. That might help.

(BTW: the other option would be to have the interceptor stick the Attachment map into a public ThreadLocal or something that can be retrieved by the client code.)

And can you please let me know the maximum size limit of a SOAP
attachment in CXF.
Honestly, I don't think there is one. Once the attachment gets over a certain size (default is 100K), if we need to unstream it off the wire immediately (example, to get the third attachment when the current wire position is on the second one), we spool it to temp files on disk. Thus, it may depend on the file system.
Dan


On Wednesday 30 April 2008, Bharath Thippireddy wrote:
Dan,

Does the work around really work.We retrieve the attachements from the
message object and assign them on the same object.Does this add them
to the request or the response contexts?.I could see the attachments
coming in on the interceptor but not on the client yet.

http://www.nabble.com/Re:-SoapWithAttachments-p16500116.html

message.put("ATTACHMENTS", message.getAttachments());

Map<String,List<String>> attachments = (Map<String,List<String>>)
requestContext.get("ATTACHMENTS");
or
Map<String,List<String>> attachments = (Map<String,List<String>>)
responseContext.get("ATTACHMENTS");

still returns null.

And can you please let me know the maximum size limit of a SOAP
attachment in CXF.

thanks and regards,
Bharath

Daniel Kulp <[EMAIL PROTECTED]> wrote on 04/29/2008 03:04:25 PM:
Unfortunately, right now, there isn't.   About a month ago, I dug
into this a little bit:
http://www.nabble.com/Re:-SoapWithAttachments-p16500116.html

There is a workaround there.   Could you log a feature request in
Jira
to

make sure it's tracked?

Thanks!
Dan

On Tuesday 29 April 2008, Bharath Thippireddy wrote:
How can we retrieve the soap attachments on the CXF Client.When i
try the following it returns a null.

BindingProvider bp = (BindingProvider)port;
java.util.Map<String,Object> responseContext =
bp.getResponseContext();
(Map<String,List<String>>)responseContext.get(MessageContext.
INBOUND_MESSAGE_ATTACHMENTS)

thanks and regards,
Bharath
--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog



--
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to