File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Testing a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "Testing a web service" Watch "Testing a web service" New topic
Author

Testing a web service

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All,

Currently I have a scenario where in the external system to which I have
to send data over web services has published its web service wsdl.
something like this
http://mysite/webservice/legacy.cfc?WSDL

Now I have to test the service. I am new to web service & would want to know how do i invoke this web service to test the same. I mean understanding what data should be the input for this service.
This is not a comprehensive test just a preliminary one to understand if the web service is working & can be reached properly as expected.

Do post your thoughts on the same


Regards,
Tracy Nelson
Greenhorn

Joined: Sep 29, 2005
Posts: 12
Originally posted by manish ahuja:

Currently I have a scenario where in the external system to which I have
to send data over web services has published its web service wsdl.
something like this
http://mysite/webservice/legacy.cfc?WSDL

Now I have to test the service.

Most current IDEs (Eclipse and Netbeans, anyway) have a facility that will generate a test client for you, given a WSDL descriptor. The generated client should be able to marshall and unmarshall the data appropriately for you, and the WSDL should give you a good idea as to what the WS will accept for input.


Protect me from the things I want!
manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All,

I hope this question does not sound naive.
Since I am using a java based approach, most examples I have seen actually talk about the corresponding java interface which is implemented by the java web service we are trying to invoke.

In my case if you see I just have a WSDL. I do not have anything else & moreover the file name is legacy.cfc?WSDL which is the Cold fusion file.

I tried using the Eclipse IDE but it expects a URL which is only from the one of the projects created within Eclipse.
I tried xfire but again the sample was having knowledge of all the methods & corresponding classes to invoke.

From the WSDL I would want to create a Java client class. I reckon we need a lot of other artifacts which ideally are generated(stubs skeletons etc). So I want to aceive something like this wehre in send this above URL as an input & it automatically creates all the boiler plate code for the same.

Please do post your thoughts on the same.


Thanks,
robin Lei
Greenhorn

Joined: Jan 15, 2007
Posts: 1
same question. I guess there is an easy way to test web services like just use web browser. I am thinking whether we can just send a request at browser's address. because web service use http protocol.

if we can use web browser to access wsdl file. why can't we use it to pass in requests?
Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
Ok to ellaborate what i am looking for is a utility to create the web service client side artifacts.
We are using Eclipse (WS Explorer) but somehow we are not able to get the related details like what all services & bindings are available for the same.
We tried doing an import of the WSDL to the workbench & made it part of our project but still its not giving us what all services are provided by the webservice but when I type the URL in the web browser it shows the WSDL properly.

I am looking for a utility something like JAXRPC to create a WS Client & all web service related client (java) artifacts. From the JAXRPC I downloaded the Java web service development pack but it did not help as it requires java version 1.5 & above & we are using 1.4.2

Do let me know your suggestions
Mukesh Mittal
Ranch Hand

Joined: Jan 13, 2006
Posts: 31
JAX/RPC generated stub is the best option.

Other way to test the servic is HttpURLConnection but in this as input, you have to pass soap request message.
Tracy Nelson
Greenhorn

Joined: Sep 29, 2005
Posts: 12
Originally posted by Mohit Sinha:

We tried doing an import of the WSDL to the workbench & made it part of our project but still its not giving us what all services are provided by the webservice


How do you know it's not giving you all the services? If a service isn't listed in the WSDL, then it doesn't exist. If someone tries to tell you otherwise, make them give you a WSDL file that shows that service.

Try getting a copy of NetBeans from NetBeans Home. Create a new Web project, and set your Java EE version to 1.4. Then right-click on the project and select "New -> Web Service Client". It'll prompt you for the WSDL URL. Enter that and it'll generate the proper client stubs.

Oh, and I'd push hard to get a current version of Java on your server. WS development with JAX-WS is an order of magnitude easier than writing all those interfaces and specifying endpoints and all the other housekeeping you used to have to do. IBM should have WebSphere 6.1 figured out in a couple of months (it's out now, but largely unusable until they get a profile for Eclipse/RAD figured out, and get their app manager patched up), it supports Java 1.5 (just as 1.6 comes out, hmmmm....)
Reza Ravasizadeh
Ranch Hand

Joined: Jun 08, 2004
Posts: 177
What you need to test all your web service is a generic client.

If you can create SOAP request for web service you can use:
Stylus stuido tool or www.SOAPCLIENT.com web site they provide way to execute your WS.

If you need something for web service execution(WS client) you should develope one for your self.

In java 5 you can use Dispatch or Proxy object (JAX-WS) in java 1.4 you can use DII, Stub or proxy object (JAX-RPC)

There is framework in apache web site named WSIF implemented as generic client for java 1.4 if you like to use that frame work(I don't) you can use it, I don't like to use nonstandard framework, or tool's feature to do my task.
[ January 17, 2007: Message edited by: Reza Rawassizadeh ]

Reza
 
 
subject: Testing a web service