Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Realbasic > A Question abou...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3262 of 3314
Post > Topic >>

A Question about using SOAP in REALbasic

by SpreadTooThin <bjobrien62@[EMAIL PROTECTED] > Sep 12, 2007 at 12:04 PM

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




 1 Posts in Topic:
A Question about using SOAP in REALbasic
SpreadTooThin <bjobrie  2007-09-12 12:04:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 11:04:24 CDT 2008.