A Question about SOAP

A Question about SOAP

I wrote a UPnP Internet Gateway Device Class in C++ with raw tcp/ip
and udp calls.

I want to now port that code to a high level interpreter that
supplies
SOAP methods.
I need some help 'filling in the blanks' in this high level language.

Here is the C++ method:

//This code sends a message to the gateway to inquire about the
external IP address. It builds up the soap envelope and message then
posts //it and gets the response, parses it to extract the desired
value.

void IGD::getExternalIPAddress(std::string & NewExternalIPAddress) {
tcpclient poster;
std::string htmlpost, xml;
char buffer[2048];

poster.connect((char *) gatewayIPAddress.c_str(), gatewayPort);

xml += "<?xml version="1.0"?>
";
xml += "http://schemas.xmlsoap.org/soap/
envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/
">
";
xml += "
";
xml += " "urn:schemas-upnp-
org:service:WANIPConnection:1"/>
";
xml += "

";
xml += "

";

htmlpost += "POST /control?WANIPConnection HTTP/1.1
";
htmlpost += "HOST: ";
htmlpost += gatewayIPAddress;
htmlpost += ":";
htmlpost += itoa(gatewayPort, buffer, 10);
htmlpost += "
";
htmlpost += "CONTENT-LENGTH: ";
htmlpost += itoa(xml.length(), buffer, 10);
htmlpost += "
";
htmlpost += "CONTENT-TYPE: text/xml ; charset="utf-8"
";
htmlpost += "SOAPACTION: "urn:schemas-upnp-
org:service:WANIPConnection:1#GetExternalIPAddress"
";
htmlpost += "
";
htmlpost += xml;

poster.send(htmlpost.c_str(), htmlpost.length());
int rc = poster.recv(buffer, sizeof(buffer));
buffer[rc] = '';

HtmlMsg serverResp(buffer);

checkResponse(serverResp);

std::string xmlText = serverResp.getXml();

xmlObj xmlO(xmlText);
std::cout << xmlO;
xmlEntry e = xmlO.get("s:Envelope/s:Body/
u:GetExternalIPAddressResponse/NewExternalIPAddress");
NewExternalIPAddress = e.getValue();

}

The REALbasic interpreter provides a brief example of a soap call and
I'm trying to use it, but I don't understand the parameters its
asking
for.
Dim sm as SoapMethod
Dim sr as SOAPResult
// create the soap method and set the parameter(s)
sm = New SoapMethod
sm.parameter("USZip") = "12345"

// set soap method properties
sm.methodNamespace = "http://www.webserviceX
.NET
"
sm.action = "http://www.webserviceX.NET/GetInfoByZIP"
sm.url = "http://www.webserviceX.NET/uszip.asmx"

// execute the method
sr = sm.invoke("GetInfoByZIP")

// display the Area_Code portion of the result
MsgBox sr.result("Area_Code")

The sm object has these attributes that can be set:
action
connection
inputParams
methodName
methodNamespace
namespaces
paramTypes
timeout
url
wsdl

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.