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

Development on iSOAP is far from complete. Additional functionality, including the following, is planned for the future:

  • WSDL mode
  • complex argument types

Downloads

There is currently *NO* stable version of iSOAP; it's currently at the alpha stage. Its structure may change at any time (though I'll really, really try not to do this in any way that would break existing software). But, if you're willing to give it a whirl, you can download it here:

iSOAP-0.5.zip

License

iSOAP is licensed under the BSD License. If you want to modify it and and use it in a proprietary project, that's fine by me. However, if you make modifications or improvements, I'd love to have you contribute back to the project.

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

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