Topic
  • 1 reply
  • Latest Post - ‏2012-04-22T09:00:11Z by IdanAdar
SystemAdmin
SystemAdmin
570 Posts

Pinned topic Call HTTP adapter with params

‏2012-04-20T15:15:28Z |
How I can call http adapter procedure with params ?
How I can call http adapter procedure with params ? I created something like this, but not work : :cry: What I do wrong ?


function callAdapter(params) 
{ var invocationData = 
{ adapter : 
'SampleAdapter', procedure : 
'adapterProcedure', parameters : [params] 
}; WL.Client.invokeProcedure(invocationData,
{ onSuccess : loadSuccess, onFailure : loadFailure, 
}); 
} function loadSuccess(result) 
{ WL.Logger.debug(
"Feed retrieve success"); 
}   function loadFailure(result) 
{ WL.Logger.debug(result); 
}


adapter-impl.js

function adapterProcedure(param) 
{ var request = 
"<soapenv:Envelope\ xmlns:soapenv="http:
//schemas.xmlsoap.org/soap/envelope/"\ xmlns:web=
"http://www.webserviceX.NET/">\ <soapenv:Header/>\ <soapenv:Body>\ <web:ConversionRate>\ <web:FromCurrency>
"+ param +"</web:FromCurrency>\  
// I use my param this <web:ToCurrency>AUD</web:ToCurrency>\ </web:ConversionRate>\ </soapenv:Body>\ </soapenv:Envelope>
";   var input = 
{ method : 
'post', returnedContentType : 
'xml', path : 
'web/service/path', body: 
{ content: request.toString(), contentType: 
'text/xml; charset=utf-8' 
} 
}; 

return WL.Server.invokeHttp(input); 
}
  • IdanAdar
    IdanAdar
    288 Posts

    Re: Call HTTP adapter with params

    ‏2012-04-22T09:00:11Z  
    Andrey,

    1. Any error messages?
    2. Look at modules 6_0 and 6_1 for procedure invocation examples.