Hello there,
I created a simple function that returns an object type of enum.
It is very simple function:
public static Gender getGender() {
return Gender.MALE;
}
but when I opened the page from a browser
http://localhost:8080/OpenApi/services/TestApi10/getGender
it generates an error like
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">
java.lang.RuntimeException: org.apache.axis2.AxisFault: Mapping qname
not fond for the package: org.apache.catalina.loader
</soapenv:Text>
</soapenv:Reason>
If I return any other objects, it works fine.
Am I not supposed to Enum type?
I think this is an error in Axis2.
By the way, I would not like to use Type-safe enum.
It has its own problem.
I have attached a source code and services.xml (TestApi.xml) and wsdl
(TestApi10.xml - created by Axis2 on the fly).
By the way, if I create a client using WSDL2Java
wsdl2java.bat -or -g -Eofv -uw -u -uri
http://localhost:8080/OpenApi/services/UserApi10?wsdl
I get a warning like this:
[WARN] Type {http://www.w3.org/2001/XMLSchema}Enum missing!
How do I get rid of this?
Also WSDL2Java doesn't create a enum type for Gender. Rather it is a regular
class.
Which I have to use it like
Gender g = new Gender();
g.getFEMALE();
This didn't make a sense to me.
As a comparison, .NET create an enum type correctly.
In WSDL that .NET create, it is a just simpleType with restrictions.
I don't know if that caused the problem or not.
I would appreciate if you could give any help on this.
Thank you,
- Leon
<serviceGroup>
<service name="TestApi10" scope="application">
<description>Test Services Api - v1.0</description>
<messageReceivers>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</messageReceivers>
<parameter name="ServiceClass" locked="false">
com.strands.openapi.services.user.TestApi10
</parameter>
</service>
</serviceGroup>
package com.strands.openapi.services.user;
import com.strands.openapi.types.user.Gender;
public class TestApi10 {
public static Gender getGender() {
return Gender.MALE;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://user.types.openapi.strands.com/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://user.services.openapi.strands.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://user.services.openapi.strands.com">
<wsdl:documentation>TestApi10</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ns="http://user.services.openapi.strands.com" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://user.services.openapi.strands.com">
<xs:element name="getGenderResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ns1:Gender"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:ax27="http://user.types.openapi.strands.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://user.types.openapi.strands.com/xsd">
<xs:complexType name="Gender">
<xs:complexContent>
<xs:extension base="xs:Enum">
<xs:sequence>
<xs:element minOccurs="0" name="FEMALE" nillable="true" type="ax27:Gender"/>
<xs:element minOccurs="0" name="MALE" nillable="true" type="ax27:Gender"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getGenderRequest"/>
<wsdl:message name="getGenderResponse">
<wsdl:part name="parameters" element="ns0:getGenderResponse"/>
</wsdl:message>
<wsdl:portType name="TestApi10PortType">
<wsdl:operation name="getGender">
<wsdl:input message="ns0:getGenderRequest" wsaw:Action="urn:getGender"/>
<wsdl:output message="ns0:getGenderResponse" wsaw:Action="urn:getGenderResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestApi10SOAP11Binding" type="ns0:TestApi10PortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getGender">
<soap:operation soapAction="urn:getGender" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TestApi10SOAP12Binding" type="ns0:TestApi10PortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getGender">
<soap12:operation soapAction="urn:getGender" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TestApi10HttpBinding" type="ns0:TestApi10PortType">
<http:binding verb="POST"/>
<wsdl:operation name="getGender">
<http:operation location="TestApi10/getGender"/>
<wsdl:input>
<mime:content type="text/xml" part="getGender"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getGender"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestApi10">
<wsdl:port name="TestApi10SOAP11port_http" binding="ns0:TestApi10SOAP11Binding">
<soap:address location="http://localhost:8080/OpenApi/services/TestApi10"/>
</wsdl:port>
<wsdl:port name="TestApi10SOAP12port_http" binding="ns0:TestApi10SOAP12Binding">
<soap12:address location="http://localhost:8080/OpenApi/services/TestApi10"/>
</wsdl:port>
<wsdl:port name="TestApi10Httpport" binding="ns0:TestApi10HttpBinding">
<http:address location="http://localhost:8080/OpenApi/services/TestApi10"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
package com.strands.openapi.types.user;
public enum Gender {
MALE,
FEMALE
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]