Axis implements WebServices distributed communication

Source: Internet
Author: User
Tags wsdl


principles of distributed communication


Rationale: Stubs and skeleton serve as intermediaries for client and server-side transmissions, and stubs and skeleton are also at the core of encoding and decoding.  


WSDL :

webservices description file; XML defined set of webservices Standard that describes the service-side correspondence method, parameters, and return values. The corresponding action class can be generated according to the configuration.

Other common implementations of webservices

Corba


relative to webservices. programming is complex, and transmission is fast.


Uddi

in simple terms, UDDI The main use of the registration center. The server sends the data to the corresponding clientvia the registry, and informs the client of the transfer to the registry information. In this way, there is the disadvantage that such an intermediary can avoid the direct transmission of huge data through the protocol.

UDDI : http://blog.sina.com.cn/s/blog_645f168c0100i9pj.html

Axis configuration

a . Configuration WebService

1. Deploy the axis engine to Tomcat .


Axis-1_4\webapps \axis folder is copied to under the Apache-tomcat-7.0.54-windows-x64\apache-tomcat-7.0.54\webapps.


2. Edit the corresponding java class into axis and restart Tomcat


New JWs


Publicclass mywebservice{publicstring SayHello (String x) {return "Helloaxis" +X;                }}


saved to Axis root directory


3. access the corresponding http://localhost:8080/axis/MyWebService.jws


Click to see the WSDL, See Mywebservice.jws corresponding to the XML file. Equivalent to a reverse engineering, typically using this XML file to generate the corresponding java code.


so far webservices Environment Configuration Complete



two . Validation Call

1 . import . Jar

All imports of jars under \axis-1_4\lib




2.client call
publicstatic void Main (string[] args) {//indicates where the service is located stringurl= "http://localhost:8080/axis/MyWebService.jws?wsdl";// Axis Correspondence Service Serviceservice =new Service (); try{//location callcall= (call) Service.createcall () for call settings; Call.settargetendpointaddress (Newurl (URL)); try{stringrs= (String) call.invoke ("SayHello", new object[] {"CFL"}); System.out.print (RS);} catch (Axisfault e) {//todo auto-generated catch blocke.printstacktrace ();}                        } catch (Serviceexceptione) {e.printstacktrace ();} catch (Malformedurlexception e) {//todo auto-generated catch blocke.printstacktrace ();}}


modal Log

Error 1.


Error compiling cannot access Java.lang.Object

Error 2.


Java.lang.RuntimeException:No compiler found in your classpath! (Need to add ' Tools.jar ')


Above two errors, just copy the Tools.jar and Dt.jar under the JDK to the Lib file of axis.


Warning 3.


-unable to find required classes (Javax.activation.DataHandler Andjavax.mail.internet.MimeMultipart).

Attachmentsupport is disabled.

import Activation.jar, Mail.jar into Axis corresponding to the Lib you can eliminate the warning.

Detailed Operation: http://blog.csdn.net/chastel/article/details/2084076


Post

webservices as a kind of distributed technology that is shared or communicated among heterogeneous languages, it mainly involves Soap , WSDL and other technologies. wsdl is used to describe the service-side invocation object, andsoap is used to transfer the data. In addition , stubs and skeleton are used as intermediaries. In addition, from a personal point of view, distributed and remote call is not the same, it should be said that webservices is a remote invocation of a solution. the text is a small can not be smaller demo, the principle of this, the actual use of the need to do further research.


Several other implementations of axis: http://www.cnblogs.com/mingzi/archive/2009/03/22/1419120.html

Axis implements WebServices distributed communication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.