*!* http://www.capescience.net/webservices/airportweather/index.shtml LOCAL loConn as MSSoap.HttpConnector, ; loSerializer as MSSoap.SoapSerializer, ; loReader as MSSoap.SoapReader loConn = CREATEOBJECT("MSSoap.HttpConnector") loSerializer = CREATEOBJECT("MSSoap.SoapSerializer") loReader = CREATEOBJECT("MSSoap.SoapReader") *!* loConn is an HTTPConnector: it actually sends the messages through HTTP to the *!* web service which is specified as the EndPointURL. Many connector properties are *!* exposed through the Property() collection, rather than being addressed as *!* loConn.EndPointURL, for example. loConn.Property("EndPointURL") = "http://live.capescience.com/ccx/AirportWeather" loConn.Connect() *!* BeginMessage tells the web service that we're going to start talking to it. *!* The Connector has an InputStream and an OutputStream -- we send data by *!* writing to the InputStream, and read it out from the OutputStream. loConn.BeginMessage() *!* The SOAPSerializer object builds a SOAP message while hiding us from the *!* nitty-gritty of the XML it's building. It builds the message, and sends *!* it out on the InputStream it's passed in the Init. loSerializer.Init(loConn.InputStream) *!* Here's where we start building the message. Inside the envelope, you can *!* specify other parameters, such as encoding: however, I found that this *!* service works fine with the defaults. loSerializer.startEnvelope() loSerializer.startBody *!* The method call and its parameters are all XML elements within the message, *!* so we just need to add them as such. First we add the name of the element. *!* Then we add the namespace within which it is found, and the encoding it uses. *!* If you don't specify the namespace, the service will throw all sorts of *!* nasty java-ish error messages at you. :-) loSerializer.startElement("getTemperature" , ; "capeconnect:AirportWeather:com.capeclear.weatherstation.Station", ; "NONE") *!* The arguments are elements within the method element. loSerializer.startElement("arg0") *!* WriteString is how we send straight text to the serializer loSerializer.writeString("KPVD") *!* Here we close the various elements we've opened. loSerializer.endElement() loSerializer.endElement() loSerializer.endBody() loSerializer.endEnvelope() loConn.endMessage() *!* The message we've just generated looks something like this, copied from the link *!* above. It probably looks a bit different, as I found that I didn't have to specify *!* all the parameters that the sample I was reading used. *!* <?xml version="1.0" encoding="UTF-8" standalone="no" ?> *!* <SOAP-ENV:Envelope *!* SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" *!* xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> *!* <SOAP-ENV:Body> *!* <ns1:getTemperature *!* xmlns:ns1="capeconnect:AirportWeather:com.capeclear.weatherstation.Station"> *!* <arg0>KPVD</arg0> *!* </ns1:getTemperature> *!* </SOAP-ENV:Body> *!* </SOAP-ENV:Envelope> *!* We now load the outputStream from the HTTPConnector into a SOAPReader. *!* This changes the XML into an object that we can operate on. In this *!* case, I just output everything I get back. IF loReader.Load(loConn.OutputStream) ? "-----------------------------" ? loReader.DOM.xml ? "Or: -------------------------" ? loReader.DOM.text ? "-----------------------------" ELSE ? "Could not read results" ENDif