Improved SOAP for REALbasic
Improved SOAP for REALbasic (iSOAP) is a set of RB class modules that were created to address shortcomings in the native REALbasic SOAPMethod class.
Improvements over the native SOAPMethod class include:
- ability to use a HTTP proxy to send SOAP requests
- support for base64binary parameters
- ability to set the method namespace of the SOAP request
- use of (and access to) a subclassed HTTPSocket to send the request and receive the response
The goals of the iSOAP module are to provide the developer with as much control over the generation of the SOAP request as possible, and to support any parameter type supported by the SOAP standard.
The Future
I'm not sure what is going to become of this project. I haven't used REALbasic for anything in about 1.5 years. That's not to say I won't again in the future ... I just don't have the time to dabble in it right now. So, since there still appears to be a need for such a project, based on emails I've received recently, I'm posting this on Google Code with the hopes that it will help somebody else, and that perhaps its development can be continued.
If you're interested in contributing to this, drop me an email and let me know.
Using iSOAP
Once you've imported the iSOAP class modules into your project, making a simple SOAP request would look like the following code, which is taken (more or less) from a working prototype project that connects to the eXist XML database:
dim isoap as new ISOAPClient
dim response as ISOAPResponse
dim responseXML as XMLDocument
' Proxy Configuration (If Necessary); if these vars aren't set, the proxy will not be used
isoap.socket.HTTPProxyAddress = "proxy.example.com"
isoap.socket.HTTPProxyPort = 8080
' Request Configuration
isoap.hostname = "exist.example.com"
isoap.port = 1040
isoap.path = "/exist/services/Admin"
isoap.methodNamespace = "urn:exist"
' Add parameters and try to connect.
isoap.addParam(getParam("userId", "username", "xsd:string"))
isoap.addParam(getParam("password", "password", "xsd:string"))
isoap.methodName = "connect"
isoap.soapAction = "exist:Admin:connect"
try
response = me.adminConn.invoke
catch e as NilObjectException
me.raiseException(0, "Could not connect to host!")
catch e as ISOAPException
me.raiseException(e.errorNumber, e.message)
end
responseXML = response.getXMLOnce you've invoked a SOAP method, you can then re-use the same object you created to send another request by changing whatever parameters are necessary and calling iSOAPClient.invoke again.