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 Rolando Pablos Sánchez <rp...@tid.es> on 2002/12/16 15:26:18 UTC
Attachment with attributes
I am working with attachment and I am using the DataHandler object for this purpose.
In fact, I am using the following line in my WSDL file in order to get the correct stubs:
[...]
<xs:element name="Content" type="apachesoap:DataHandler" minOccurs="0" maxOccurs="unbounded"/>
[...]
It is OK. I get an array of DataHandler. But what I want is to add 2 attributes to this element. I have tried several combinations with the XML schema.
I thought that the following was going to work:
<xs:element name="Content" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="apachesoap:DataHandler">
<xs:attribute name="type" type="tns:ContentQuality"/>
<xs:attribute name="allowAdaptations" type="xs:boolean" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
It is just a extension of simple type (http://www.w3.org/TR/xmlschema-0/#complexTfromSimpleT ) to add attributes
It generates a class extending SimpleType, and axis thinks that always is possible the String representation of the value. In few words, what you get is a call to the toString() method in the DataHandler class.
So my question is how can I get a element that is an attachment and also has attributes. The result would be similar to this:
<Content href="cid:XXX" myatt1="XXX" myatt2="XXX"/>
Thank you.
P.D: Is the DataHandler class the only way to work with attachments?