116 Chapter 5 // d) (Web site template) get the port
116 Chapter 5 // d) get the port reference hello = (examples.HelloInterface) helloService.getPort(examples.HelloInterface .class); // Call the hello() method System.out.println( Dynamic proxy: + hello.hello()); } /** convenience method to retrieve the port reference though a static stub */ private static HelloInterface getStaticStub() { // the HelloWorldWS_Impl class is generated by the JAX-RPCstub compiler Stub stub = (Stub)(new HelloWorldWS_Impl().getHelloInterfacePort()); // tell the stub where the endpoint is stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, serviceEndpointAddress); return (HelloInterface)stub; } } J2EE client code that is running in a client container, for example a servlet, can be shielded from the actual service endpoint address by using JNDI lookups instead. The client container s local JNDI context provides the binding from the service endpoint address to a service name according to the client s deployment descriptor. The configuration of the client container is vendor-specific, but after everything is set up properly, the following code can be used to retrieve the service reference: InitialContext ctx = new InitialContext(); Service helloService = (Service)ctx.lookup( java:comp/env/services/HelloWorldWS ); HelloInterface hello = (examples.HelloInterface)helloService.getPort(examples .HelloInterface.class); This concludes our simple programming example for Web Services in EJB. While the example itself is far from realistic or even prototypical for a Web Service, it is useful to show how you can turn something into a Web Service after it has been coded, and how EJB supports generating the necessary XML scaffolding without you having to worry about it. You will see another example of a Web Service in action in Chapter 22.
If you are in search for clan hosting account you just came in to right place. We host many clan websites in almost all popular games like Counterstrike, Call Of Duty and other. More details about our offer you can find inside clan web hosting section.