Brian Fitzpatrick [
http://community.jboss.org/people/bfitzpat] modified the blog post:
"Testing Web Services From WSDLs"
To view the blog post, visit:
http://community.jboss.org/community/jbosstools/blog/2010/06/04/testing-w...
--------------------------------------------------------------
Hi again...
I've been working on the JBoss Tools Web Service Tester and have just recently added
the ability to select a WSDL file to populate the endpoint/action URLs and generate a
Sample SOAP message when testing JAX-WS services. I'm still working on figuring out
how to connect to a UDDI v3 registry to browse and select an operation from a published
service in that context, but in the meantime you have a way to test your WSDL-based web
services a bit easier...
Before I provide an example, I want to bring up a great resource for publicly-accessible
web services from around the world -
http://www.xmethods.net/ve2/index.po XMethods.net.
If you haven't checked it out, it provides some great services that you can use to
test tools like the WS Tester. A few that I found that are very useful for testing are:
*
http://www.xmethods.net/ve2/ViewListing.po?key=uuid:7EB41E38-599C-30A8-9A...
Temperature Conversions
*
http://www.xmethods.net/ve2/ViewListing.po?key=425811 CDYNE Weather
*
http://www.xmethods.net/ve2/ViewListing.po?key=427560 Driving Directions
*
http://www.xmethods.net/ve2/ViewListing.po?key=427594 Google Search Results as RSS
So let's start with the Google Search Results one, which has a WSDL at
http://www.ecubicle.net/gsearch_rss.asmx?WSDL
http://www.ecubicle.net/gsearch_rss.asmx?WSDL.
If we look at the WS Tester, it has a new button - "Get from WSDL..."...
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3111/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3111...
So I click on the "Get from WSDL..." button and see the "Select WSDL"
dialog:
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3112/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3112...
In the "WSDL URI:" field, I paste my WSDL URL in and it populates the three
fields - Service, Port, and Operation. If there is more than one SOAP port available (such
as SOAP and SOAP12), you can select it in the list and the operation list will change
accordingly. In this case, there's just one operation available, but you have a
vertical scroll bar on the right of the list to pick and choose.
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3113/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3113...
When I hit OK, it does a number of things with the WSDL. It searches through the WSDL for
the endpoint and action URLs, but more importantly it will try and generate a valid sample
of the SOAP Request message. Even if the WSDL has multiple imports and/or imports schemas,
it should (knock on wood) generate even complex messages fairly well. (If it doesn't,
please let me know by putting in a JIRA.)
So in this case, it comes back populating the WS Tester with these values:
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3114/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3114...
If I change the values a bit...
* searchPage becomes an empty value (delete the "?")
* gQuery becomes "JBoss Web Services"
* numOfResults becomes an empty value (delete the "?")
And hit Invoke...
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3115/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3115...
If I copy the response into an XML file and clean it up a bit, it looks pretty good:
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3116/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3116...
So if you look at a web service with multiple operations like the CDYNE Weather service
(WSDL at
http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl
http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl), you have more options in the operation
list:
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3117/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3117...
And I was able to get the forecast for my city:
http://community.jboss.org/servlet/JiveServlet/showImage/38-1808-3118/ws_...
http://community.jboss.org/servlet/JiveServlet/downloadImage/38-1808-3118...
So if you have a WSDL file or a URL to a WSDL file, you should be able to use the WS
Tester to test it now.
Next step is to get some sort of facility into the mix so you can browse a UDDI repository
for the service.
This is checked into the JBoss Tools trunk now, so you should be able to play with it. Let
me know what you think!
--Fitz
--------------------------------------------------------------
Comment by going to Community
[
http://community.jboss.org/community/jbosstools/blog/2010/06/04/testing-w...]