axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Woinoski <micha...@pineneedleconsulting.com>
Subject MIME type for DataHandler wrapping a DOMSource
Date Tue, 24 Jun 2003 20:52:27 GMT
For a JAX-RPC call in Axis 1.1, what MIME type should I use for a DataHandler
that is wrapping a javax.xml.transform.Source? "text/xml" causes an exception.
Or should I be using a type other than Source for handling xml?

My goal is to use stubs generated by WSDL2Java to pass an XML document to a
JAX-RPC service. I have a service operation that accepts a DataHandler
parameter. The WSDL generated by Java2WSDL references the apachesoap:DataHandler
type, and WSDL2Java generates reasonable-looking stubs. Here's a snippet from
the client:

  org.w3c.dom.Document doc = ... // create Document
  javax.xml.transform.Source source = 
     new javax.xml.transform.dom.DOMSource(doc);
  DataHandler handler = new DataHandler(source, "text/xml");
  String confirm = serviceStub.sendPurchaseOrder(handler);

The JAX-RPC 1.0 spec says that a DataHandler wrapping a Source should use the
type "text/xml" or "application/xml". This client code works with JWSDP, but
Axis throws this exception when the DataHandler's MIME type is "text/xml":

  java.io.IOException: "text/xml" DataContentHandler requires String object, 
  was given object of type class javax.xml.transform.dom.DOMSource

And with "application/xml" Axis throws this:

  javax.activation.UnsupportedDataTypeException: no object DCH for MIME type 
    application/xml

Is this supported in Axis 1.1? If not, how do I pass XML? (I could use an
AttachmentPart with a Call, but I'd prefer to use WSDL2Java).

Thanks,
Mike

-- 

Mike Woinoski                      Pine Needle Consulting
mailto:michaelw@pineneedleconsulting.com

Mime
View raw message