function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
laxmilaxmi 

webservice

hi all,


        I am new to this webservice concept, i have created small exapmle of webservice and created the webtab
also how to link the webtab and s-controle, what should i write in s-controle



help me,



thanks

ckempckemp
Put something like this in the <head> of the S-control:

Code:
<script>
function doCallViaWS(param1, param2) {

  sforce.apex.debug = true;
  result = sforce.apex.execute('TheClassNameThatDoesTheWebServiceCall', 'theMethodToCall', {firstValueToPass:param1, secondValueToPass:param2});

  document.getElementById('writeableArea').innerHTML = result;  // to output the result
}
</script>

And put something like this in the <body>:

Code:
  <div id="writeableArea">
  </div>

<form onSubmit="javascript:doCallViaWS(document.getElementById('firstFormElementToPass').value, document.getElementById('secondFormElementToPass').value); return false;">

The onSubmit will send the two form elements (it can be however many you want) and use the doCallViaWS() function above to make the web service call with the theMethodToCall() method in TheClassNameThatDoesTheWebServiceCall in this example.  That class simply uses the objects you've generated from your WSDL to make the call.