Axis Calls WebService client development

Source: Internet
Author: User
Tags wsdl

First step: Wsdl2java.bat file Writing

Axis_lib indicates the dependent jar package path
Output_path represents the generated class path
The package name  also needs to be changed manually
-P%package% indicates WebService server name  (Note: http://localhost/CHIMSWEB/services/ChimsAppImplService?wsdl)
Set axis_lib= "E:\Workspaces\MyEclipse professional\chims_20151008\webroot\web-inf\lib" set Java_cmd=java- Djava.ext.dirs=%axis_lib%set output_path= "E:\Workspaces\MyEclipse professional\chims_20151008\src\com\zhongzhi\ Chims\service\app\client "Set package=com.zhongzhi.chims.service.app.client%java_cmd% Org.apache.axis.wsdl.wsdl2java-o%output_path%-P%package% http://localhost/CHIMSWEB/services/ChimsAppImplService ? wsdlpause;

Step two: Introduce a dependency jar package

The third step: Run wsdl2java.bat batch file can generate code, call WebService

Package Com.zhongzhi.chims.service.zhongkang;import Java.io.stringreader;import Java.net.url;import Java.util.iterator;import Javax.xml.bind.jaxbcontext;import Javax.xml.bind.unmarshaller;import org.dom4j.Document ; Import Org.dom4j.documenthelper;import Com.zhongzhi.chims.service.zhongkang.client.beinuointerface;import Com.zhongzhi.chims.service.zhongkang.client.beinuoserverservice;import Com.zhongzhi.chims.service.zhongkang.client.beinuoserverservicelocator;import Com.zhongzhi.common.func.blankutil;public class Testtcfwebservice {public static void main (string[] args) { Beinuoserverservice Service=null; Beinuointerface Server=null; SYSTEM.OUT.PRINTLN ("Connect ....");
Server-side address string strportaddress = "Http://localhost//services/reportServer"; URL Portaddress;try {portaddress = new URL (strportaddress);//Get client service. Service = new Beinuoserverservicelocator ();// Get Client Stub.server = Service.getbeinuoserverport (portaddress);//test service method. String resultstr = Server.gettchfinfo ("310101197001044432", "001011", "Zhang Jian", "123456"); catch (Exception e) {e.printstacktrace ();}}}

  

Axis Calls WebService client development

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.