A Simple SOAP Client

Talking to a SOAP server that provides Fibonacci numbers is not significantly harder than talking to an XML-RPC server. You just have to adjust the syntax of your request to use SOAP instead of XML-RPC. Again, we'll talk to a Fibonacci generator I'll develop in later chapters, but you can preview that at http://www.elharo.com/fibonacci/SOAP. The body of each request document contains a calculateFibonacci element in the http://namespaces.cafeconleche.org/xmljava/ch3/ namespace. This element contains a single positive integer:

 <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <SOAP-ENV:Body> <calculateFibonacci xmlns="http://namespaces.cafeconleche.org/xmljava/ch3/" ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.