You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by MB...@unica.com on 2005/03/02 22:43:25 UTC

Bean with read only property

I'd like to create a Bean with a read only attribute.  However, even after 
creating the appropriate BeanInfo class, I can't see any difference in the 
generated WSDL, and wsdl2java still creates a client side file containing 
a get and a set.

Can anyone tell me what I'm doing wrong, or if my approach is simply 
faulty?

Thanks!

Base bean:
public class Metadata implements Serializable {
        private String offer = "Offer";
        public String getOfferIdentity()
        {
                return(offer);
        }
}

BeanInfo:
public class MetadataBeanInfo extends SimpleBeanInfo {
        public PropertyDescriptor[] getPropertyDescriptors() {
            try { 
                PropertyDescriptor offerIdentity = 
                        new PropertyDescriptor("offerIdentity", 
Metadata.class, 
                                                       "getOfferIdentity", 
null);
                PropertyDescriptor liszt[] = {
                                offerIdentity
                };
 
                offerIdentity.setBound(true);
 
                return liszt;
            }
            catch (IntrospectionException e) {
                 throw new Error(e.toString());
            }
        } 

        public MethodDescriptor[] getMethodDescriptors() {
            return new MethodDescriptor[0];
        }
}

wsdd snippet:
 <service name="OfferAPI" provider="java:RPC">
  <parameter name="className" 
value="com.unica.affinium.offerapi.SOAPOffer"/>
  <parameter name="allowedMethods" value="getMetadata"/>
  <beanMapping qname="myNS:Metadata" xmlns:myNS="urn:SOAPOffer" 
languageSpecificType="java:com.unica.affinium.offerapi.Metadata"/>
 </service>