Speaking of the Web Service program development, eight months ago I worked overtime to debug the company and China Telecom's business navigation system interface, with the Web Service,web service has many advantages, the use of Web service can be in different programming languages to achieve data exchange, I was not familiar with the Web service at the time, and my colleagues helped me generate a bunch of Web service Framework code, and I only developed the business code alone.
This time another project will use the Web service, but the staff is also less, no one to help do the Web service, had to do their own.
Fortunately, before the development, a colleague of us not familiar with the Web service programmers have some training, I know that the original Web service can be automatically generated code, and it is not difficult, try an afternoon client and server side of the Web service code are debugging through the , really good.
For more developers who love to develop their Web service quickly, I've sorted out some of the main points of developing Web service through axis, hoping to make Web service quickly available to developers unfamiliar with Web service.
I. Installation of the AXIS environment
1, installation Environment J2SE SDK 1.4,tomcat 5.0,eclipse 3.2.
2, to the http://xml.apache.org website to download axis installation package.
3, the Axis-related package files in the Web-inf\lib directory.
4. Axis Optional Package: Activation.jar mail.jar xmlsec-1.4.beta1.jar Copy to Web-inf directory, use when generating clients.
Axis supports the deployment and development of three Web service types, respectively:
1, Dynamic invocation Interface (DII)
2. Dynamic Proxy method
3, stubs way
I did not introduce the first two ways, colleagues told me that they do not use the first two ways, they suggested that we use the stubs method, so I will mainly introduce a third way. Note that my own Java source code is placed in the D:\workspace\test\ directory, and axis-related package files are placed under the D:\workspace\test\WEB-INF directory.
Ii. Writing WSDD Publishing Web services, writing stub client Access Web services
1, write the service-side program Server,sayhello.java, compile Server.SayHello.java
package server;
public class SayHello
{
public String getName(String name)
{
return "hello "+name;
}
}
2, the preparation of WSDD documents
The contents of the DEPLOY.WSDD file are as follows:
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="SayHello" provider="java:RPC">
<parameter name="className" value="server.SayHello.getName"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>