This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes doubt in web service - confused in a class which is neither ws nor client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "doubt in web service - confused in a class which is neither ws nor client" Watch "doubt in web service - confused in a class which is neither ws nor client" New topic
Author

doubt in web service - confused in a class which is neither ws nor client

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Please follow this link: http://java.sun.com/javaee/5/docs/tutorial/doc/bnayn.html#bnayy

In the client class, a static global variable is present of HelloService class. Where is this class??? What's in that class? Later on, they are calling a method named getHelloPort() on this, which returns port that acts as a proxy to the service (Hello class). What is implementation of getHelloPort() method???

Thanks.
arvin ramon
Ranch Hand

Joined: Oct 04, 2007
Posts: 31
You might want to follow the same documentation... Think you need the examples stuff of JEE 5 downloaded locally... And here is what mentioned in the same documentation about HelloService...

-------------------------------------------

Building, Packaging, and Deploying the Service
You can build, package, and deploy the helloservice application using either NetBeans IDE or ant.

Building, Packaging, and Deploying the Service Using NetBeans IDE
Follow these instructions to build, package, and deploy the helloservice example to your Application Server instance using the NetBeans IDE IDE.

In NetBeans IDE, select File→Open Project.

In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/jaxws/.

Select the helloservice folder.

Select the Open as Main Project check box.

Click Open Project Folder.

In the Projects tab, right-click the helloservice project and select Deploy Project.

This builds and packages to application into helloservice.war, located in tut-install/javaeetutorial5/examples/jaxws/helloservice/dist/, and deploys this WAR file to your Application Server instance.

--------------------------------------
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by arvin ramon:
You might want to follow the same documentation... Think you need the examples stuff of JEE 5 downloaded locally... And here is what mentioned in the same documentation about HelloService...

-------------------------------------------

Building, Packaging, and Deploying the Service
You can build, package, and deploy the helloservice application using either NetBeans IDE or ant.

Building, Packaging, and Deploying the Service Using NetBeans IDE
Follow these instructions to build, package, and deploy the helloservice example to your Application Server instance using the NetBeans IDE IDE.

In NetBeans IDE, select File→Open Project.

In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/jaxws/.

Select the helloservice folder.

Select the Open as Main Project check box.

Click Open Project Folder.

In the Projects tab, right-click the helloservice project and select Deploy Project.

This builds and packages to application into helloservice.war, located in tut-install/javaeetutorial5/examples/jaxws/helloservice/dist/, and deploys this WAR file to your Application Server instance.

--------------------------------------



Thanks Arvin.

Though I didn't get the code but this class is not coded by us for sure. And so I would want to know who created this class? On basis of what? Why the method name kept is getHelloService() and all such kind of questions.

elilvannan nagarajah
Greenhorn

Joined: Apr 17, 2005
Posts: 8
Hi,
Normally if you(client) want to access a web service, you should generate some client side stuffs (it takes care of communication,serialization,etc).
In this example they used the metadata annotation method for generating the clientside stuff.(during the build process - step no 7 - Use wsimport to generate and compile the web service artifacts needed to connect to the service.)

// wsdl location as argument, during the //build process, it well generate //the service class.)
@WebServiceRef(wsdlLocation="http://localhost:8080/
helloservice/hello?wsdl")

static HelloService service;

Then above service refers that hello wsdl file.
with in a single wsdl ,we can define classes and those methods (publish as service).

then set the corresponding end point by calling the getHelloPort() method.
(since with in a single wsdl file we can define more than one service).
Then it will point to the particular class (service class in the server side).

- Elil


SCJP 1.4<br />SCWCD 1.4 <br />SCBCD 1.3<br />SCEA (Part1)
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by elilvannan nagarajah:
Hi,
Normally if you(client) want to access a web service, you should generate some client side stuffs (it takes care of communication,serialization,etc).
In this example they used the metadata annotation method for generating the clientside stuff.(during the build process - step no 7 - Use wsimport to generate and compile the web service artifacts needed to connect to the service.)

// wsdl location as argument, during the //build process, it well generate //the service class.)
@WebServiceRef(wsdlLocation="http://localhost:8080/
helloservice/hello?wsdl")

static HelloService service;

Then above service refers that hello wsdl file.
with in a single wsdl ,we can define classes and those methods (publish as service).

then set the corresponding end point by calling the getHelloPort() method.
(since with in a single wsdl file we can define more than one service).
Then it will point to the particular class (service class in the server side).

- Elil


Thanks Elil.

So this @WebServiceRef will take care of everything (creating a service factory for WSDL file that will have methods for each service to get port).

That's pretty cool.

Are these names bound to follow this naming convention:

Bean class: HelloBean
Service factory class: HelloService
Port class for hello service: Hello
Method to get port class: getHelloPort
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: doubt in web service - confused in a class which is neither ws nor client
 
Similar Threads
JAX-WS Client for a SOAP service provider
Creating a client to consume a webservice
JAX-WS Servlets and Stateless Beans
How to consume third party webservice inside EJB
Where to start for advance java (j2ee)