Use wsad to generate WebService client code

Source: Internet
Author: User

Title: Use wsad to generate a WebService ClientCode

Keyword: wsad WebService

Link: http://blog.csdn.net/jrq/archive/2006/07/08/893514.aspx

Body:

1.

Go to the wsad installation path

D:/wsad/bin>

You can see the batch file named "wsdl2client. Bat.

In command line mode, go to the current directory and use the wsdl2client command to generate the corresponding WebService client code based on the specified WSDL file.

 

2.

The procedure is as follows:

D:/wsad/bin> wsdl2client
Ibm_wsstudio_bin = D:/wsad/bin/
The. WSDL file must be specified as the last independent variable.

Web service client template builder for WSDL files
========================================================== ================

Usage: wsdl2client [Options]-project <projectdirectory> <wsdl uri>
Note: To Run Subsequent commands with the-createear argument,
The-clienttype argument must be used in this command.

Or: wsdl2client [Options]-createear <FILENAME. Ear>
-Clienttype <application | EJB | servlet>
<Projectdirectory>

Where: <wsdl uri> specify the position of the WSDL document with Uri
This can be remote or on a local file system.

<FILENAME. Ear> is the complete path of the target ear file.

<Projectdirectory> is the complete path of the project directory.

Options for creating a client template:
-Clienttype <application | EJB | j2se | servlet>
Generate implementation template
Must be used with-genmain
-Genmain <name of main class>
Name of the generated main class
Must be used with-clienttype
-User <User Name>
User name used to access the WSDL
-Password <password>
Password used to access the WSDL
-Nstopkg <mappings>
Namespace = package ing in a column separated by Spaces
-Filenstopkg <properties File>
Which includes namespace = package ing
Complete path name of the property File
-All
Generate code for all WSDL elements (including unreferenced WSDL elements)
-Wssecdir <directory>
Which contains the deployment descriptor configured for security
Directory Name
-Genresolver
Generate all information containing imported XSD
Import parser

Options for creating an ear file:
-RI <EJB remote interface>
Specifies the remote interface of the EJB client.
REQUIRED for the EJB client type
Invalid for other client types
-Main <client main class>
Main class of the specified Client
For applications Program And servlet client are required
Invalid for other client types
-Deploy
Deploy the obtained ear to the Application Server

General options:
-Verbose
Show more information during tool execution
-Help
Display this message

========================================================== ================

3.

According to the wsdl2client usage prompt, the command operation is as follows:

D:/wsad/bin> wsdl2client-project D:/test-clienttype j2se-genmain test D:/test. WSDL

Creating a new Web service client :...

Creating main class...

Creating client build script...

A new web service client has been created in the "client" folder in the project Directory D:/test.

To complete the "Web Service" client, you can enter the implementation code in the following classes:

Test. Java

Use the provided script to compile the Code:

D:/test/client-side/buildclient. bat

Run the client using the following items:

D:/test/client-side/runclient. bat.

4.

Open the D:/test path to view the WebService client code generated by the wsdl2client Command Based on the specified WSDL file.

 

5.

Wsad and wsdl2webservice commands

The usage is as follows:

D:/wsad/bin> wsdl2webservice
The. WSDL file must be specified as the last independent variable.

Web Service builder for WSDL files
==========================================

Usage: wsdl2webservice [Options]-createservice <servicename>
-Project <projectdirectory> <wsdl uri>

Or: wsdl2webservice [Options]-createear <FILENAME. Ear>
-Project <projectdirectory>

<Servicename> is the unique name of the web service.

<Wsdl uri> specify the position of the WSDL document with a URI
This can be remote or on a local file system.

<FILENAME. Ear> is the complete path of the target ear file.

<Projectdirectory> is the complete path of the project directory.

Options for creating a service:
-Type <EJB | bean>
Generate an EJB or Java Bean implementation template
-Contextroot <context root>
Context root of Web Service
-Clienttype <application | EJB | j2se | servlet>
Generate implementation template
Must be used with-genmain
-Genmain <name of main class>
Name of the generated main class
Must be used with-clienttype
-User <User Name>
User name used to access the WSDL
-Password <password>
Password used to access the WSDL
-Nstopkg <mappings>
Namespace = package ing in a column separated by Spaces
-Filenstopkg <properties File>
Attribute file containing namespace = package ing
Complete path name
-Server-side-only
No client-side helper class is generated
-Clientejbname <EJB Name>
Name of the EJB client application
-Wssecdir <directory>
Which contains the deployment descriptor configured for security
Directory Name
-All
Generate code for all WSDL elements (including unreferenced WSDL elements)
-Genresolver
Generate
Import Parser for all information

Options for creating an ear file:
-Add <Directory List>
A column separated by spaces to be archived for Web Services
Directory
-Deploy
Deploy the obtained ear to the Application Server

General options:
-Verbose
Show more information during tool execution
-Help
Display this message

==========================================

D:/wsad/bin> wsdl2webservice-createservice test-project D:/test-type bean con
Extroot thams-clienttype j2se-genmain testclient D:/test. WSDL

Creating a new Web Service: test...

Creating client build script...

Creating main class...
Creating server build script...

A new web service "test" has been created in the project Directory D:/test ".

To complete the "Web service", you can enter the implementation code in the following classes:

Testfilesoapbindingimpl. Java

Then, use the provided script D:/test/compile. BAT to compile the code and use-createear again.
To run the tool.

==========================================

 

[-End-]

By jrq

Yu Sui, 2006.07.08

 

 

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.