~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to usersguide/tutorials/j2ee-tut/examples/jaxrpc/dynamicproxy/src/dynamicproxy/HelloDProxyClient.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package dynamicproxy;
 
2
 
 
3
import java.net.URL;
 
4
import javax.xml.rpc.Service;
 
5
import javax.xml.rpc.JAXRPCException;
 
6
import javax.xml.namespace.QName;
 
7
import javax.xml.rpc.ServiceFactory;
 
8
import dynamicproxy.HelloSEI;
 
9
 
 
10
public class HelloDProxyClient {
 
11
    
 
12
    /**
 
13
     * @param args the command line arguments
 
14
     */
 
15
    public static void main(String[] args) {
 
16
        try {
 
17
            
 
18
            String UrlString = args[0] + "?WSDL";
 
19
            String nameSpaceUri = "urn:Hello/wsdl";
 
20
            String serviceName = "Hello";
 
21
            String portName = "HelloSEIPort";
 
22
            
 
23
            System.out.println("UrlString = " + UrlString);
 
24
            URL helloWsdlUrl = new URL(UrlString);
 
25
            
 
26
            ServiceFactory serviceFactory =
 
27
                    ServiceFactory.newInstance();
 
28
            
 
29
            Service helloService =
 
30
                    serviceFactory.createService(helloWsdlUrl,
 
31
                    new QName(nameSpaceUri, serviceName));
 
32
            
 
33
            dynamicproxy.HelloSEI myProxy =
 
34
                    (dynamicproxy.HelloSEI)
 
35
                    helloService.getPort(
 
36
                    new QName(nameSpaceUri, portName),
 
37
                    dynamicproxy.HelloSEI.class);
 
38
            
 
39
            System.out.println(myProxy.sayHello("Buzz"));
 
40
            
 
41
        } catch (Exception ex) {
 
42
            ex.printStackTrace();
 
43
        }
 
44
    }
 
45
    
 
46
}