## SoapCore ##

- 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 #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.

Sample services are running here.

Supported Encodings:

SoapCore supports multi-encodings for passing data. There are merits and demerits. Please select what is appropriate for your purpose.


 call encoding: #soapSqEncoding. "<-- you can specify encoding scheme here"

Supported encoding symbols are:

#soapEncoding
Default, not so cool, but SOAP 1.1 compliant
#soapSqEncoding
Squeak native base64 format, powerful for complex objects, but loses interoperability
#soapSixxEncoding (included in full installation)
Portable Smalltalk XML format, usable for complex objects, but need to translate XML for interoperability with other languages
#soapSrpEncoding (included in full installation)
Portable Smalltalk binary format, interoperable with other Smalltalks
#nullEncoding
tries to pass object 'as is', very fast, usable only for very primitive types (byte array, etc)

You can also use "literal" scheme by setting useLiteral: true.

call useLiteral: true.

*SoapCore Interop Examples*:

SoapOpera0.5 has achieved some interoperability with other SOAP implementations. The World will become one. Enjoy!

1: 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 type is very limited. But It works!

2: Dolphin Smalltalk

There is a guide for Dolphin Spray and SoapOpera Interop (screenshot).
First you should read it. (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.

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.

3: Google Web API

Colocation

Colocation is a feature for optimization. SoapCore automatically changes RPCs to local calls if their receivers are in local environment.

To activate this feature:

call useColocation: true.

Suggestions?

Any feedback is welcome.

^back to SoapOpera top

Masashi Umezawa