• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Web Services Doubts to Clarify

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to Everybody,

My First Post on this Forum!!

I am started learning web services. And I have tried one sample web service example (fibonacci). At this stage, I have few queries to clarify.

As a service provider, I have to do the following things: (Pls correct me, if I am wrong)

1. Write the interface (with business methods)
2. Implement that interface.

3. Generate the WSDL file from the Interface using Java2WSDL tool.
Here comes my first question: What this WSDL file contains?(I have seen this WSDL file, which is the XML file. That's what I know) What is the role of this wsdl file? Whether without Java2WSDL tool, we can generate manually?

4. Generate the Java Files from generated WSDL file using WSDL2Java Tool.
Why we generating the Java files from WSDL xml file? Whether we can't do this wihout WSDL? That is generated WSDL xml file is having the interface details, I am guessing. Why can't from that interface, we can directly generated the rest of the java files like

FibonacciSoapBindingImpl.java
Fibonacci.java
FibonacciService.java
FibonacciServiceLocator.java
FibonacciSoapBindingSkeleton.java
FibonacciSoapBindingStub.java

5. Deploy the jar files.

Upto step 5, it's the service provider task.

How the client will know the service provided by the service provider?

And also, where are all we can use web services? Give some example application that suits web services? If so, why can't the EJB can be used for that same application?
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mark Tigerwood:
What this WSDL file contains? What is the role of this wsdl file? We can generate manually?


The WSDL is the description of the Web Service Interface. You thought that you were defining the interface in step 1 - you only defined a Java representation of the web service interface, not the web service interface itself. There are no rules that state that either the web service or the web service clients have to be written in Java. They could be written in .NET, Perl, Python, Ruby, C, etc. To all non-Java participants the description of the interface in Java is useless. So the WSDL file is a text file, an XML file that describes the web service in the Web Services Description Language. The WSDL can be written manually though it is usually recommended that you use a WSDL aware XML-editor for that job. You can only really claim that you wrote the service interface first if you write the WSDL first.

Originally posted by Mark Tigerwood:
Why we generating the Java files from WSDL xml file?


When you are writing a Java Web Service Client the Web service may not have any Java files for you because the service might not be implemented in Java. The WSDL is the file that "universally" describes the web service interface for anyone who wants to access it, regardless of the platform they are using.

Originally posted by Mark Tigerwood:
How the client will know the service provided by the service provider?



Usually the provider will simply send the consumer the WSDL or the URL where the WSDL is located. The WSDL also includes the URL of the service. If the provider and consumer don't have any previous contact service registries like UDDI can be used.

Originally posted by Mark Tigerwood:
If so, why can't the EJB can be used for that same application?



In general SOAP over HTTP can pass through a Firewall without problem. RMI as used by EJB cannot. Also ideally web services should be exchanging entire "documents", while with EJB you usually deal with smaller messages being sent between components - so it is also a matter of granularity.

Have a look at these topics:
WebServices versus EJB
WSDL question
[ November 06, 2006: Message edited by: Peer Reynders ]
 
Mark Tigerwood
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply and it's good explanation.

So from the service provider side, they have to generate the WSDL xml file only(using some tolls like JAVA2WSDL).

The client will get this WSDL file and he will get the Java Files for this WSDL file(using some tools like WSDL2JAVA)

In case of fibonacci example, by above mentioned is true, then the client will have all the server side coding also.

For Example, everything mentined below, the cliet will get.
FibonacciSoapBindingImpl.java
Fibonacci.java
FibonacciService.java
FibonacciServiceLocator.java
FibonacciSoapBindingSkeleton.java
FibonacciSoapBindingStub.java
deploy.wsdd
undeploy.wsdd

So calling a method fib.calculateFibonacci(10)) is local to the client. That is, whether the client will call the calculateFibonacci(10)) in the server side or calculateFibonacci(10)) in the client side(since the client will going to get all those files (java files) mentioned above)?
reply
    Bookmark Topic Watch Topic
  • New Topic