Professional Documents
Culture Documents
IAN Eshan Arooqi: Consuming Web Services in Java Using JAX-WS History
IAN Eshan Arooqi: Consuming Web Services in Java Using JAX-WS History
Home
Articles
Presentation at ICOSST/OSSW 2010
Embedded MySQL Part 1
Installation:
JAX-WS works with Java Standard Edition (J2SE) 5 or later[1]. If you dont already have JAX-WS then follow the
following steps otherwise you can directly move to Creating service client section:
1.
2.
Double click the jar or extract it some other way (lets say at C:\jax-ws)
3.
Now you need to set an environment variable JAXWS_HOME and give the root folder of JAX-WS as value of
this variable e.g. JAXWS_HOME = C:\jax-ws
4.
Example:
Lets consume the Currency Convertor web service provided by http://www.websericeX.net. You may find this
service at http://www.webservicex.net/ws/WSDetails.aspx?WSID=10&CATID=2.
This service defines an operation ConversionRate that take two parameters FromCurrency and ToCurrency and
returns a type double value. FromCurrency and ToCurrency are of type strings. In java code well pass two strings and
expect a double value from this service. Lets see how we can do this.
2.
3.
Create a Driver class (any java class that will execute the code)
4.
Now simply create objects of genereated service classes and assemble them togather to use the service.
The questions like Which objects are to be created and How to assemble them can be answered by reading
the WSDL file through which we have created the source code.
5.
For this particular example (and also for general guideline) please see the following piece of code that will
use the service:
import net.webservicex.*;
2
3
4
5
8
9
10
11
12
13
14
15
16
17
18