users@jax-rpc.java.net

Axis, SwA, DataContentHandlers

From: robert rowntree <rowntreerob_at_yahoo.com>
Date: Sun, 12 Dec 2004 18:29:56 -0800 (PST)

im running Axis 1.2 and JDK1.4.2 and have a problem
with an RPC WebService using Attachments where the
input parm is an Array of DataHandlers.

Originally, when all DataHandlers in the input parm's
array were created from FileDataSource , it was OK. It
was just like all the attachments samples.

When i added an additional DataHandler, instantiated
from a StreamSource, it broke on the client side with
an IO Exception :

+++++++++++++
java.io.IOException: "text/xml" DataContentHandler
requires String object, was given object of type class
javax.xml.transform.stream.StreamSource
-------------

Additional details are below:
 -the wsdl
 -the typemapping
 -code putting something in DH
 - TCPMON for client side message
 - Stack trace


+++++++++++++++++++
 <wsdl:message name="postFileHoprRequest">
  <wsdl:part name="attachmentsfh"
type="apachesoap:ArrayOf_apachesoap_DataHandler" />
  </wsdl:message>
--------------------
typemapping...
+++++++++++++++
  <operation name="postFileHopr"
returnQName="returnqname" returnType="ns1:DataHandler"
>
    <parameter name="attachmentsfh"
type="ns1:ArrayOf_apachesoap_DataHandler"/>
  </operation>

  <typeMapping
   
deserializer="org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory"
   
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
   
languageSpecificType="java:javax.activation.DataHandler"

    qname="ns1:DataHandler"
   
serializer="org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory"
    
  />
--------------
java code for new DataHandler
++++++++++++++
           Object obj = pipedinputstream;
                                      
        dhList.add(new DataHandler(new StreamSource(
(InputStream) obj), "text/xml"));

--------------
tcpmon client message on the wire
++++++++++++++

POST /axis/services/urn:EchoAttachmentsService
HTTP/1.0

Content-Type: multipart/related; type="text/xml";
start="<49499D18AFBEEC6D67CADA09E49AA803>";
boundary="----=_Part_0_33385450.1102900625825"

Accept: application/soap+xml, application/dime,
multipart/related, text/*

User-Agent: Axis/1.2RC1

Host: localhost:3555

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: ""

Content-Length: 42415





------=_Part_0_33385450.1102900625825

Content-Type: text/xml; charset=UTF-8

Content-Transfer-Encoding: binary

Content-Id: <49499D18AFBEEC6D67CADA09E49AA803>



<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:postFileHopr
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:EchoAttachmentsService"><attachmentsfh
soapenc:arrayType="ns2:DataHandler[3]"
xsi:type="soapenc:Array"
xmlns:ns2="http://xml.apache.org/xml-soap"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><item
href="cid:89EF4B8B73930E904A744AF1E346F98C"
xsi:type="ns2:DataHandler"/><item
href="cid:E26221480A2EEB571D68CAFDB37DBEEB"
xsi:type="ns2:DataHandler"/><item
href="cid:4440596DFA9DBE02B261554617E4C8AF"
xsi:type="ns2:DataHandler"/></attachmentsfh></ns1:postFileHopr></soapenv:Body></soapenv:Envelope>

------=_Part_0_33385450.1102900625825

Content-Type: text/xml

Content-Transfer-Encoding: binary

Content-Id: <89EF4B8B73930E904A744AF1E346F98C>
-----------------
  stack trace
+++++++++++++++++
- java.io.IOException:
java.io.IOException: "text/xml" DataContentHandler
requires String object, was g
iven object of type class
javax.xml.transform.stream.StreamSource
        at
com.sun.mail.handlers.text_plain.writeTo(text_plain.java:97)
        at
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:849)
        at
javax.activation.DataHandler.writeTo(DataHandler.java:305)
        at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
        at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:635)
        at
javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233)
        at
com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:68)
        at
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:849)
        at
javax.activation.DataHandler.writeTo(DataHandler.java:305)
        at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
        at
javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1527)
        at org.apache.axis.attachments.MimeUtils.writeToMultiPartStream(MimeUtil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net