[prev] [up] [next]

SOAP

Overview

SOAP (Simple Object Access Protocol) is (no longer) a lightweight, XML based protocol for exchange of information in a distributed environment.
The SOAP protocol is also used by Microsofts .NET web service architecture.

For the programmer, SOAP makes available an easy to use, language and system independent remote procedure call mechanism, as SOAP implementations are available for a wide range of programming languages and operating system configurations.

Documentation

Information on SOAP itself is found on www.w3.org.
Information on SOAPOpera, the SOAP implementation for Smalltalk is found on its home site, http://www.mars.dti.ne.jp/~umejava/smalltalk/soapOpera/soapCore.html

If you cannot access the internet, here is an extract from that site;
in addition, use the source - Luke, for information on the implementation.

- a Squeak SOAP RPC implementation -

SoapCore Examples:

SoapCore is a SOAP part of SoapOpera.

SoapCore provides very simple API for Soap RPC.

Server side:

Suppose you have a HelloWorldImpl class which has method named helloWorld.
To register the helloWorld service:


    service := SoapService implementor: (HelloWorldImpl new ) selector: #helloWorld.
    service signature: (SoapServiceSignature name: 'helloWorld').
    SoapServiceHandler default add: service

Client side:

Suppose you have registered the helloWorld service in the host named 'someHost'.
To invoke the helloWorld service:


    call := (SoapCallEntry tcpHost: 'someHost') newCall.
    call transport: #http.
    call methodName: 'helloWorld'.
    ^ call invokeAndReturn.
there is also a shorter call-setup alternative:

    call := SoapCall methodName: 'helloWorld' tcpHost: 'someHost'.
    ^ call invokeAndReturn.

*SoapCore Interop Examples*:

SoapOpera0.5 has achieved some interoperability with other SOAP implementations.

The World will become one. Enjoy!

1: Example: SOAP call from Ruby

From SOAP4R Client:
DOWNLOAD: SOAP4R Client Examples

To invoke the helloWorld service:


    #!/usr/bin/env ruby

    require 'soap/driver'

    server = 'http://someHost:8823/'
    drv = SOAP::Driver.new( nil, nil, nil, server)
    drv.addMethod('helloWorld')
    drv.setWireDumpDev( STDERR )
    p drv.helloWorld()

Currently, sending data types are very limited. But It works!

2:Example: SOAP call from Dolphin Smalltalk (or any other Spray SOAP implementation)

There is a guide for Dolphin Spray and SoapOpera Interop (screenshot).
You should read it first. (Thanks Steve Waring!)

DOWNLOAD: Spray-SoapOpera interop Examples

From Spray Client -> SoapOpera Server:

To invoke the reverseString service:


    "call 'reverseString' service"
    request := SplashRPCRequest method: 'reverseString' 
				ns: #'http://www.mars.dti.ne.jp/~umejava/smalltalk/soapOpera/rpc/'.
    request parameterAt: #aString put: 'Hello from Dolphin'.
    response := request responseFrom: 'http://localhost:8823/' soapAction: nil.
    response return.

3:Example: SOAP call from any other SOAP Opera implementation

From SoapOperaClient -> Spray Server:

There is a Spray interop test server available in the internet.
You can call services from SoapOpera Client.
To invoke the browseClassDefinition service:


    | call resp |
    call := (SoapCallEntry tcpHost: 'www.dolphinharbor.org' port: 80) newCall.
    call targetObjectURI: '/services/soapOperaInterop'.
    call methodName: 'browseClassDefinition'.
    call addParameter: (SoapVariable name: #className value: 'SoapOperaInterop').
    call invokeAndReturn.
    

Suggestions?

Any feedback is welcome.
Masashi Umezawa

Code Examples

Have a look at the example classes found in the "SOAP-ExampleClients" category . These examples implement various clients towards existing SOAP-based web services, among them are a translation service (BabelFish), spelling corrector (Google), a Stock-Quote requestor, and a currency exchange rate converter (browse the SOAP-ExampleClients category to see the code).

The HelloWorldServer class implements both a server and a client API, and is probably the easiest possible demo.
A real world SOAP client application is the TranslationServiceApplication, which uses the BabelFish translation service (see www.xmethods.net).

Server Setup

To provide a Web service as a Server, the HTTPServer must be configured and running. Notice, that no HTTP services are required for SOAP net services - i.e. the HTTPServer can be configured without any HTTP service, but with SOAP enabled. (that results in an HTTPServer, which ONLY serves SOAP requests).
Also notice, that the HTTPServer can be configured to listen on any port - for SOAP services, the typical (default) port is 8823.

Licensing

These addOn packages are NOT to be considered part of the base ST/X system. They are provided physically with the ST/X delivery, but only for your convenience.

Legally, they are freeware or public domain goodies, as specified in corresponding goodies copyright notices.
See the licence info files found in the goodies directories and/or the class files', and/or the classes documentation methods.

No Warranty

This goody is provided AS-IS without any warranty whatsoever.

Origin/Authors

Masashi Umezawa (SoapOpera and SoapOrb)
Steve Waring (Spray Dolphin version)


<info@exept.de>

Doc $Revision: 1.19 $