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">
<wsdlart name="FileInfo" type="mb:ArrayOfFilesInfoType"/>
<wsdlart name="File" type="mb:ArrayOfFilesType"/>
</wsdl:message>
<wsdl:message name="FileSoapOut">
<wsdlart name="ResponseFiles" type="mb:ArrayOfFilesType"/>
<wsdlart name="ResponseFilesInfo" type="mb:ReturnFileInfo"/>
</wsdl:message>
<wsdlortType name="FileSoap">
<wsdlperation name="SendFile">
<wsdl:input message="mb:FileSoapIn"/>
<wsdlutput message="mb:FileSoapOut"/>
</wsdlperation>
</wsdlortType>
<wsdl:binding name="FileSoap" type="mb:FileSoap">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="SendFile">
<soapperation soapAction="http://mate.bestek.com/SendFile"
style="document"/>
<wsdl:input>
<mime:multipartRelated>
<mimeart>
<soap:body parts="FileInfo" use="literal"/>
</mimeart>
<mimeart>
<mime:content part="File" type="application/octet-stream"/>
</mimeart>
</mime:multipartRelated>
</wsdl:input>
<wsdlutput>
<mime:multipartRelated>
<mimeart>
<soap:body parts="ResponseFilesInfo" use="literal"/>
</mimeart>
<mimeart>
<mime:content part="ResponseFiles"
type="application/octet-stream"/>
</mimeart>
</mime:multipartRelated>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="FileLoader">
<wsdlort name="FileSoap" binding="mb:FileSoap">
<soap:address location="http://localhost:8080/"/>
</wsdlort>
</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?
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">
<wsdlart name="FileInfo" type="mb:ArrayOfFilesInfoType"/>
<wsdlart name="File" type="mb:ArrayOfFilesType"/>
</wsdl:message>
<wsdl:message name="FileSoapOut">
<wsdlart name="ResponseFiles" type="mb:ArrayOfFilesType"/>
<wsdlart name="ResponseFilesInfo" type="mb:ReturnFileInfo"/>
</wsdl:message>
<wsdlortType name="FileSoap">
<wsdlperation name="SendFile">
<wsdl:input message="mb:FileSoapIn"/>
<wsdlutput message="mb:FileSoapOut"/>
</wsdlperation>
</wsdlortType>
<wsdl:binding name="FileSoap" type="mb:FileSoap">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="SendFile">
<soapperation soapAction="http://mate.bestek.com/SendFile"
style="document"/>
<wsdl:input>
<mime:multipartRelated>
<mimeart>
<soap:body parts="FileInfo" use="literal"/>
</mimeart>
<mimeart>
<mime:content part="File" type="application/octet-stream"/>
</mimeart>
</mime:multipartRelated>
</wsdl:input>
<wsdlutput>
<mime:multipartRelated>
<mimeart>
<soap:body parts="ResponseFilesInfo" use="literal"/>
</mimeart>
<mimeart>
<mime:content part="ResponseFiles"
type="application/octet-stream"/>
</mimeart>
</mime:multipartRelated>
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="FileLoader">
<wsdlort name="FileSoap" binding="mb:FileSoap">
<soap:address location="http://localhost:8080/"/>
</wsdlort>
</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?