The booking readers in this article must first understand the J2EE, familiar with XML, Tomcat, etc. Basic content. This article is mainly briefly introduced the basic content of the web service. How to build SOAP services in Java Web development: First, SOAP (Simple Object Access protocol ) Simple object access protocol, to understand SOAP, first need to understand the origin of distributed calculations, as the next-generation distributed computing system web service appears, SOAP has become the actual communication standard for applications that create and call through the network. . SOAP is similar to traditional binary protocol IIOP (CORBA) and JRMP (RMI), but it does not use binary data representation, but uses XML, text-based data representation. With the XML representation, SOAP defines a small wired connection protocol and encoding format to represent data types, programming languages, and databases, and also use various Internet standard protocols as their messaging tools, and can also provide RPC and document drivers. The agreement of communication model such as message exchange. Please note that W3C is working on SOAP research, http://www.w3c.org/2000/Xp/group/, and has got a positive response to mainstream vendors so that it is consensus for important tasks related to XML-based protocol And define their key requirements and use scenarios.
The basic specification of SOAP 1.2 defines the following basic content: 1) The syntax and semantic representation of the XML document as a structured SOAP message 2) In the SOAP message, the encoding standard 3) is used to exchange the communication model for switching the SOAP message. 4) The bound SOAP message of the bottom level of SOAP transmission mainly includes a simple SOAP message, a message head, a body, an attachment, a simple SOAP message representation: Post / StudentInfo http / 1.1 host: Anthropology.cun.edu Content-Type: TEXT / XML; Charset = "UTF-8" Content-Length: 640 soapaction: "getstudentinfo"
It's ready to be deployed, make sure the environment path classpath sets correctly, run: java org.apache.axis.client.adminClient -l http: // localhost / webservicetest / servlet / testservlet SOAPTEST_DEPLOY.WSDD (If you don't understand, please refer to The above description) OK, huh, to this, we have completed a deployment of a web service: Test http: // localhost / WebServiceTest / servlet / testservlet Do you have a choice SOAPTEST service? If you don't want to serve the WSDD file, the content is changed to:
Now in order to reflect the charm of web services, I use the .NET platform to test, the client uses C # writing (first installing .NET Framework SDK): 1) Generate a web service agent through WSDL, run under the NET platform: WSDL / L : Cs / protocol: SOAP / Protocol: SOAP / PROTOAPTESTCLIENT.CS HTTP: / / LOCALHOST / WebServictest / Services / SOAPTEST? WSDL We got a CS file soaptestclient.cs through WSDL, you can open the CS file and study it The code, the getStr (String Name) is the method we need to call. Our client can call the server-side method by calling the method, the internal conversion of the WSDL.exe tool has been helped us, and the WSDL2JAVA tool under Axis is also The same feature, you can refer to I mentioned above about AXIS's kernel content 2) Compile CS file into assembly DLL: CSC / Target: library /R :system.web.services.dll /R :system.xml.dll SOAPTESTEM.XML.DLL SOAPTestClient .cs Finally, we wait for a dll file SoapTestClient.dll, the client program by calling it the line 3) write client applications SoapTestClientApp.cs using System; namespache jws.client {public class SoapTestClientApp {public SoapTestClientApp () {} public Static void main (string [] args) {if (args.length! = 1) {console.writeline ("usage: soapteline (" usage: soaptestclientapp