Skip to Content
1
Former Member
Mar 20, 2015 at 12:37 PM

REST Service call in Studio

745 Views

Hi,

I am trying to consume a web service call (from hybris) in a script file in Studio. I have created the communication arrangement, scenario and even tested the arrangement's connection ping and it was successful. My code as shown below:

var URLParameter : collectionof NameAndValue;

var headerParam : collectionof NameAndValue; //

var URLParameterEntry : NameAndValue;

//XX.XXX.XX.XXX:9001/ws410/rest/catalogs/powertoolsProductCatalog/catalogversions/Online/products/2116275

URLParameterEntry.Name = "products";

URLParameterEntry.Value = "2116275";

//URLParameter.Add(URLParameterEntry);

var httpResource = "powertoolsProductCatalog/catalogversions/Online/products/";

httpResource = httpResource + "2116275";

var httpMethod = "PUT";

var body = "<product code=\"2116275\"><catalogVersion version=\"Online\"><catalog id=\"powertoolsProductCatalog\"/></catalogVersion><name>Prashanth</name></product>";

var httpformat = "text/xml; charset=UTF-8";

var result = WebServiceUtilities.ExecuteRESTService("CloudhybrisProdUpdate","CloudhybrisProdupdate",httpMethod,httpResource,URLParameter,headerParam,httpformat,body);

var position = result.Content;

var res = result.RequestURL;

var resp = result.HeaderParameters;

in this code, instead of PUT method, if I pass "GET", I am getting the response. However, for "PUT" the result variable is completely blank. Please can you help?