Got it.

 

Thank you, Guenter J

Helen

 

 


From: Grossberger, Guenter [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 13, 2005 11:26 AM
To: [email protected]
Subject: RE: Help -- Implement Enumeration on Client Side

 

All three code lines do the same and refer to the same immutable object instance:

 

SummaryRequestType s1 = SummaryRequestType.getValue("SUMMARY");

SummaryRequestType s2 = SummaryRequestType.getValue(SummaryRequestType._value3);

SummaryRequestType s3 = SummaryRequestType.value3;

 

Unfortunately Axis names the generated constants valueN and the string constants _valueN. It would be easier with something like SummaryRequestType.SUMMARY.

 

Best regards,

--
DI Günter Grossberger
Consultant             Tel: +43 1 329 50 161
Software AG Österreich Fax: +43 1 329 50 171
Guglgasse 7-9          GSM: +43 676 833 29 261
1030 Wien             
http://www.softwareag.com/austria

 

 


From: Zhixiang He [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 13, 2005 5:12 PM
To: [email protected]
Subject: Help -- Implement Enumeration on Client Side

Hi,

 

Now I have an enumeration class which is generated by WSDL2Java. My questions is how to create an instance for this enumeration class.

 

Since the enumeration class has protected constructor, I cannot use “SummaryRequestType requestType = new SummaryRequestType("SUMMARY ");” to create an instance. It says “SummaryRequestType(java.lang.String) has protected access in …….”

 

I did some search on this mail list, but still cannot get some clue. Could someone give me a hint? Any info will be appreciated.

 

Thanks,

Helen

 

 

 

Here is the enumeration and client file.

 

package com.i3archive.www.RID_xsd1;

 

public class SummaryRequestType implements java.io.Serializable {

    private java.lang.String _value_;

    private static java.util.HashMap _table_ = new java.util.HashMap();

 

    // Constructor

    protected SummaryRequestType(java.lang.String value) {

        _value_ = value;

        _table_.put(_value_,this);

    }

 

    public static final java.lang.String _value1 = "SUMMARY-RADIOLOGY";

    public static final java.lang.String _value2 = "SUMMARY-CARDIOLOGY";

    public static final java.lang.String _value3 = "SUMMARY";

    public static final SummaryRequestType value1 = new SummaryRequestType(_value1);

    public static final SummaryRequestType value2 = new SummaryRequestType(_value2);

    public static final SummaryRequestType value3 = new SummaryRequestType(_value3);

    public java.lang.String getValue() { return _value_;}

    public static SummaryRequestType fromValue(java.lang.String value)

          throws java.lang.IllegalArgumentException {

        SummaryRequestType enumeration = (SummaryRequestType)

            _table_.get(value);

        if (enumeration==null) throw new java.lang.IllegalArgumentException();

        return enumeration;

    }

    public static SummaryRequestType fromString(java.lang.String value)

          throws java.lang.IllegalArgumentException {

        return fromValue(value);

    }

    public boolean equals(java.lang.Object obj) {return (obj == this);}

    public int hashCode() { return toString().hashCode();}

    public java.lang.String toString() { return _value_;}

    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}

    public static org.apache.axis.encoding.Serializer getSerializer(

           java.lang.String mechType,

           java.lang.Class _javaType, 

           javax.xml.namespace.QName _xmlType) {

        return

          new org.apache.axis.encoding.ser.EnumSerializer(

            _javaType, _xmlType);

    }

    public static org.apache.axis.encoding.Deserializer getDeserializer(

           java.lang.String mechType,

           java.lang.Class _javaType, 

           javax.xml.namespace.QName _xmlType) {

        return

          new org.apache.axis.encoding.ser.EnumDeserializer(

            _javaType, _xmlType);

    }

    // Type metadata

    private static org.apache.axis.description.TypeDesc typeDesc =

        new org.apache.axis.description.TypeDesc(SummaryRequestType.class);

 

    static {

        typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.i3archive.com/RID.xsd1", "summaryRequestType"));

    }

    /**

     * Return type metadata object

     */

    public static org.apache.axis.description.TypeDesc getTypeDesc() {

        return typeDesc;

    }

 

}

 

 

package com.i3archive.www.RID_wsdl;

 

import org.apache.axis.AxisFault;

import org.apache.axis.utils.Options;

import javax.xml.namespace.QName;

import javax.xml.rpc.ParameterMode;

                                          

public class Client

{

    public static void main(String [] args) throws Exception

    {

        com.i3archive.www.RID_xsd1.SummaryRequestType requestType = new com.i3archive.www.RID_xsd1.SummaryRequestType("SUMMARY");

            java.lang.String patientID = "whoever";

            java.util.Calendar lowerDateTime = java.util.Calendar.getInstance();

            java.util.Calendar upperDateTime = java.util.Calendar.getInstance();

            org.apache.axis.types.PositiveInteger mostRecentResults = new org.apache.axis.types.PositiveInteger("12");

 

        RID  service = new RIDLocator();

        IHERetrieveForDisplayHttpGet bean = service.getRIDPort();

      

        System.out.println(bean.retrieveSummaryInfo(requestType, patientID, lowerDateTime, upperDateTime, mostRecentResults));

    }

}

Reply via email to