You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Cencio <ce...@gmail.com> on 2007/10/15 18:38:05 UTC
SOAPMessage with Attachment service problems
Hi all,
i deploy a message level service that receive a SOAPMessage and works fine
until i send a message with attachment:
18:37:13,026 ERROR [STDERR] 15-ott-2007 18.37.13
com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
GRAVE: SAAJ0511: Unable to create envelope from given source
18:37:13,028 ERROR [STDERR] 15-ott-2007 18.37.13
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unable to create envelope from given
source:
at
org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$PostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabindingInterceptor.java:191)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
at
org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:235)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:140)
at
org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:278)
at
org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:256)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create
envelope from given source:
at
com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:114)
at
com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:71)
at
com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:125)
at
org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$PostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabindingInterceptor.java:189)
... 28 more
Caused by: javax.xml.transform.TransformerException:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:501)
at
com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer.transform(EfficientStreamingTransformer.java:390)
at
com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:102)
... 31 more
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1269)
at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
this is the client:
package org.openspcoop.test.client;
import java.net.URL;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.AttachmentPart;
public class Attachment {
public static void main(String[] args){
try{
SOAPFactory soapFac = SOAPFactory.newInstance();
MessageFactory msgFac = MessageFactory.newInstance();
SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
SOAPMessage msg = msgFac.createMessage();
msg.getSOAPBody().addChildElement(soapFac.createElement("Test"));
AttachmentPart ap1 = msg.createAttachmentPart();
ap1.setContent("Attachment content", "text/plain");
msg.addAttachmentPart(ap1);
msg.writeTo(System.out);
SOAPConnection con = conFac.createConnection();
URL endpoint = new URL("http://localhost:8080/CFX/PD");
SOAPMessage response = con.call(msg, endpoint);
response.writeTo(System.out);
}
catch(Exception e){
System.out.println("Ouch!!!! "+e.toString());
}
}
}
This is the service:
package org.openspcoop.pdd.services;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Iterator;
import javax.annotation.Resource;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.Provider;
import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceProvider;
import javax.xml.ws.Service.Mode;
@Resource
@ServiceMode(value=Mode.MESSAGE)
@WebServiceProvider
public class RicezioneContenutiApplicativiWS implements
Provider<SOAPMessage>{
WebServiceContext wsContext;
public SOAPMessage invoke(SOAPMessage request){
try{
System.out.println("Test write resume");
System.out.println("SOAPMessage class : " +
request.getClass().getName());
File file = new File("/home/cencio/SOAPMessage.msg");
FileOutputStream fos = new FileOutputStream(file);
request.writeTo(fos);
fos.close();
Iterator it = request.getMimeHeaders().getAllHeaders();
while(it.hasNext()){
MimeHeader mh = (MimeHeader) it.next();
System.out.println("Header >> " + mh.getName() + " : " + mh.getValue());
}
}
catch(Exception e){
System.out.println("Qualcosa è andato storto!! : " + e.toString());
}
return request;
}
}
I really need some help -.-
Thx!
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13216625
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
I still have problems with the axis old client that sends a soap msg
with 2 attachments.
At server side CXF loose the 2nd one.
Same message made with CXF also at client side works fine, so i deep
check message to find differences.
Looking msgs with hex editor i find that axis client add a "0d 0a" at
eof that CXF's msg don't have.
Could be this?
Message request that don't work in attachment (Wireshark log)
Thx
/Lorenzo
http://www.nabble.com/file/p14994654/request_non_funzionante.msg
request_non_funzionante.msg
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tp13216625p14994654.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
dkulp wrote:
>
> 1) In your provider, call msg.saveChanges() before returning. I notice
> we're not doing that. (I'll go ahead and add that)
>
Nothing change...
dkulp wrote:
>
> 2) Try in tomcat standalone instead of in JBoss. I'm wondering if
> you're getting a different SAAJ implementation.
> Dan
>
request.getClass().getName() gives
com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl
It's correct... anyway i'll try in a standalone tomcat..
If u need i can send you my client and service...
Thx for your help,
Lorenzo
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13278232
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Daniel Kulp <dk...@apache.org>.
I think I'm going to need an actual reproducable test case. I've tried
duplicating this here and cannot. It all seems to work OK.
(That is providing the input messages are correct. The logs you sent
definitely had some issues, but that may be due to the mailers or
similar trying to text format it and converting some cr/lf type
things. )
Couple things to try:
1) In your provider, call msg.saveChanges() before returning. I notice
we're not doing that. (I'll go ahead and add that)
2) Try in tomcat standalone instead of in JBoss. I'm wondering if
you're getting a different SAAJ implementation.
Dan
On Thursday 18 October 2007, Cencio wrote:
> Hi Dan,
>
> i tryed the snap apache-cxf-2.0.3-incubator-20071016.175632-4 to check
> if attachments are ok, but there is still some problem...
>
> After tons of testing i finally reproduce thos scenarios (Message send
> have 2 zip attachments):
>
> Client send and service simply echo the message:
> Client throws org.xml.sax.SAXParseException: Content is not allowed
> in prolog.
> With tcpmon i can see a little difference in attachment
> formatting.. tcpmon log [1]
>
> Client send and service write attachments on files before send back
> Attachments are perfects.. then same errors of first scenario
>
> Client send and service write the whole message, then the attachments,
> then send back:
> Writing the whole message with writeTo seems to corrupt the
> content: Looking the file written the second attachment is gone...
> When iterate the attachments to write them only one is found
> The attachment written is corrupt
> The message send back is cutted : tcpmon log [2]
> The client throws the same error
>
>
> I hope this can help...
> I wait 4 ur news
> Tell me if u build a snapshot with some fix so i can deeply test it.
>
> Thx,
> Lorenzo
>
> LOGS:
> [1] http://www.nabble.com/file/p13276118/scenario_1and2.log
> scenario_1and2.log
> [2] http://www.nabble.com/file/p13276118/scenario_3.log scenario_3.log
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
The content type is right in the received SOAPMessage, but for some reason it
changes when it is send back...
Sorry 4 so many mails.. i hope that helps..
I test also with apache-cxf-2.0.3-incubator-20071017.210232-4 with same
results.
/Lorenzo
Cencio wrote:
>
> And the HTTP header content type is wrong!!!!
>
>
>
>
> Cencio wrote:
>>
>> I notice in both scenarios that
>>
>> Content-Transfer-Encoding: binary
>> Content-Id: <D8E78C856CFEFA300FC2EF5B1B6F05E3>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> lines in the first part (Soap envelope part) are missing... that's wrong?
>>
>
>
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13277743
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
And the HTTP header content type is wrong....
Cencio wrote:
>
> I notice in both scenarios that
>
> Content-Transfer-Encoding: binary
> Content-Id: <D8E78C856CFEFA300FC2EF5B1B6F05E3>
> <?xml version="1.0" encoding="UTF-8"?>
>
> lines in the first part (Soap envelope part) are missing... that's wrong?
>
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13276628
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
And the HTTP header content type is wrong!!!!
Cencio wrote:
>
> I notice in both scenarios that
>
> Content-Transfer-Encoding: binary
> Content-Id: <D8E78C856CFEFA300FC2EF5B1B6F05E3>
> <?xml version="1.0" encoding="UTF-8"?>
>
> lines in the first part (Soap envelope part) are missing... that's wrong?
>
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13276628
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
I notice in both scenarios that
Content-Transfer-Encoding: binary
Content-Id: <D8E78C856CFEFA300FC2EF5B1B6F05E3>
<?xml version="1.0" encoding="UTF-8"?>
lines in the first part (Soap envelope part) are missing... that's wrong?
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13276436
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
Hi Dan,
i tryed the snap apache-cxf-2.0.3-incubator-20071016.175632-4 to check if
attachments are ok, but there is still some problem...
After tons of testing i finally reproduce thos scenarios (Message send have
2 zip attachments):
Client send and service simply echo the message:
Client throws org.xml.sax.SAXParseException: Content is not allowed in
prolog.
With tcpmon i can see a little difference in attachment formatting..
tcpmon log [1]
Client send and service write attachments on files before send back
Attachments are perfects.. then same errors of first scenario
Client send and service write the whole message, then the attachments, then
send back:
Writing the whole message with writeTo seems to corrupt the content:
Looking the file written the second attachment is gone...
When iterate the attachments to write them only one is found
The attachment written is corrupt
The message send back is cutted : tcpmon log [2]
The client throws the same error
I hope this can help...
I wait 4 ur news
Tell me if u build a snapshot with some fix so i can deeply test it.
Thx,
Lorenzo
LOGS:
[1] http://www.nabble.com/file/p13276118/scenario_1and2.log
scenario_1and2.log
[2] http://www.nabble.com/file/p13276118/scenario_3.log scenario_3.log
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13276118
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
Thx Dan,
just a couple of notices:
with an AXIS2 service the client i used givs this error
- Part content ID cannot be blank for non root MIME parts
If u need i can provide another client that produce a well formed message
with attachment
The response message error isn't a valid soap message... it don't have the
envelope and body, just the error element
Thx for any help, if i may help you just ask
/Lorenzo
dkulp wrote:
>
>
> Just a quick FYI: I was able to reproduce the problem. I'm testing
> some fixes for it now. I hope to get it committed today.
>
> Dan
>
>
> On Tuesday 16 October 2007, Cencio wrote:
>> Still stuck with this issue....
>>
>> If somebody have any idea to solve this or another way to make a
>> service that let me work on the saaj SOAPMessage (also with
>> attachments..) plz reply..
>>
>> Thx,
>> Lorenzo
>>
>> Cencio wrote:
>> > Hi all,
>> >
>> > i deploy a message level service that receive a SOAPMessage and
>> > works fine until i send a message with attachment:
>> >
>> > 18:37:13,026 ERROR [STDERR] 15-ott-2007 18.37.13
>> > com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
>> > GRAVE: SAAJ0511: Unable to create envelope from given source
>> > 18:37:13,028 ERROR [STDERR] 15-ott-2007 18.37.13
>> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
>> > INFO: Interceptor has thrown exception, unwinding now
>> > org.apache.cxf.interceptor.Fault: Unable to create envelope from
>> > given source:
>> > at
>> > org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$P
>> >ostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabinding
>> >Interceptor.java:191) at
>> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep
>> >torChain.java:207) at
>> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInit
>> >iationObserver.java:73) at
>> > org.apache.cxf.transport.servlet.ServletDestination.doMessage(Servle
>> >tDestination.java:79) at
>> > org.apache.cxf.transport.servlet.ServletController.invokeDestination
>> >(ServletController.java:235) at
>> > org.apache.cxf.transport.servlet.ServletController.invoke(ServletCon
>> >troller.java:140) at
>> > org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:2
>> >78) at
>> > org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:2
>> >56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
>> >licationFilterChain.java:252) at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
>> >FilterChain.java:173) at
>> > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderF
>> >ilter.java:96) at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
>> >licationFilterChain.java:202) at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
>> >FilterChain.java:173) at
>> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper
>> >Valve.java:213) at
>> > org.apache.catalina.core.StandardContextValve.invoke(StandardContext
>> >Valve.java:178) at
>> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securi
>> >tyAssociationValve.java:175) at
>> > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextVal
>> >ve.java:74) at
>> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.
>> >java:126) at
>> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.
>> >java:105) at
>> > org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConn
>> >ectionValve.java:156) at
>> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa
>> >lve.java:107) at
>> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.ja
>> >va:148) at
>> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.jav
>> >a:869) at
>> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.
>> >processConnection(Http11BaseProtocol.java:664) at
>> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndp
>> >oint.java:527) at
>> > org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWo
>> >rkerThread.java:112) at java.lang.Thread.run(Thread.java:595)
>> > Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to
>> > create envelope from given source:
>> > at
>> > com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Envel
>> >opeFactory.java:114) at
>> > com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelop
>> >eFromSource(SOAPPart1_1Impl.java:71) at
>> > com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImp
>> >l.java:125) at
>> > org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$P
>> >ostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabinding
>> >Interceptor.java:189) ... 28 more
>> > Caused by: javax.xml.transform.TransformerException:
>> > org.xml.sax.SAXParseException: Content is not allowed in prolog.
>> > at
>> > org.apache.xalan.transformer.TransformerIdentityImpl.transform(Trans
>> >formerIdentityImpl.java:501) at
>> > com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransfor
>> >mer.transform(EfficientStreamingTransformer.java:390) at
>> > com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Envel
>> >opeFactory.java:102) ... 31 more
>> > Caused by: org.xml.sax.SAXParseException: Content is not allowed in
>> > prolog.
>> > at
>> > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(A
>> >bstractSAXParser.java:1269) at
>> > org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
>> >
>> >
>> >
>> >
>> > this is the client:
>> >
>> > package org.openspcoop.test.client;
>> >
>> > import java.net.URL;
>> >
>> > import javax.xml.soap.MessageFactory;
>> > import javax.xml.soap.SOAPConnection;
>> > import javax.xml.soap.SOAPMessage;
>> > import javax.xml.soap.SOAPFactory;
>> > import javax.xml.soap.SOAPConnectionFactory;
>> > import javax.xml.soap.AttachmentPart;
>> >
>> >
>> >
>> > public class Attachment {
>> >
>> > public static void main(String[] args){
>> > try{
>> > SOAPFactory soapFac = SOAPFactory.newInstance();
>> > MessageFactory msgFac = MessageFactory.newInstance();
>> > SOAPConnectionFactory conFac =
>> > SOAPConnectionFactory.newInstance(); SOAPMessage msg =
>> > msgFac.createMessage();
>> > msg.getSOAPBody().addChildElement(soapFac.createElement("Test"));
>> > AttachmentPart ap1 = msg.createAttachmentPart();
>> > ap1.setContent("Attachment content", "text/plain");
>> > msg.addAttachmentPart(ap1);
>> > msg.writeTo(System.out);
>> >
>> > SOAPConnection con = conFac.createConnection();
>> > URL endpoint = new URL("http://localhost:8080/CFX/PD");
>> > SOAPMessage response = con.call(msg, endpoint);
>> >
>> > response.writeTo(System.out);
>> >
>> > }
>> > catch(Exception e){
>> > System.out.println("Ouch!!!! "+e.toString());
>> > }
>> > }
>> >
>> > }
>> >
>> >
>> >
>> > This is the service:
>> >
>> >
>> >
>> >
>> >
>> > package org.openspcoop.pdd.services;
>> >
>> > import java.io.File;
>> > import java.io.FileOutputStream;
>> > import java.util.Iterator;
>> >
>> > import javax.annotation.Resource;
>> > import javax.xml.soap.MimeHeader;
>> > import javax.xml.soap.SOAPMessage;
>> > import javax.xml.ws.Provider;
>> > import javax.xml.ws.ServiceMode;
>> > import javax.xml.ws.WebServiceContext;
>> > import javax.xml.ws.WebServiceProvider;
>> > import javax.xml.ws.Service.Mode;
>> > @Resource
>> >
>> >
>> >
>> > @ServiceMode(value=Mode.MESSAGE)
>> > @WebServiceProvider
>> >
>> >
>> > public class RicezioneContenutiApplicativiWS implements
>> > Provider<SOAPMessage>{
>> > WebServiceContext wsContext;
>> >
>> > public SOAPMessage invoke(SOAPMessage request){
>> > try{
>> > System.out.println("Test write resume");
>> > System.out.println("SOAPMessage class : " +
>> > request.getClass().getName());
>> >
>> > File file = new File("/home/cencio/SOAPMessage.msg");
>> > FileOutputStream fos = new FileOutputStream(file);
>> > request.writeTo(fos);
>> > fos.close();
>> >
>> > Iterator it = request.getMimeHeaders().getAllHeaders();
>> > while(it.hasNext()){
>> > MimeHeader mh = (MimeHeader) it.next();
>> > System.out.println("Header >> " + mh.getName() + " : " +
>> > mh.getValue());
>> > }
>> > }
>> > catch(Exception e){
>> > System.out.println("Qualcosa è andato storto!! : " +
>> > e.toString()); }
>> > return request;
>> > }
>> > }
>> >
>> >
>> >
>> >
>> > I really need some help -.-
>> >
>> > Thx!
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727 C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>
>
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13237338
Sent from the cxf-user mailing list archive at Nabble.com.
Re: SOAPMessage with Attachment service problems
Posted by Daniel Kulp <dk...@apache.org>.
Just a quick FYI: I was able to reproduce the problem. I'm testing
some fixes for it now. I hope to get it committed today.
Dan
On Tuesday 16 October 2007, Cencio wrote:
> Still stuck with this issue....
>
> If somebody have any idea to solve this or another way to make a
> service that let me work on the saaj SOAPMessage (also with
> attachments..) plz reply..
>
> Thx,
> Lorenzo
>
> Cencio wrote:
> > Hi all,
> >
> > i deploy a message level service that receive a SOAPMessage and
> > works fine until i send a message with attachment:
> >
> > 18:37:13,026 ERROR [STDERR] 15-ott-2007 18.37.13
> > com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
> > GRAVE: SAAJ0511: Unable to create envelope from given source
> > 18:37:13,028 ERROR [STDERR] 15-ott-2007 18.37.13
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > INFO: Interceptor has thrown exception, unwinding now
> > org.apache.cxf.interceptor.Fault: Unable to create envelope from
> > given source:
> > at
> > org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$P
> >ostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabinding
> >Interceptor.java:191) at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep
> >torChain.java:207) at
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInit
> >iationObserver.java:73) at
> > org.apache.cxf.transport.servlet.ServletDestination.doMessage(Servle
> >tDestination.java:79) at
> > org.apache.cxf.transport.servlet.ServletController.invokeDestination
> >(ServletController.java:235) at
> > org.apache.cxf.transport.servlet.ServletController.invoke(ServletCon
> >troller.java:140) at
> > org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:2
> >78) at
> > org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:2
> >56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
> >licationFilterChain.java:252) at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
> >FilterChain.java:173) at
> > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderF
> >ilter.java:96) at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
> >licationFilterChain.java:202) at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
> >FilterChain.java:173) at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper
> >Valve.java:213) at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContext
> >Valve.java:178) at
> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securi
> >tyAssociationValve.java:175) at
> > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextVal
> >ve.java:74) at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.
> >java:126) at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.
> >java:105) at
> > org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConn
> >ectionValve.java:156) at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa
> >lve.java:107) at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.ja
> >va:148) at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.jav
> >a:869) at
> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.
> >processConnection(Http11BaseProtocol.java:664) at
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndp
> >oint.java:527) at
> > org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWo
> >rkerThread.java:112) at java.lang.Thread.run(Thread.java:595)
> > Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to
> > create envelope from given source:
> > at
> > com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Envel
> >opeFactory.java:114) at
> > com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelop
> >eFromSource(SOAPPart1_1Impl.java:71) at
> > com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImp
> >l.java:125) at
> > org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$P
> >ostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabinding
> >Interceptor.java:189) ... 28 more
> > Caused by: javax.xml.transform.TransformerException:
> > org.xml.sax.SAXParseException: Content is not allowed in prolog.
> > at
> > org.apache.xalan.transformer.TransformerIdentityImpl.transform(Trans
> >formerIdentityImpl.java:501) at
> > com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransfor
> >mer.transform(EfficientStreamingTransformer.java:390) at
> > com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Envel
> >opeFactory.java:102) ... 31 more
> > Caused by: org.xml.sax.SAXParseException: Content is not allowed in
> > prolog.
> > at
> > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(A
> >bstractSAXParser.java:1269) at
> > org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
> >
> >
> >
> >
> > this is the client:
> >
> > package org.openspcoop.test.client;
> >
> > import java.net.URL;
> >
> > import javax.xml.soap.MessageFactory;
> > import javax.xml.soap.SOAPConnection;
> > import javax.xml.soap.SOAPMessage;
> > import javax.xml.soap.SOAPFactory;
> > import javax.xml.soap.SOAPConnectionFactory;
> > import javax.xml.soap.AttachmentPart;
> >
> >
> >
> > public class Attachment {
> >
> > public static void main(String[] args){
> > try{
> > SOAPFactory soapFac = SOAPFactory.newInstance();
> > MessageFactory msgFac = MessageFactory.newInstance();
> > SOAPConnectionFactory conFac =
> > SOAPConnectionFactory.newInstance(); SOAPMessage msg =
> > msgFac.createMessage();
> > msg.getSOAPBody().addChildElement(soapFac.createElement("Test"));
> > AttachmentPart ap1 = msg.createAttachmentPart();
> > ap1.setContent("Attachment content", "text/plain");
> > msg.addAttachmentPart(ap1);
> > msg.writeTo(System.out);
> >
> > SOAPConnection con = conFac.createConnection();
> > URL endpoint = new URL("http://localhost:8080/CFX/PD");
> > SOAPMessage response = con.call(msg, endpoint);
> >
> > response.writeTo(System.out);
> >
> > }
> > catch(Exception e){
> > System.out.println("Ouch!!!! "+e.toString());
> > }
> > }
> >
> > }
> >
> >
> >
> > This is the service:
> >
> >
> >
> >
> >
> > package org.openspcoop.pdd.services;
> >
> > import java.io.File;
> > import java.io.FileOutputStream;
> > import java.util.Iterator;
> >
> > import javax.annotation.Resource;
> > import javax.xml.soap.MimeHeader;
> > import javax.xml.soap.SOAPMessage;
> > import javax.xml.ws.Provider;
> > import javax.xml.ws.ServiceMode;
> > import javax.xml.ws.WebServiceContext;
> > import javax.xml.ws.WebServiceProvider;
> > import javax.xml.ws.Service.Mode;
> > @Resource
> >
> >
> >
> > @ServiceMode(value=Mode.MESSAGE)
> > @WebServiceProvider
> >
> >
> > public class RicezioneContenutiApplicativiWS implements
> > Provider<SOAPMessage>{
> > WebServiceContext wsContext;
> >
> > public SOAPMessage invoke(SOAPMessage request){
> > try{
> > System.out.println("Test write resume");
> > System.out.println("SOAPMessage class : " +
> > request.getClass().getName());
> >
> > File file = new File("/home/cencio/SOAPMessage.msg");
> > FileOutputStream fos = new FileOutputStream(file);
> > request.writeTo(fos);
> > fos.close();
> >
> > Iterator it = request.getMimeHeaders().getAllHeaders();
> > while(it.hasNext()){
> > MimeHeader mh = (MimeHeader) it.next();
> > System.out.println("Header >> " + mh.getName() + " : " +
> > mh.getValue());
> > }
> > }
> > catch(Exception e){
> > System.out.println("Qualcosa è andato storto!! : " +
> > e.toString()); }
> > return request;
> > }
> > }
> >
> >
> >
> >
> > I really need some help -.-
> >
> > Thx!
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: SOAPMessage with Attachment service problems
Posted by Cencio <ce...@gmail.com>.
Still stuck with this issue....
If somebody have any idea to solve this or another way to make a service
that let me work on the saaj SOAPMessage (also with attachments..) plz
reply..
Thx,
Lorenzo
Cencio wrote:
>
> Hi all,
>
> i deploy a message level service that receive a SOAPMessage and works fine
> until i send a message with attachment:
>
> 18:37:13,026 ERROR [STDERR] 15-ott-2007 18.37.13
> com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
> GRAVE: SAAJ0511: Unable to create envelope from given source
> 18:37:13,028 ERROR [STDERR] 15-ott-2007 18.37.13
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unable to create envelope from given
> source:
> at
> org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$PostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabindingInterceptor.java:191)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
> at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
> at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:235)
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:140)
> at
> org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:278)
> at
> org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:256)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at
> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create
> envelope from given source:
> at
> com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:114)
> at
> com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:71)
> at
> com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:125)
> at
> org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor$PostDispatchSOAPHandlerInterceptor.handleMessage(DispatchInDatabindingInterceptor.java:189)
> ... 28 more
> Caused by: javax.xml.transform.TransformerException:
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
> at
> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:501)
> at
> com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer.transform(EfficientStreamingTransformer.java:390)
> at
> com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:102)
> ... 31 more
> Caused by: org.xml.sax.SAXParseException: Content is not allowed in
> prolog.
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1269)
> at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
>
>
>
>
> this is the client:
>
> package org.openspcoop.test.client;
>
> import java.net.URL;
>
> import javax.xml.soap.MessageFactory;
> import javax.xml.soap.SOAPConnection;
> import javax.xml.soap.SOAPMessage;
> import javax.xml.soap.SOAPFactory;
> import javax.xml.soap.SOAPConnectionFactory;
> import javax.xml.soap.AttachmentPart;
>
>
>
> public class Attachment {
>
> public static void main(String[] args){
> try{
> SOAPFactory soapFac = SOAPFactory.newInstance();
> MessageFactory msgFac = MessageFactory.newInstance();
> SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
> SOAPMessage msg = msgFac.createMessage();
> msg.getSOAPBody().addChildElement(soapFac.createElement("Test"));
> AttachmentPart ap1 = msg.createAttachmentPart();
> ap1.setContent("Attachment content", "text/plain");
> msg.addAttachmentPart(ap1);
> msg.writeTo(System.out);
>
> SOAPConnection con = conFac.createConnection();
> URL endpoint = new URL("http://localhost:8080/CFX/PD");
> SOAPMessage response = con.call(msg, endpoint);
>
> response.writeTo(System.out);
>
> }
> catch(Exception e){
> System.out.println("Ouch!!!! "+e.toString());
> }
> }
>
> }
>
>
>
> This is the service:
>
>
>
>
>
> package org.openspcoop.pdd.services;
>
> import java.io.File;
> import java.io.FileOutputStream;
> import java.util.Iterator;
>
> import javax.annotation.Resource;
> import javax.xml.soap.MimeHeader;
> import javax.xml.soap.SOAPMessage;
> import javax.xml.ws.Provider;
> import javax.xml.ws.ServiceMode;
> import javax.xml.ws.WebServiceContext;
> import javax.xml.ws.WebServiceProvider;
> import javax.xml.ws.Service.Mode;
> @Resource
>
>
>
> @ServiceMode(value=Mode.MESSAGE)
> @WebServiceProvider
>
>
> public class RicezioneContenutiApplicativiWS implements
> Provider<SOAPMessage>{
> WebServiceContext wsContext;
>
> public SOAPMessage invoke(SOAPMessage request){
> try{
> System.out.println("Test write resume");
> System.out.println("SOAPMessage class : " +
> request.getClass().getName());
>
> File file = new File("/home/cencio/SOAPMessage.msg");
> FileOutputStream fos = new FileOutputStream(file);
> request.writeTo(fos);
> fos.close();
>
> Iterator it = request.getMimeHeaders().getAllHeaders();
> while(it.hasNext()){
> MimeHeader mh = (MimeHeader) it.next();
> System.out.println("Header >> " + mh.getName() + " : " +
> mh.getValue());
> }
> }
> catch(Exception e){
> System.out.println("Qualcosa è andato storto!! : " + e.toString());
> }
> return request;
> }
> }
>
>
>
>
> I really need some help -.-
>
> Thx!
>
>
--
View this message in context: http://www.nabble.com/SOAPMessage-with-Attachment-service-problems-tf4628726.html#a13231677
Sent from the cxf-user mailing list archive at Nabble.com.