WebSphere Web Services Client for C++, Version 1.0.1 Operating Systems: Linux, Solaris

Coding and building client applications

After you have generated the client stubs from your WSDL source file, you can use these stubs to create a web service client application.

Why and when to perform this task

The WSDL2Ws tool places the files that it generates from WSDL in an output directory. By default, the target output directory is the current directory, but you can specify a different directory by using the -o option when you run WSDL2Ws. You can then create a web service client application by using the appropriate build command to create an executable file.

The following steps illustrate what you need to do to create an application, using the example of the client stubs generated from GetQuote.wsdl by the WSDL2Ws tool as described in Creating client stubs. Assuming that the generated client stubs files are still in the myGetQuote sub-directory within the <inst_dir>/samples/getQuote parent directory, you can now use these stubs to create a web service client application.

When you are working with the sample files, note the following points:

In the following steps, it is assumed that the new project that you are building is called myGetQuote, and that all components are in a directory called myGetQuote. The myGetQuote.cpp file contains the client application, along with the automatically generated StockQuote.cpp and StockQuote.hpp. The code for the client application is shown in Sample code for myGetQuote client application.

To build the myGetQuote client application, complete the following steps.

Steps for this task

  1. Change the current working directory to where the project myGetQuote is to be built (for example, <inst_dir>/samples/getQuote/myGetQuote).
  2. Using any text editor, create a .cpp file:
    1. Create a new file named myGetQuote.cpp.
    2. Copy the example code in Sample code for myGetQuote client application into the new file.
    3. Change the ServerName and PortNumber to match your server. If WebSphere Application Server is on your own machine and the default values have been used, ServerName is localhost and portNumber is 9080.
    4. Save the new file in the current directory.
  3. Build the client application by using one of the following commands.
    • On Linux, type the following build command:
      gcc *.cpp -I <inst_dir>/include/ -L<inst_dir>/lib/ -l axis_client 
      -o myGetQuote
    • On Windows, type the following build command:
      cl *.cpp /GX /D "WIN32" /I<inst_dir>\include /link<inst_dir>
      \lib\AxisClient.lib /out:"myGetQuote.exe"
  4. Check that a myGetQuote executable file has been created.

What to do next

For additional information about developing web service client applications, see Client API.

When you have finished coding and building your web service client application, you are ready to deploy and test the application as described in Deploying web service client applications.

Note: If you want to use one or more handlers with your application, see Developing and using client side handlers. If you are using handlers, you must deploy your application as described in Deploying web service client applications with handlers.

Task topic

Terms of Use | Rate this page

Timestamp iconLast updated: 12 Dec 2005
(C) Copyright IBM Corporation 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)