Hi List,

sorry for disturbing again. But I still stuck with the problem using Java enum 
types with axis2 v1.4 and ADB binding. So my first question, is there somebody 
who managed to get such a setup working? 

The second point is, that I modified the generated wsdl file to reflect the 
enum type DecisionYesNo in a proper way (or at least what i think is the proper 
way) like this ...

<xs:simpleType name="DecisionYesNo">
  <xs:restriction base="xs:string">
    <xs:enumeration value="YES"/>
    <xs:enumeration value="NO"/>
  </xs:restriction>
</xs:simpleType>


The client stub generated by the wsdl2java script based on this modified wsdl 
file seems to be ok, it mapped the enum types to static final String variables 
like this .... 


protected DecisionYesNo(java.lang.String value, boolean isRegisterValue) {
          localDecisionYesNo = value;
          if (isRegisterValue){
              _table_.put(localDecisionYesNo, this);
           }
}
                            
public static final java.lang.String _YES = 
org.apache.axis2.databinding.utils.ConverterUtil.convertToString("YES");
                                
public static final java.lang.String _NO =
org.apache.axis2.databinding.utils.ConverterUtil.convertToString("NO");
                                
public static final DecisionYesNo YES = new DecisionYesNo(_YES,true);

public static final DecisionYesNo NO = new DecisionYesNo(_NO,true);
                            
 .....
                                    
}

But when i use this stub class to communicate with my webservice and setting 
the enum attribute to a specific value, I receive an axis Fault on client side 
and the following exception on server side, which seems to be a deserialization 
problem.

[ERROR] RPCMessageReceiver Exception occurred while trying to invoke service 
method addJobOffer
org.apache.axis2.AxisFault: net.agef.jobexchange.domain.DecisionYesNo
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at 
org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:30)
        at 
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:410)
        at 
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:450)
        at 
org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:722)
        at 
org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:670)
        at 
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:602)
        at 
org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)
        at 
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:188)
        at 
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
        at 
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
        at 
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
        at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
        at 
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:131)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
net.agef.jobexchange.services.internal.JobexchangeFilterImpl.doFilter(JobexchangeFilterImpl.java:166)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.InstantiationException: 
net.agef.jobexchange.domain.DecisionYesNo
        at java.lang.Class.newInstance0(Class.java:340)
        at java.lang.Class.newInstance(Class.java:308)
        at 
org.apache.axis2.engine.DefaultObjectSupplier.getObject(DefaultObjectSupplier.java:28)
        ... 30 more


Any hints are highly appreciated !

Many thanks in advance ...

Andreas


-------- Original Message --------
Subject: Re-2: [AXIS2] how to use enum types (21-Jul-2008 10:30)
From:    [EMAIL PROTECTED]
To:      [EMAIL PROTECTED]

> Hi Amila,
>  
> thanks for your response. Please find attached the wsdl file in question. 
> It was generated using the wsdl2java script included in the axis2 1.4 
> release package under windows xp sp3 with Java 1.6.06 running. I also tried 
> the latest snapshot release with the same results. Any ideas?
>  
> Thank you in andvance!
>  
> Best regards 
>  
> Andreas  
>  
>  
>            
> Subject:  Re: [AXIS2] how to use enum types (20-Jul-2008 11:42) 
> From:     [EMAIL PROTECTED] 
> To:       [EMAIL PROTECTED] 
> 
> #
> On Thu, Jul 17, 2008 at 5:55 PM, <[EMAIL PROTECTED]> wrote:
> 
> 
> Dear Listmembers,
> 
> i'am using axis2 1.4 release version togehter with eclipse version 3.4.0 (
> WST). I have created a webservice from a skeleton class called JobWS. 
> Generating the associated wsdl definition and an appropriate client stub 
> worked like a charm (using eclipse axis2 plugin).
> 
> So far so good, as far as i read, axis2 should support Java5 enum types 
> since the 1.4 release, am i right? But unfortunately this doesn't work for 
> me.
> 
> In detail: My JobWS webservice is working with a Job class which defines 
> among other attributes some enum types. For example:
> 
>    private DecisionYesNo computerSkills;
> 
> My example enum class looks like this:
> 
>   public enum DecisionYesNo implements Serializable{
>           YES, NO
>   }
> 
> The wsdl file generated by java2wsdl (or http://localhost/[CONTEXT]/
> services/JobWS?wsdl option) looks like this: (extract)
> 
> <xs:complexType name="DecisionYesNo">
>   <xs:complexContent>
>        <xs:extension base="xs:Enum">
>                <xs:sequence/>
>        </xs:extension>
>    </xs:complexContent>
> </xs:complexType>
> 
> Which seems to be wrong because all enum values are missing. From what i 
> know about enum representation in xml schema it should look like this:
> 
> <xs:simpleType name="DecisionYesNo">
>   <xs:restriction base="xs:string">
>        <xs:enumeration value="YES"/>
>        <xs:enumeration value="NO"/>
>   </xs:restriction>
> </xs:simpleType>
> 
> But even when i modify the generated wsdl file to reflect the xml structure 
> above, the wsdl2java won't generate a proper client stub.
> 
> wsdl2java tool does support this. Can you please send your wsdl?
> 
> thanks,
> Amila.
> 
> 
> 
> So my question is, has someone expierences in using axis2 in combination 
> with java5 enum types and can give me a hint?
> 
> best regards
> 
> Andreas
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> -- 
> Amila Suriarachchi,
> WSO2 Inc. 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to