How to convert this curl in meteor HTTP Package? How to convert this curl in meteor HTTP Package? curl curl

How to convert this curl in meteor HTTP Package?


Here is an example of some code where I do a http GET

var opts = {npmRequestOptions: {rejectUnauthorized:false, jar: true, contentType: 'text/plain'},    headers: {Authorization: "Bearer "+p.access_token}};var url = p.protocol+'://'    +p.guardiumIP+':'    +p.guardiumPort    +'/restAPI/policy';console.log("url="+url);var curlcmd = "curl -k --header \"Authorization:Bearer"+p.access_token+"\"";curlcmd += " -i -H \"Content-Type: application/json\" -X GET ";curlcmd += url;console.log("cmd would be "+curlcmd);HTTP.get(url,opts,PoliciesCB);

You'll notice in the code that I also build a curl command and log it to the console, in case I need to use curl manually to look closer at the data coming back.

In its minimal form it would look like this:

var opts = {npmRequestOptions: {rejectUnauthorized:false, jar: true, contentType: 'text/plain'},    headers: {Authorization: "Bearer "+p.access_token}};var url = p.protocol+'://'    +p.guardiumIP+':'    +p.guardiumPort    +'/restAPI/policy';var curlcmd = "curl -k --header \"Authorization:Bearer"+p.access_token+"\"";HTTP.get(url,opts,PoliciesCB);


meteor add zardak:soap

Install this package in root of application folder. then try with those following codes.

var url = 'http://example.com/wsdl?wsdl';var args = {name: 'value'};try {  var client = Soap.createClient(url);  var result = client.MyFunction(args); console.log(result);}catch (err) {  if(err.error === 'soap-creation') {    console.log('SOAP Client creation failed');  }  else if (err.error === 'soap-method') {    console.log('SOAP Method call failed');  }}

You can do any soap api calls with these functions. for more details visit : https://atmospherejs.com/zardak/soap