• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exposing Constants in WebServices

 
Manjunatha N.S.
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

In web service is it possible to expose the Constants used in the application. Let say for my web serice I need to pass value for Operation, possible values for this are (add, delete, update). Is it possible expose these constant values(add, delete, update) visible to client application accesssing the web service.

Server Side: public static String[] OPERATIONS={"ADD", "DELETE", "UPDATE"};

client Side: mywebsericeport.setOperation( mywebservicePort.ADD );

thanks
Manju
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The usual way to encode constants in a Web services is via XML Schema enumerations:



In my case, when I used this sort of thing with Weblogic 8, the Java equivalent code that uses this enumeration is:



Mind, this only works if you're writing a WSDL then generating the Java stubs from it. If you're going the other direction (Java -> WSDL), I don't know of a way to do this. That said, there probably is one somewhere.


-Tim
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!