Attachments in AXIS

M

mate.bestek

Oj,

i wan't my webservice to return two parameters: an array of files
(multiple files) and an array of info about files (file name,
mimetype...). I'm using wsdl2java to generate the server skeleton and
the client stub. The method signature that axis generates looks like
this:

sendFile(com.bestek.mate.FileInfoType[] fileInfo,
org.apache.axis.attachments.OctetStream[] file,
org.apache.axis.holders.OctetStreamHolder[] responseFiles,
com.bestek.mate.holders.ReturnFileInfoHolder responseFilesInfo) throws
java.rmi.RemoteException

My wsdl looks like this:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s1="http://www.crea.si/Schemas/2004/Document"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mb="http://mate.bestek.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://mate.bestek.com">
<wsdl:types>
<xs:schema targetNamespace="http://mate.bestek.com">
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xs:complexType name="ArrayOfFilesType">
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="file"
type="xs:hexBinary"/>
</xs:sequence>
<xs:attribute ref="soapenc:arrayType"
wsdl:arrayType="xs:hexBinary[]"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ReturnFileInfo">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Podatki"
type="mb:FileInfoType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfFilesInfoType">
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Podatki"
type="mb:FileInfoType"/>
</xs:sequence>
<xs:attribute ref="soapenc:arrayType"
wsdl:arrayType="mb:FileInfoType[]"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="FileInfoType">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="fileName"
type="xs:string"/>
<xs:element minOccurs="1" maxOccurs="1" name="fileLength"
type="xs:string"/>
<xs:element minOccurs="1" maxOccurs="1" name="mimeType"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="FileSoapIn">
<wsdl:part name="FileInfo" type="mb:ArrayOfFilesInfoType"/>
<wsdl:part name="File" type="mb:ArrayOfFilesType"/>
</wsdl:message>
<wsdl:message name="FileSoapOut">
<wsdl:part name="ResponseFiles" type="mb:ArrayOfFilesType"/>
<wsdl:part name="ResponseFilesInfo" type="mb:ReturnFileInfo"/>
</wsdl:message>
<wsdl:portType name="FileSoap">
<wsdl:eek:peration name="SendFile">
<wsdl:input message="mb:FileSoapIn"/>
<wsdl:eek:utput message="mb:FileSoapOut"/>
</wsdl:eek:peration>
</wsdl:portType>
<wsdl:binding name="FileSoap" type="mb:FileSoap">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:eek:peration name="SendFile">
<soap:eek:peration soapAction="http://mate.bestek.com/SendFile"
style="document"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soap:body parts="FileInfo" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="File" type="application/octet-stream"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdl:eek:utput>
<mime:multipartRelated>
<mime:part>
<soap:body parts="ResponseFilesInfo" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="ResponseFiles"
type="application/octet-stream"/>
</mime:part>

</mime:multipartRelated>
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>
<wsdl:service name="FileLoader">
<wsdl:port name="FileSoap" binding="mb:FileSoap">
<soap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


The problem is, that in the client stub code axis generates this:

try {
responseFiles.value =
(org.apache.axis.attachments.OctetStream[]) _output.get(new
javax.xml.namespace.QName("", "ResponseFiles"));
} catch (java.lang.Exception _exception) {
responseFiles.value =
(org.apache.axis.attachments.OctetStream[])
org.apache.axis.utils.JavaUtils.convert(_output.get(new
javax.xml.namespace.QName("", "ResponseFiles")), byte[][].class);
}


As you can see here, responseFile.value doesn't exist !!!

Can anyone help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top