- Tips and Tricks
Release date: Monday 19.11.12 - Due date: Sunday, 25.11.12, 23:59
Read the following article on the different WSDL styles:
Discuss in a few sentences why the document/literal wrapped WSDL style is commonly used and what its limitations are.
Consider the WSDL declaration for a global weather Web Service:
You can compose a REST (HTTP-GET) request that determines the weather in Bonn in a browser of your choice by calling:
a.) Find and write down the definition of this operation in the WSDL file. Write down the answer of this request.
b.) Compose a request that determines all German cities provided by the weather service.
Consider the WSDL declaration for a FIFA World Cup 2010 Web Service:
a.) Which operations of the Web Service do not require any parameters?
b.) Describe the parameters of the operation “PlayedAtWorldCup”?
c.) Describe the return type of the operation “Coaches”.
In this exercise you will implement your own simple SOAP Web Service and Client with Java. We use the Java API for XML - Web Services (JAX-WS) which is included in Java SDK 6 as it provides a fast way of getting started. A short introduction on how to implement Web Services and corresponding clients with JAX-WS can be found at the Practical Lecture.
a.) Analogous to the calculator example of the Practical Lecture implement a simple SOAP Web Service in Java that satisfies the following extract of a WSDL declaration:
.. <message name="randomNumber"> <part name="lowerBound" type="xsd:int"/> <part name="upperBound" type="xsd:int"/> </message> <message name="randomNumberResponse"> <part name="return" type="xsd:int"/> </message> <portType name="RandomNumberGenerator"> <operation name="randomNumber" parameterOrder="lowerBound upperBound"> <documentation> Returns a random number between given the lower and upper bound. </documentation> <input message="tns:randomNumber"/> <output message="tns:randomNumberResponse"/> </operation> </portType> ..
b.) Implement a corresponding client that uses your Web Service to simulate the lottery drawing by requesting six random numbers between 1 and 49.
In this exercise you will combine two existing Web Services to build an advanced Web Service. For this purpose we use the WSDL declaration to automatically generate client stubs for accessing the corresponding Web Service.
a.) Use the “wsimport” tool of JAX-WS to automatically generate client stubs for the global weather Web Service and the FIFA WM 2010 Web Service of tasks 24 and 25.
b.) Implement a Web Service that provides the following two operations: