Axis1.4-based WebService Interface Development (interface invocation)

Source: Internet
Author: User

Axis1.4-based WebService Interface Development (interface invocation)

First, WebService interface code refer to the previous blog:

Http://www.cnblogs.com/zhukunqiang/p/7125668.html

Second, the code part

1, new Web Project project, named Axiswebserviceclint, and import Axis1.4 required jar package (paste the jar package into the Lib directory).

  

2. New WebService interface Call class:

Package Com.no8.clint;import Java.net.url;import Javax.xml.rpc.serviceexception;import org.apache.axis.AxisFault; Import Org.apache.axis.client.call;import Org.apache.axis.client.service;public class WebClient {public static void Main (string[] args) throws Exception {String endpoint = "Http://localhost:8080/axiswebservice/services/HelloWorld? WSDL ";//Create a service call (calling) Service service = new service (); Call Call Service.createcall ();//Set the Urlcall.settargetendpointaddress (new Java.net.URL (endpoint)) where the service resides; Call.setoperation ("SayHello"); string ret = (string) call.invoke (new object[]{"Zhang San"}); SYSTEM.OUT.PRINTLN (ret);}}

3. Click Run Java class (run the Java file directly, do not need to deploy the Web project to Tomcat to run directly):

Call succeeded!

Axis1.4-based WebService Interface Development (interface invocation)

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.