open an xml server

I am trying to open a server in Xojo. It’s for getting an xml from the google server.

we want to grabbing our string and it’s sending it to the internet and google will respond with text which comes back in response text (xml)

Sreq is the string

A lot of these commands seem unavailable in Xojo - whats the equivilent?

 'create the XMLHTTP object
        Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")

Set xmldoc = CreateObject("Msxml2.DOMDocument")
  'send the request and get the address search data - always returns max of 5 records
  XMLHTTP.Open "GET", sReq, False
  XMLHTTP.send

xmldoc.loadXml XMLHTTP.responseText

There is no direct translation, but Xojo does have a robust XML library. You’ll need to use a HTTPSocket (or HTTPSecureSocket) to get the response then parse the content of that response. @Paul Lefebvre has made many Tutorials on accessing restful api’s with Xojo which will get you through the first part. Use the LR to see how to load your content into a XMLDocument.

Me and my friend have been looking through the XML library but we found no way to send our string to this server…
It’s also a web app… we have a java script version… Is there a way to run javascript in the web edition?

The Xml library will give you a string as in XMLDocument.ToString, but you’ll need to build your own HTTP Request to send this string.

Java is used extensively at the client end and you can send java scripts to the client to run, but I’ve not seen how you could use Java at the server end. It would be better to migrate java to Xojo and use the built in tools.

MBS probably has a solution.

Use HTTPSocket to send the request. The result will be the XML string.

As a matter of fact, the content in pagerecieved in the http socket gives me HTML and not the XML.
When I paste the string of the url that I give to httpscket into the browser, it gives me the XML.

I went through all the variables in the pagerecieved method and none of them gave me the XML.

An ideas?

And the HTML does not include the XML? What is in the HTML? Are you getting an error page?

[quote=244056:@Sean Clancy]As a matter of fact, the content in pagerecieved in the http socket gives me HTML and not the XML.
When I paste the string of the url that I give to httpscket into the browser, it gives me the XML.

I went through all the variables in the pagerecieved method and none of them gave me the XML.

An ideas?[/quote]
Yes. Follow the suggestions from everyone to use httpsocket. That gives you the way to download the xml and then use the xmldocument class to manipulate the response. In reality, the code can be directly translated to Xojo. I’ve intermixed the JavaScript(commented) with Xojo code:

[code] 'create the XMLHTTP object
//Set XMLHTTP = CreateObject(“MSXML2.ServerXMLHTTP”)
Dim XMLHTTP as new httpsocket

// Set xmldoc = CreateObject(“Msxml2.DOMDocument”)
Dom xmldoc as new xmldocument

'send the request and get the address search data - always returns max of 5 records
// XMLHTTP.Open “GET”, sReq, False
// XMLHTTP.send
Dim s as string = XMLHTTP.Get(sReq, 30)

xmldoc.loadXmL(s)[/code]

I tried the code and I wasn’t getting anything for s…
Also, the 30 second wait is quite long… When I entered sReq into the browser it pulled up the XML instantly…

Any other Ideas?
Sean

Redirect? Cookies? The browser performs all kinds of magic on your behalf.

/umm… I don’t get it?

[quote=244073:@Sean Clancy]I tried the code and I wasn’t getting anything for s…
Also, the 30 second wait is quite long… When I entered sReq into the browser it pulled up the XML instantly…

Any other Ideas?
Sean[/quote]
The code I posted works here. If you would tell us which url you’re using, perhaps we can tell you what’s going on.

FYI, 30 seconds is the timeout. If it gets something back, it doesn’t wait that long.