Two Laptop Bag*
The moose likes Web Services and the fly likes conditional axis web service - sample nowhere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "conditional axis web service - sample nowhere" Watch "conditional axis web service - sample nowhere" New topic

conditional axis web service - sample nowhere

frest tan

Joined: Jan 22, 2006
Posts: 4
How would I include in this service code(posted below), a conditional behavior (which would also appear in Axis generated WSDL) such that a consumer client has option (by way of the WSDL) to place a radio or other selection criteria to execute one set of strings for one selection condition & execute an alternate set of strings for another selection condition ?

In other words, for a consumer looking @ WSDL for the
service, he could (if available in the code & in the WSDL ) know this is a conditional service such that one menu selection (which he creates in client ) gives one set of answers, & another choice gives a separate set of optional answers. Meaning: one choice executes one portion of service code & another client consumer selection, executes a different portion of the service code.

Perhaps, one way to do (to totally escape the problem) is have 2 separate services with codes, under separate directories (and names) under webapps, which produce separate WSDLs. Then, client consumer adds a drop down selection to execute one, or the other services. Other than separating out the code into two distinct services to be called by client consumer, currently, the consumer gets everything as depicted in WSDL.

WSDL ( nor code at this point) has any indication of partitioning of data based on a selection criteria (ie, a branch for one selection & separate branch for another selection ) when using the one service (ie, one wsdl).

Here is a simple but complete POJO web service (jsp/servlet) for testing concept. "http://localhost:8080/ReptestSystem/index.jsp" is entry point to app. "http://localhost:8080/ReptestSystem/services/ReptestService?wsdl" is wsdl URL for app.

Axis libs for this app generate a WSDL for above "..ReptestService?wsdl" URL. Since WSDL is not hand generated, we cannot control WSDL except by way of what is in java/axis code which generates WSDL (which is I guess, the point of axis).

Code executes under tomcat. It generates wsdl using axis libs in c:\catalina_home\webapps\ReptestSystem\WEB-INF\lib\.

What it does: displays a string result (zip) when a key for that string (a Person Name) is submitted, & allows modification of the string (zip) for a key (person name) when cooresponding key is submitted.

What I don't know how to do: display one string result ( zip ) when a key for that string is submitted for dropdown criteria "A" which is communicated in the WSDL. Display the other available string results ( the remaining zips ) for each given key respectively, when a key for these is submitted (criteria "B" of client dropdown). And be unable to display the one zip which exists under criteria "A" when criteria "B" is selected in drop down. And, be unable to display any zips under criteria "B" if option "A" is selected in client drop down.

These two paths must also be communicated in WSDL which is generated by Axis so consumer, knows this conditional behavior is part of the service so he can code it into his consumer client.

I have a simple .net client consumer (not posted but will if asked) which accurately consumes service by using above WSDL URL. So everything currently works round trip 'tween consumer & service as coded.

This service runs under tomcat by splitting out the 3 JSPs & 5 classes, & creating a dir called "ReptestSystem" under "webapps", & placing JSPs under "webapps\ReptestSystem\", & placing classes under "C:\catalina_home\webapps\ReptestSystem\WEB-INF\classes\reptests\", & "web.xml" & "server-config.wsdd" under "ReptestSystem\WEB-INF\", & placing axis libs under "C:\catalina_home\webapps\ReptestSystem\WEB-INF\lib\"


---------------classes ------------

--------server-config.wsdd ------



Word wrapped for proper screen display - Balaji
[ January 23, 2006: Message edited by: Balaji Loganathan ]
frest tan

Joined: Jan 22, 2006
Posts: 4

for the wsdd file, the colons in "java<colon>.org" were turned into little red sleepy faces.

The generated WSDL file looks like following (which can be retrieved by loading code & executing the given URL):

---------------------------- wsdl ----------------

Word wrapped - Balaji
[ January 23, 2006: Message edited by: Balaji Loganathan ]
I agree. Here's the link:
subject: conditional axis web service - sample nowhere
Similar Threads
Locale problem in struts 1.1
The AXIS engine could not find a target service to invoke
wsdd urgent help
wsdd urgent help Web Services
javax. servlet.Servlet Exception: Initialization failed, Unable to get DB connection