I have a c++ class that is doing soap at a low level.
I want to port this application to RB and use its SOAP methods.
the c++ code is as follows:
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\"?>\r\n";
xml += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/
\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r
\n";
xml += " <s:Body>\r\n";
xml += " <u:GetExternalIPAddress xmlns:u=\"urn:schemas-upnp-
org:service:WANIPConnection:1\"/>\r\n";
xml += " </s:Body>\r\n";
xml += "</s:Envelope>\r\n";
htmlpost += "POST /control?WANIPConnection HTTP/1.1\r\n";
htmlpost += "HOST: ";
htmlpost += gatewayIPAddress;
htmlpost += ":";
htmlpost += itoa(gatewayPort, buffer, 10);
htmlpost += "\r\n";
htmlpost += "CONTENT-LENGTH: ";
htmlpost += itoa(xml.length(), buffer, 10);
htmlpost += "\r\n";
htmlpost += "CONTENT-TYPE: text/xml ; charset=\"utf-8\"\r\n";
htmlpost += "SOAPACTION: \"urn:schemas-upnp-
org:service:WANIPConnection:1#GetExternalIPAddress\"\r\n";
htmlpost += "\r\n";
htmlpost += xml;
poster.send(htmlpost.c_str(), htmlpost.length());
int rc = poster.recv(buffer, sizeof(buffer));
buffer[rc] = '\0';
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();
}
I believe the methods needed to do this in RB must looks something
like:
Dim sm as SoapMethod
Dim sr as SOAPResult
// create the soap method and set the parameter(s)
sm = New SoapMethod
sm.parameter(???) = ???
// set soap method properties
sm.methodNamespace = ???
sm.action = ???
sm.url = ??? GatewayIPAddres:GatewayPort (Some such thing)
// execute the method
sr = sm.invoke("GetExternalIPAddress")
// display the ExternalIPAddress portion of the result
MsgBox sr.result("NewExternalIPAddress")
Sorta new to RB and SOAP at this level...