Webservice client generation method, webservice Client

Source: Internet
Author: User

Webservice client generation method, webservice Client

1. Create a webservice client through eclipse. This function is provided by eclipse and is not described in detail;

2. Run the following code to generate a webservice client based on the wsdl file:

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

Check whether each jar package exists, the path of the jar package, and the name of the stored package of the client code.

 

3. directly write the java code for calling. The following code uses AXIS to call webservice.

Service service = new Service (); // create a Service object
String endPoint = "http://ocstestlmk.gz.cvte.cn/WS/SwDeliverBill"; // do you want to remove it here? Wsdl. Otherwise, an error is reported.
// Your WebService URL
QName qName = new QName (endPoint); // create a QName object and drop your endPoint
Call call = service. createCall (qName, "getSYSoftByWorkOrderId"); // create a Call object to lose the QName strength and the method name provided by WebSevice. Here I am sayHello
Call. setTargetEndpointAddress (endPoint); // you must specify the 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 );
}

 

 

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.