Sounds like you may be labouring under one of the "Web Services
misconceptions" mentioned here:
http://weblogs.cs.cornell.edu/AllThingsDistributed/archives/000343.html

Basically, SOAP (and all the artefacts generated by Axis) is just a way
of sending messages between systems. The fact that an attribute is
read-only is out-of-band with respect to the SOAP message, and if a
client attempts to change it and submit it back to your service, the
service must handle that appropriately (e.g., reject it as bad input).

On the other hand, if you're building classes for a client, where you
know about the semantics of your object model, then you can probably
achieve what you're looking for if you put a bit of effort into writing
your own serializer/deserializer code.

Hope this helps
Keith



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 02 March 2005 21:43
To: [email protected]
Subject: 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>

Reply via email to