Site Sponsors:
Taking Stock from XMethods.org 
From the corporation to the cloud, today more and more people are talking about "Web Services." Indeed, whilst most folks understandably feel that GET, POST, and HTML have certainly been serving us all rather well, the hottest trend in recent memory is to provide XML-based Web Services.

A few years back SOAP based Services were so 'hot' that IBM, Microsoft, and XMethods all provided phone-book type repositories for 3rd part Web Services. Today however, the last standing place to go for free-and-open independent Web Services remains the same as before the others came and went: XMethods.org.

For the sake of efficiency, the current underpinnings for Web Service delivery is decidedly moving away from fat-and-chatty XML-centric content-exchange. Yet while conventions such as REST and JSON offer very real performance alternatives to SOAP, when it come to exchanging service definitions, XML remains king.

Since the new crop of XML-defined Web Services are at the heart of everything from SOA to ESB, whenever there is an interest in a class I like to present a short meandering past the WSDL workings of XMethods. While I have hosted a few services there myself, since Microsoft's second MSXML melt-down, in class my students and I like to use a free Stock Quote Service.


package com.soft9000;

import java.rmi.RemoteException;

import net.restfulwebservices.www.DataContracts._2008._01.StockQuote;
import net.restfulwebservices.www.ServiceContracts._2008._01.IStockQuoteServiceProxy;

public class Main {

public static void main(String[] args) {
IStockQuoteServiceProxy pox = new IStockQuoteServiceProxy();
try {
StockQuote quote = pox.getLastQuote("IBM");
System.out.println(quote.getHigh());
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}


Of course, the best part of defining services in XML is that once we paste the endpoint (or - depending upon the IDE - the XML document itself) that code can be generated.

The rest is academic - but the above is an example of how to use one of the many XMethods web services under Eclipse.

Enjoy,

-Rn


[ view entry ] ( 2362 views )   |  permalink  |  related link

<<First <Back | 1 | 2 | 3 | 4 | 5 |