Hi,

I've got a service defined that is transferring an java.awt.Image using SOAP 
with attachments.

Here is the WSDL:

<wsdl:definitions name="ImageryService"
targetNamespace="http://examples.com/ImageService";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:types="http://examples.com/ImageService/types";
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
xmlns:tns="http://examples.com/ImageService";>
<wsdl:types>

<!-- types namespace for this service -->
<xsd:schema targetNamespace="http://examples.com/ImageService/types";
xmlns:types="http://examples.com/ImageService/types";>

<!-- Wrapper elements to provide unique signatures for the operations -->
<xsd:element name="addImage">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="types:ImageInfo"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="replaceImage">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="types:ImageInfo"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getImage">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="types:ImageInfo"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ImageInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="id" type="xsd:int"/>
<xsd:element name="lat" type="xsd:double"/>
<xsd:element name="lon" type="xsd:double"/>
<xsd:element name="time" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Status return for the operations. -->
<xsd:element name="status" type="xsd:string" />
</xsd:schema>
</wsdl:types>



<!-- Input for the operations. -->
<wsdl:message name="addImageRequest">
<!-- first part is the SOAP body -->
<wsdl:part name="body" element="types:addImage"/>
<!-- second part is the attachment -->
<wsdl:part name="image" type="xsd:base64Binary"/>
</wsdl:message>
<wsdl:message name="addImageResponse">
<wsdl:part name="body" element="types:status"/>
</wsdl:message>

<wsdl:message name="getImageRequest">
<!-- first part is the SOAP body -->
<wsdl:part name="body" element="types:getImage"/>
</wsdl:message>
<wsdl:message name="getImageResponse">
<wsdl:part name="status" element="types:status"/>
<!-- second part is the attachment -->
<wsdl:part name="image" type="xsd:base64Binary"/>
</wsdl:message>


<wsdl:message name="replaceImageRequest">
<wsdl:part name="body" element="types:replaceImage"/>
<wsdl:part name="newImage" type="xsd:base64Binary"/>
</wsdl:message>
<wsdl:message name="replaceImageResponse">
<wsdl:part name="status" element="types:status"/>
</wsdl:message>
<wsdl:portType name="ImageryServicePortType">
<wsdl:operation name="addImage">
<wsdl:input message="tns:addImageRequest"/>
<wsdl:output message="tns:addImageResponse"/>
</wsdl:operation>
<wsdl:operation name="getImage">
<wsdl:input message="tns:getImageRequest"/>
<wsdl:output message="tns:getImageResponse"/>
</wsdl:operation>
<wsdl:operation name="replaceImage">
<wsdl:input message="tns:replaceImageRequest"/>
<wsdl:output message="tns:replaceImageResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ImageryServiceBinding" type="tns:ImageryServicePortType">
<soap:binding style="wrapped" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="addImage">
<soap:operation soapAction="addImage"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soap:body parts="body" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="image" type="image/gif"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getImage">
<soap:operation soapAction="getImage"/>
<wsdl:input> 
<soap:body parts="body" use="literal"/>
</wsdl:input>
<wsdl:output>
<mime:multipartRelated>
<mime:part>
<soap:body parts="status" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="image" type="image/gif"/>
</mime:part>
</mime:multipartRelated>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replaceImage">
<soap:operation soapAction="replaceImage"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soap:body parts="body" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="newImage" type="image/gif"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ImageryService">
<wsdl:port name="ImageryService" binding="tns:ImageryServiceBinding">
<soap:address location="http://192.168.1.1:8080/axis/services/ImageryService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

It worked fine when the Image was of type image/jpeg (the wsdl defined the type 
as image/jpeg), but now that I am trying to send a gif image, I see that the 
client is still setting the Content-Type in the mime attachment to image/jpeg.

>From what I can see from stepping through the 
>org.apache.axis.encoding.ser.ImageDataHandlerSerialize.serialize() method, 
>when the Data Handler is created the content type for the ImageDataSource() 
>object is not specified and so it defaults to image/jpeg.

Have I missed something that will allow support for gif (or other 
content-types)? 

regards
Karl

Reply via email to