Here's an idea.  Define a string enumeration type in your WSDL, such as:

<wsdl:types>
  <schema targetNamespace="urn:namespace" xmlns="http://www.w3.org/2001/XMLSchema";>
    <simpleType name="myEnumType">
      <restriction base="xsd:string">
        <enumeration value="legalValue1" /> 
        <enumeration value="legalValue2" /> 
        <enumeration value="legalValue3" /> 
        </restriction>
      </simpleType>
    </simpleType>
  <schema>
</wsdl:types>


You could then use that type instead of "String" in the argument to your web service 
method.  I've used this method with both .Net clients and Axis clients, and it works 
great.  The data is still sent over the wire as a string, of course, but at least your 
client has some notion of the "allowed" values.

Marc


-----Original Message-----
From: Pathak, Sanjesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 2:41 PM
To: [EMAIL PROTECTED]
Subject: RE: how to serialize/deserialize static final fields



It is an interesting topic. Although I am not an expert on WSDL or BeanSerializer, I 
think I understand your point. If BeanSerializer does not serialize constants, then 
there is no way a client can get that information. The information or value of the 
constant has to be either in WSDL or in the serialized data. If it is not there at 
both the places, then their is no way a client can get that information. May be you 
might have to re-design your code like sending this information in the header and 
asking the client to send it's choice back as a header or add an extra parameter to 
your service so as to pass that value.

Sanjesh


-----Original Message-----
From: Liviu Chiriac [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 4:31 PM
To: 'Mike Burati'; [EMAIL PROTECTED]
Subject: RE: how to serialize/deserialize static final fields


I understand, by design is not possible. Or at least it is not possible
with a BeanSerializer/Deserializer.

But what I want to do is not contradictory: I want a user to pick a
value out of 3 that I have pre-defined (as constants in my class). I
need a way to communicate to the client what those pre-defined values
are. When the client sends an object to the server, I check to see which
value he picked (out of these 3) and perform different tasks
accordingly. (But I need him to pick only one of these 3...)

What is the best way to transmit these static constants (associated with
a particular class), to the user, if I cannot do it with a
BeanSerializer/Deserializer?


Liviu

-----Original Message-----
From: Mike Burati [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 06, 2003 4:53 PM
To: 'Liviu Chiriac'; [EMAIL PROTECTED]
Subject: RE: how to serialize/deserialize static final fields


- The BeanSerializer/Deserializer is designed to work with Bean
getter/setter methods, not static constants

- You seem to want a class on the client that has final constants, but
also
want those values transported across the wire from your server
instantiation
of the ComplexObject class to the client and then set based on the
response
message's return value?  Those two requirements are contradictory.






**********************************************************************
This e-mail is the property of Enron Corp. and/or its relevant affiliate and may 
contain confidential and privileged material for the sole use of the intended 
recipient (s). Any review, use, distribution or disclosure by others is strictly 
prohibited. If you are not the intended recipient (or authorized to receive for the 
recipient), please contact the sender or reply to Enron Corp. at 
[EMAIL PROTECTED] and delete all copies of the message. This 
e-mail (and any attachments hereto) are not intended to be an offer (or an acceptance) 
and do not create or evidence a binding and enforceable contract between Enron Corp. 
(or any of its affiliates) and the intended recipient or any other party, and may not 
be relied on by anyone as the basis of a contract by estoppel or otherwise. Thank you. 
**********************************************************************

Reply via email to