- a Squeak SOAP RPC implementation -
SoapCore is a SOAP part of SoapOpera.
SoapCore provides very simple API for Soap RPC.
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
.
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.
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:
You can also use "literal" scheme by setting useLiteral: true.
call useLiteral: true.
SoapOpera0.5 has achieved some interoperability with other SOAP implementations. The World will become one. Enjoy!
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!
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.
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.