How the WebService client is generated

Source: Internet
Author: User
Tags wsdl

1. Create the WebService client through Eclipse, which is a feature that eclipse comes with, not in detail;

2, through the command according to the WSDL file to generate WebService client, the following code, the command is written as a batch file execution can:

Set Home=d:\workspace\cvte\ekp\webcontent\web-inf\lib
Java-classpath%home%\axis-1.4.jar;%home%\axis-ant.jar;%home%\commons-discovery-0.2.jar;%home%\ commons-logging-1.0.4.jar;%home%\jaxrpc.jar;%home%\log4j-1.2.16.jar;%home%\mail.jar;%home%\saaj-api-1.3.jar;% Home%\wsdl4j-1.6.2.jar;; %home%\mail.jar; Org.apache.axis.wsdl.wsdl2java-p com.landray.kmss.cvte.review.integration.webservice.client.ocs-t-S/http ocs.gz.cvte.cn/ws/swdeliverbill?wsdl
Pause

Note the existence of each jar package and the path of the jar package, as well as the package name of the client code.

3, directly write Java code calls, the following is the use of axis call WebService

  Service service = new service ();//Create a service object
  string endPoint = "http:// Ocstestlmk.gz.cvte.cn/ws/swdeliverbill ";//Do you want to remove the WSDL here, or you will get an error
  //your WebService URL
   QName QName = new QName (endPoint);//Create a QName object throw your endPoint in
  call call = Service.createcall (QName, " Getsysoftbyworkorderid ");//Create a Call object throw QName strength into the websevice, and throw in the name of the method provided, I'm SayHello
   Call.settargetendpointaddress (EndPoint); Specify endpoint in the call instance.

Object invoke = Call
. Invoke (New object[] {"Ki5lkjofj4fsj3ddsjj3sdji38j6",
"Liaomingkai", "qx-sy15031071h"});
System.out.print (Invoke);
List outputvalues = Call.getoutputvalues ();
for (Iterator Iterator = Outputvalues.iterator (); Iterator.hasnext ();) {
Object object = (object) iterator.next ();
System.out.println (object);
}

How the WebService client is generated

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.