You can use Dreamweaver to generate proxy stubs for web services that's created in any language, and It is really easy to use!
There are two things you need to do before you try to generate proxy using Dreamweaver:
Dreamweaver uses older version of Axis, so the generated proxy stub will not work properly. You have to copy the webservices.jar from jrun to replace the one in Dreamweaver under Dreamweaver-install/Configuration/Classes. Note, Dreamweaver team is working on this issue.
You have to check if the web services and all its methods are working correctly. For example,
http://www.seshakiran.com/QuoteService/QuoteService.asmx?wsdl you can see the descriptor display fine. But if you check one of its method GetQoute by requesting
http://www.seshakiran.com/QuoteService/QuoteService.asmx/GetQuote you will see "The page cannot be displayed". Then you can't use the web services.
Note, you can always use wsdl2java -v -o <outputdirectory> <wsdl> to generate the proxy, but Dreamweaver can save you a lot of typing.
To generate proxy from Dreamweaver:
1. follow http://www.macromedia.com/support/dreamweaver/content/websrv_aspnet/websrv_aspnet04.html to create a jsp site and a jsp page.
Note, point the jsp site to one of your web app root, like C:\JRun4\servers\default\default-ear\default-war
2. open a new jsp page.
3. on the right-hand penal, go to application-->components, select "web services" from the drop-down list, then click the + button, then "add using WSDL"
4. put URL of WSDL file. You can use a WSDL file on your machine, or you can click the global icon (UUID browser) to get web services from existing site.
For this example, we choose "Weather - Temperature" from Xmethods site, the URL will be http://www.xmethods.net/sd/2001/TemperatureService.wsdl
select "Apache SOAP 3.0 (Axis)" as proxy generator. Then click "ok".
Dreamweaver will generate the proxy stubs for you. And you can see all the classes under Components panel.
There are 4 classes generated. Two of them will always be BeannameService and BeannameServiceLocator.
For our example, they are TemperatureService and TemperatureServiceLocator.
The other two file name will be different depend on how the web services is created. I will write a TechNote about this in more details.
5. Now all you need to do is to create a jsp client page. Dreamweaver allows you to drag and drop the methods you need from the Components panel into your jsp pages!
The following shows what you need for the proxy client jsp page :
First, you need to get a stub factory from the Locator. For this you always use the class name end with Locator:
BeanServiceLocator stubFactory = new BeanServiceLocator(); (for our example, Bean is Temperature)
Second, you get a stub (Instantiate a proxy) by calling stub=stubFactory.getServicename(); Here the Servicename is different depend on how the web services is created:
for .net: getBeanServiceSoap();
for Perl/SOAPLite: getBeanPort();
for java (or ColdFusion), GLUE : getBean() or getServicename(); here Servicename is the service name you defined in server-config.wsdd
I will put more details in my techNote to help understand and determine what the Servicename you should use
Third, you Invoke the web service's method(s): output = stub.getMothed();
for our example, the jsp page will be (proxy_temp.jsp)
---------------------------------------------------------------
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@page import="org.apache.axis.client.Call,org.apache.axis.client.Service,org.apache.axis.encoding.XMLType" %>
<%
net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator aTemperatureServiceLocator = new net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator();
net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType aTemperaturePort = aTemperatureServiceLocator.getTemperaturePort();
float aNewton = aTemperaturePort.getTemp("02466");
float aSF = aTemperaturePort.getTemp("94103");
%>
The temperature in Newton today is <%= aNewton %> <br>
The temperature in San Francisco today is <%= aSF %> <br>
---------------------------------------------------------------------------------
Press ctrl+shift+r to compile the jsp page and see if there is any error.
6. invoke the proxy_temp.jsp via http://localhost:8100/proxy_temp.jsp, You will see display like:
The temperature in Newton today is 61.0
The temperature in San Francisco today is 66.0
There are no comments on this entry.