cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cencio <cencio1...@gmail.com>
Subject Re: SOAPMessage with Attachment service problems
Date Tue, 16 Oct 2007 16:31:08 GMT

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.


Mime
View raw message