You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis1-java-user@axis.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2010/11/10 18:38:16 UTC
Is it possible to use a Enum as a parameter?
Hello all,
I'm using Axis 1.4, and I'm trying to use a Enum as a parameter for a
webservices. I've the following class:
public class BoxWebService {
public boolean doUpload(MyEnum by,String userName, String contentType,
String fileName,byte[] content){
return false;
}
}
The enum MyEnum is as follows:
public enum MyEnum {
_USER,_SYSTEM,_PUBLICATIONS_MANAGER;
}
And I'm using the following wsdd to deploy the service:
<?xml version="1.0" ?>
<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="DocumentService.ws" provider="java:RPC">
<!-- Nombre de la clase que implementa los metodos expuestos -->
<parameter name="className"
value="com.spb.eco.modules.box.controller.webservice.BoxWebService"/>
<parameter name="dotNetSoapEncFix" value="true"/>
<!-- Expone todos los metodos como visibles desde el exterior -->
<parameter name="allowedMethods" value="doUpload"/>
<parameter name="wsdlTargetNamespace" value="wsdl.test"/>
<typeMapping
xmlns:ns="urn:wsdl.test"
qname="ns:role"
type="java:com.spb.eco.services.box.util.MyEnum"
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</service>
<handler name="LocalResponder"
type="java:org.apache.axis.transport.local.LocalResponder"/>
<handler name="URLMapper"
type="java:org.apache.axis.handlers.http.URLMapper"/>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler
type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>
<parameter name="qs:list"
value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs:wsdl"
value="org.apache.axis.transport.http.QSWSDLHandler"/>
<parameter name="qs.list"
value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs.method"
value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs:method"
value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs.wsdl"
value="org.apache.axis.transport.http.QSWSDLHandler"/>
</transport>
<transport name="local">
<responseFlow>
<handler type="LocalResponder"/>
</responseFlow>
</transport>
</deployment>
But the WSDL generated has not restriction over MyEnum. What I'm doing
wrong? Is it possible to use a enum as a parameter?:
<?xml version="1.0" encoding="UTF-8" ?>
- <#12c342dab9678384_12c34283f3815408_> <wsdl:definitions targetNamespace="
*wsdl.test*" xmlns:apachesoap="*http://xml.apache.org/xml-soap*" xmlns:impl
="*wsdl.test*" xmlns:intf="*wsdl.test*" xmlns:soapenc="*
http://schemas.xmlsoap.org/soap/encoding/*"
xmlns:tns1="*urn:wsdl.test*"xmlns:wsdl
="*http://schemas.xmlsoap.org/wsdl/*" xmlns:wsdlsoap="*
http://schemas.xmlsoap.org/wsdl/soap/*" xmlns:xsd="*
http://www.w3.org/2001/XMLSchema*">
- <#12c342dab9678384_12c34283f3815408_> <!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
- <#12c342dab9678384_12c34283f3815408_> <wsdl:types>
- <#12c342dab9678384_12c34283f3815408_> <schema targetNamespace="*
urn:wsdl.test*" xmlns="*http://www.w3.org/2001/XMLSchema*">
<import namespace="*http://schemas.xmlsoap.org/soap/encoding/*" />
- <#12c342dab9678384_12c34283f3815408_> <simpleType name="*role*">
<restriction base="*xsd:string*" />
</simpleType>
</schema>
</wsdl:types>
- <#12c342dab9678384_12c34283f3815408_> <wsdl:message name="*
doUploadResponse*">
<wsdl:part name="*doUploadReturn*" type="*xsd:boolean*" />
</wsdl:message>
- <#12c342dab9678384_12c34283f3815408_> <wsdl:message name="*
doUploadRequest*">
<wsdl:part name="*by*" type="*tns1:role*" />
<wsdl:part name="*userName*" type="*soapenc:string*" />
<wsdl:part name="*contentType*" type="*soapenc:string*" />
<wsdl:part name="*fileName*" type="*soapenc:string*" />
<wsdl:part name="*content*" type="*soapenc:base64Binary*" />
</wsdl:message>
- <#12c342dab9678384_12c34283f3815408_> <wsdl:portType name="*BoxWebService
*">
- <#12c342dab9678384_12c34283f3815408_> <wsdl:operation
name="*doUpload*"parameterOrder
="*by userName contentType fileName content*">
<wsdl:input message="*impl:doUploadRequest*" name="*doUploadRequest*" />
<wsdl:output message="*impl:doUploadResponse*" name="*doUploadResponse*"/>
</wsdl:operation>
</wsdl:portType>
- <#12c342dab9678384_12c34283f3815408_> <wsdl:binding name="*
DocumentService.wsSoapBinding*" type="*impl:BoxWebService*">
<wsdlsoap:binding style="*rpc*" transport="*
http://schemas.xmlsoap.org/soap/http*" />
- <#12c342dab9678384_12c34283f3815408_> <wsdl:operation name="*doUpload*">
<wsdlsoap:operation soapAction="" />
- <#12c342dab9678384_12c34283f3815408_> <wsdl:input name="*doUploadRequest*
">
<wsdlsoap:body encodingStyle="*http://schemas.xmlsoap.org/soap/encoding/*
" namespace="*http://webservice.controller.box.modules.eco.spb.com*" use="*
encoded*" />
</wsdl:input>
- <#12c342dab9678384_12c34283f3815408_> <wsdl:output name="*
doUploadResponse*">
<wsdlsoap:body encodingStyle="*http://schemas.xmlsoap.org/soap/encoding/*
" namespace="*wsdl.test*" use="*encoded*" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <#12c342dab9678384_12c34283f3815408_> <wsdl:service name="*
BoxWebServiceService*">
- <#12c342dab9678384_12c34283f3815408_> <wsdl:port binding="*
impl:DocumentService.wsSoapBinding*" name="*DocumentService.ws*">
<wsdlsoap:address location="*
http://naboo:8080/prototype-miamara/services/DocumentService.ws*" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>