The Barnes and Noble price service gets the price of a book based on its ISDN number.
<?xml version="1.0"?> <definitions name="BNQuoteService" targetNamespace="http://www.xmethods.net/sd/BNQuoteService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.xmethods.net/sd/BNQuoteService.wsdl" > <message name="getPriceRequest"> <part name="isbn" type="xsd:string"/> </message> <message name="getPriceResponse"> <part name="return" type="xsd:float"/> </message> <portType name="BNQuotePortType"> <operation name="getPrice"> <input message="tns:getPriceRequest" name="getPrice"/> <output message="tns:getPriceResponse" name="getPriceResponse"/> </operation> </portType> <binding name="BNQuoteBinding" type="tns:BNQuotePortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getPrice"> <soap:operation soapAction=""/> <input name="getPrice"> <soap:body use="encoded" namespace="urn:xmethods-BNPriceCheck" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output name="getPriceResponse"> <soap:body use="encoded" namespace="urn:xmethods-BNPriceCheck" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="BNQuoteService"> <documentation>Returns price of a book at BN.com given an ISBN number</documentation> <port name="BNQuotePort" binding="tns:BNQuoteBinding"> <soap:address location="http://services.xmethods.net:80/soap/servlet/rpcrouter"/> </port> </service> </definitions>
If you invoke wsdl2java on the above WSDL document, you can run this client to interact with the service:
package quote; import javax.naming.InitialContext; public class Client { public static void main(String[] args) throws Exception { | // check Alan Watts: The Book by default | String isbn = args.length > 0 ? args[0] : "0679723005"; | InitialContext ctx = new InitialContext(); | BNQuoteService service = | (BNQuoteService) ctx.lookup("xmlrpc:soap:quote.BNQuoteService"); | BNQuotePortType quote = service.getBNQuotePort(); | System.out.println(isbn + " costs $" + quote.getPrice(isbn)); } }
Please refer to the README file for details on how to build and run the example.
Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.