It looks like the wsdl generation problem is a feature. I found lots of
messages in the archive about it occurring with the attachments sample
and in some other situations-- no solution was ever provided. The
consensus seemed to be that the service works fine nevertheless.
The runtime exception was a separate problem, apparently a classloading
precedence issue. I corrected it by putting mail.jar and activation.jar
in the same folder. Other solutions mentioned at some other sites were
matching the versions of those two jars and configuring the mailcap
file. Neither of these seemed necessary in my case.
I'd still like to know if anyone has an explanation or can point me to a
link explaining how the attachments sample works.
Also, does anyone know if Axis 1.2 supports generating skeletons and
stubs when SOAP attachments are used? I saw a message from a couple
years ago that that wasn't supported. I'm going to try doing so with a
wsdl built per the wsdl spec on attachments, but I'd like to know if I'm
swinging at a windmill.
-Mark
Mark Leone wrote:
[EMAIL PROTECTED] wrote:
Hi,
do not know if this helps but, it works on
windows 2000, axis 1.2, jdk 1.5.0_01-b08, tomcat 5
- add activation.jar and mail.jar to your classpath
I got it from
set
CLASSPATH=C:\tomcat50-jwsdp\jwsdp-shared\lib\activation.jar;%CLASSPATH%
set CLASSPATH=C:\tomcat50-jwsdp\jwsdp-shared\lib\mail.jar;%CLASSPATH%
Thanks. I do have activation.jar and mail.jar in the classpath. The
runtime error does seem to indicate that a library is missing, while
the WSDLException seems to indicate someting wrong in the wsdd. But
the wsdd is what came with the Axis distribution, and it looks correct
to me. As for a missing library, see below what I have in
AXISCLASSPATH. I use this for classpath when I deploy the service and
when I run the client. BTW, I'm using XP Pro SP2, jdk 1.5, Tomcat
5.5.8, Axis 1.2RC3.
C:\axis-1_2RC3\samples\attachments>set axisclasspath
AXISCLASSPATH=C:\axis-1_2RC3\lib\axis.jar;C:\axis-1_2RC3\lib\commons-discovery.j
ar;C:\axis-1_2RC3\lib\commons-logging.jar;C:\axis-1_2RC3\lib\jaxrpc.jar;C:\axis-
1_2RC3\lib\saaj.jar;C:\axis-1_2RC3\lib\log4j-1.2.8.jar;C:\axis-1_2RC3\lib\xml-ap
is.jar;C:\axis-1_2RC3\lib\xercesImpl.jar;C:\axis-1_2RC3\lib\wsdl4j.jar;C:\axis-1
_2RC3\lib\activation.jar;C:\axis-1_2RC3\lib\mail.jar
- run ant compile
- run
deployit.cmd
- test the client
C:\axis-1_2\samples\attachments>java
samples.attachments.EchoAttachment test.txt
Going to compare the files..
Going to compare the files..
Attachment sent and received ok!
C:\axis-1_2\samples\attachments>
--- On Sat 07/02, Mark Leone < [EMAIL PROTECTED] > wrote:
From: Mark Leone [mailto: [EMAIL PROTECTED]
To: [email protected]
Date: Sat, 02 Jul 2005 01:44:43 -0400
Subject: SOAP Attachments -- Example Doesn't Work
I have Axis 1.2 RC3 in Tomcat 5.5.8, and I tried to call the sample
<br>attachments service
(samples.attachments.EchoAttachmentsService).with <br>the sample
client (samples.attachments.EchoAttachment). I deployed the
<br>service with the attachdeploy.wsdd in the samples/attachments
directory, <br>and it seemed to be successful. The Axis servlet
displays the service in <br>the list of deployed services, but when I
click on the wsdl link I get <br>the following:<br><br><br> AXIS
error<br><br>Sorry, something seems to have gone wrong... here are
the details:<br><br>Fault - ; nested exception is: <br>
WSDLException: faultCode=OTHER_ERROR: Can't find prefix for
'urn:EchoAttachmentsService'. Namespace prefixes must be set on the
Definition object using the addNamespace(...) method.:
<br><br>AxisFault<br> faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException<br>
faultSubcode: <br> 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.: <br> faultActor: <br> faultNode: <br>
faultDetail: <br><br>I tried to run the client anyway, and I get the
following in the Tomcat log<br><br>In echo<br>Received
"javax.activation.DataHandler".<br>-
java.io.IOException:<br>javax.activation.UnsupportedDataTypeException:
no object DCH for MIME type multipart/related; type="text/xml";
start="<4797A406CB66DEBB0324404AE4600781>"; <br>
boundary="----=_Part_0_17700115.1120281455852"<br> at
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:841)<br>
at javax.activation.DataHandler.writeTo(DataHandler.java:295)<br>
at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1209)<br>
at
javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1611)<br>
at
org.apache.axis.attachments.MimeUtils.writeToMultiPartStream(MimeUtils.java:238)<br>
at
org.apache.axis.attachments.AttachmentsImpl.writeContentToStream(AttachmentsImpl.java:500)<br>
at org.apache.axis.Message.writeTo(Message.java:447)<br> at
org.apache.axis.transport.http.AxisServlet.sendResponse(AxisServlet.java:1018)<br>
at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:895)<br>
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)<br>
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)<br>
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)<br>
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)<br>
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br>
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)<br>
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)<br>
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)<br>
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)<br>
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)<br>
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)<br>
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)<br>
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:743)<br>
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)<br>
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)<br>
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)<br>
at java.lang.Thread.run(Unknown Source)<br><br>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,<br>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<br>include
mime:multipart/related elements in the bindings, as the wsdl spec
shows for handling attachmetns. The wsdl just showed<br>a DataHandler
object and a w3c.org.DOM.Document object being passed in both
directions.<br><br>Then when I looked at the source code I saw that
there are three methods: echo() and echoDir() accept and return
DataHandler<br>and DataHandler[] objects, respectively, and this is
consistent with what's in the typeMapping in the wsdd. But there's
also<br>a method attachments() which accepts and returns a
org.w3c.DOM.Document object. The implementation shows that the
Document<br>has href attributes that point to other MIME parts, which
is what I was expecting to see in the wsdl. But the
attachments()<br>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 <br>method called by the DataHandler objects that are passed via
echo() and echoDir()? If not, how does it get called?<br>I know it
does, because it threw a "no support for attachments" excpetion when
I didn't have mail.jar in the classpath. Can<br>anyone point me to
any documentation on how attachments are implemented in
Axis?<br><br>-Mark<br><br><br><br><br><br>
_______________________________________________