18.02.2015 Views

5ml User's Guide

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>5ml</strong> <strong>User's</strong> <strong>Guide</strong><br />

var data = {<br />

'zip' : '23454',<br />

'country' : 'UK'<br />

};<br />

fiveml.proxy.sendRequest('http://wsf.cdyne.com/WeatherWS/Weather.asmx/<br />

GetCityForecastByZIP','GET', data, function(req){alert(req.responseText);<br />

});<br />

Sending a POST HTTP Request to a Web Service Expecting JSON Data<br />

function jsonPost() {<br />

var data = {<br />

"clientId" : "corning_gorilla",<br />

"msgId" : '1',<br />

"msisdns" : [ "+11234343434" ],<br />

"params" : {<br />

"name" : "test"<br />

}<br />

}<br />

var headers = {<br />

'Content-Type' : fiveml.proxy.TYPE_JSON,<br />

'Accept' : 'application/json',<br />

'User-Agent' : 'Firefox'<br />

}<br />

fiveml.proxy.sendRequest("http://some.remoteservice.net/api/json", 'POST', data,<br />

function(req){alert(req.responseText);<br />

}, headers);<br />

}<br />

- 229 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!