You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mark Leone <mi...@cox.net> on 2005/07/02 07:44:43 UTC

SOAP Attachments -- Example Doesn't Work

I have Axis 1.2 RC3 in Tomcat 5.5.8, and I tried to call the sample 
attachments service (samples.attachments.EchoAttachmentsService).with 
the sample client (samples.attachments.EchoAttachment). I deployed the 
service with the attachdeploy.wsdd in the samples/attachments directory, 
and it seemed to be successful. The Axis servlet displays the service in 
the list of deployed services, but when I click on the wsdl link I get 
the following:


    AXIS error

Sorry, something seems to have gone wrong... here are the details:

Fault - ; nested exception is: 
	WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'urn:EchoAttachmentsService'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.: 

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'urn:EchoAttachmentsService'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.: 
 faultActor: 
 faultNode: 
 faultDetail: 

I tried to run the client anyway, and I get the following in the Tomcat log

In echo
Received "javax.activation.DataHandler".
- java.io.IOException:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/related; type="text/xml"; start="<4797A406CB66DEBB0324404AE4600781>"; 
	boundary="----=_Part_0_17700115.1120281455852"
	at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:841)
	at javax.activation.DataHandler.writeTo(DataHandler.java:295)
	at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1209)
	at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1611)
	at org.apache.axis.attachments.MimeUtils.writeToMultiPartStream(MimeUtils.java:238)
	at org.apache.axis.attachments.AttachmentsImpl.writeContentToStream(AttachmentsImpl.java:500)
	at org.apache.axis.Message.writeTo(Message.java:447)
	at org.apache.axis.transport.http.AxisServlet.sendResponse(AxisServlet.java:1018)
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:895)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	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:825)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:743)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Unknown Source)

I'd like to know what's going wrong here, but I'm also trying to figure out how attachments are implemented in this example,
because it seems to be not what I expected. When I generated a wsdl file using WSDL2Java from the service class, the wsdl didn't
include mime:multipart/related elements in the bindings, as the wsdl spec shows for handling attachmetns. The wsdl just showed
a DataHandler object and a w3c.org.DOM.Document object being passed in both directions.

Then when I looked at the source code I saw that there are three methods: echo() and echoDir() accept and return DataHandler
and DataHandler[] objects, respectively, and this is consistent with what's in the typeMapping in the wsdd. But there's also
a method attachments() which accepts and returns a org.w3c.DOM.Document object. The implementation shows that the Document
has href attributes that point to other MIME parts, which is what I was expecting to see in the wsdl. But the attachments()
method isn't called by the client at all, and there is no mention of a MIME structure in the wsdl for this method. Is this 
method called by the DataHandler objects that are passed via echo() and echoDir()? If not, how does it get called?
I know it does, because it threw a "no support for attachments" excpetion when I didn't have mail.jar in the classpath. Can
anyone point me to any documentation on how attachments are implemented in Axis?

-Mark