Another Prague? In the U.S.?
By Geertjan-Oracle on Jul 31, 2005
When I clicked "Find the City!", a new web page popped up and this is what I saw:
Of course, NetBeans didn't do this on its own -- it used this WSDL file:
NetBeans IDE includes a cool template that very quickly generates a web service client for you. There's even a built-in client, which means that you need not do any coding -- you can test your web service right away. Then, knowing that the WSDL works as expected, you can add a very small bit of code to a servlet and bob's your uncle. This was the important part that I had a little trouble with, it's part of the processRequest method in the servlet:
String zipCode = request.getParameter("zipCode"); out.println("<b>Zip:</b>"); out.println(zipCode); out.println("<p><b>City and State:</b>"); String s = getCityStateByZipSoap().getCityStateByZip(zipCode).getString(); out.println(Arrays.asList(s));
Now that I know how to work with complex types, working with web services is going to be much easier, since many (if not most) web services seem to use complex types.