Building a Client that Uses a Web Service

This is where the process all comes together. Questions regarding the deployment of your Web Service will now need to be addressed:

  • Is this Web Service going to be called internally?

  • Are your partners , customers, or vendors going to call the Web Service?

  • Have you been provided with a Web Service that you wish to call from your environment?

If you ve created the Web Service and you want to write a stub so that it provides a client with a starting point to access the Web Service, Oracle JDeveloper 10 g provides a wizard for this purpose. If you have been provided with the location of a WSDL file and you wish to create a stub based on a WSDL, Oracle JDeveloper 10 g also provides a wizard for this purpose. We will discuss where Web Services that others have written can be located shortly.

Create Stub for Web Service Wizard

To create a stub for any of the Web Services created in this chapter, simply right-click on the Web Service s name and icon, then click the Generate Web Service Stub option, as shown in Figure 17-33.

click to expand
Figure 17-33: Generate the Web Service stub wizard

There is also an option to generate a Web Service Client.

This wizard will generate a stub that can be used as a starting point to call your Web Service. Figure 17-35 shows the generation of a stub for the DOMESTICTAPI Web Service.

In Figure 17-34, which is Step 1 of 2 in the Web Service Stub/Skeleton generation wizard, we chose to generate a main method in the stub. This allows us to easily test our Web Service by adding some code and running the Web Service stub class. Step 2 allows you to select the methods you wish to include/expose in the client. By default, all available methods are selected. The section labeled Add your code here is where the code in the main() method was added:

click to expand
Figure 17-34: Step 1 of 2
 public static void main(String[] args)   {     try     {       DOMESTICTAPIStub stub = new DOMESTICTAPIStub();       // Add your own code here.       DOMESTICSet1 results[] = new DOMESTICSet1[5];       stub.openWebService();       stub.noLocalDB();       System.out.println(stub.openTable("select distinct * from DOMESTIC  where COMPANY like 


Oracle Application Server 10g Web Development
Oracle Application Server 10g Web Development (Oracle Press)
ISBN: 0072255110
EAN: 2147483647
Year: 2004
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net