Http plugin in Servoy 5.2

I’ve been looking at the documentation for plugin.http in 5.2 compared to 6.x and note the additional functions in the latter, such as PutRequest and GetRequest, which are not available in 5.2

Can the 6.x plugin be used with 5.2 to access the fuller range of functions?

If not, can someone help me with the 5.2 syntax for a simple servoy method to call a RESTful webservice on another server with HTTP PUT and pass a single integer as an argument. The effect I’m looking for is to invoke the ws_update method on the other server, passing it the pk of a record.

Hello,

The 6.0 plugin cannot be moved back to 5.2

Below is some sample code using the http plugin in 5.2 (which is different from version 6.x of servoy).

The sample is talking to a SOAP webservice, which is different than restful, but it may help.

Good Luck,
Lach

// sample code from a SOAP call
var poster = plugins.http.getPoster(“web service url”)

// header content key/value pairs
poster.addHeader (‘Host’,cc_PosterURL)
poster.addHeader (‘User-Agent’, ‘Agent’)
poster.addHeader (‘Content-type’,cc_ContentType)
poster.addHeader (‘Soapaction’,‘’)

// content
poster.addParameter(null,httpCode) // httpCode is a massive xml string

// post
var posted = poster.doPost();

var result = poster.getPageData();

result = result.replace(/^<?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*?>/, “”) // strip header information
var xml = XML(result)

var jsXml = soapToJSObject(xml) // convert xml to json