Based on the URL of the WSDL, the client is generated using axis1.4, and the WebService is invoked

Source: Internet
Author: User
Tags stub zip wsdl
Based on the URL of the WSDL, the client is generated using axis1.4, and the WebService is invoked
1, to www.apache.org up to download Axis-bin-1_4.zip, if you want to associate the source code will axis-src-1_4.zip also download down. 2. Build a Java project, import all jar packages under the Lib file under Axis-bin-1_4.zip 3, right-click Project/run as/run configurations ... 4. Then under the Main tab, select the corresponding project and main Class:org.apache.axis.wsdl.WSDL2Java 5, then the program arguments under the Arguments tab: Enter-O client-d session-strue D:\project\FIIS_CRJ_AXIS\dest\test.wsdl which D:\project\FIIS_CRJ_AXIS\dest\ TEST.WSDL can also be a specific WSDL path Http://192.168.1.10:7001/test/test?WSDL 6, the last point run runs ———— at this time if the reported missing jar package, you can find spring's dependency package, there are many, Com.springsource.javax.activation-1.1.0.jar and Com.springsource.javax.mail-1.4.0.jar are also added here. 7, after performing the above operation will generate a client file under our project, the content of the file is to call the WebService client code
Use: There will be a local class   Locator and SOAP, create these two can call the corresponding WebService Method Example: Traditionalsimplifiedwebservicelocator Locator = Newtraditionalsimplifiedwebservicelocator (); Traditionalsimplifiedwebservicesoap stub = (traditionalsimplifiedwebservicesoap) Locator.gettraditionalsimplifiedwebservicesoap (); System.out.println (Stub.totraditionalchinese ("Zhang San")); Also a situation: Call the WebService before the landing, this situation how to deal with. 1, first login to get SessionID 2, set SessionID to the header, find  stub class CreateCall () method protected Org.apache.axis.client.Call CreateCall () throwsjava.rmi.RemoteException {       try {          org . Apache.axis.client.Call _call = Super._createcall ();                      ////////////////////////////////           //Set Header information           soapheaderelement helement = new SoapheaderelemENT (Newqname ("Sessioninfo"));           soapelement sid = Helement.addchildelement ("SessionId");           sid.addtextnode (Remote_sessioninfo.getsessionid ());           _call.addheader (helement); This makes it possible to call WebService.

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.