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
GorkyGorky 

WebService Call trough S-Control.

Hi Everyone.

There's any way to consume a WebService and work whit its result?

Thanks.
tmatthiesentmatthiesen
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_and_ajax.htm
GorkyGorky
Thanks.

I have created a new classes using Generate WSDL
and the example explained on the SF doc with the StrikeIron IP address lookup service.

Then I have created the stub class...(can be a method or a webservice too??), the same code that appears on the doc.

 class ..... Replicator(String args){
// Create the stub
     strikeironIplookup.DNSSoap dns = new strikeironIplookup.DNSSoap();
// Set up the license header
      dns.LicenseInfo = new strikeiron.LicenseInfo();
      dns.LicenseInfo.RegisteredUser = new strikeiron.RegisteredUser();
      dns.LicenseInfo.RegisteredUser.UserID = 'you@company.com';
      dns.LicenseInfo.RegisteredUser.Password = 'your-password';
// Make the Web service call
      strikeironIplookup.DNSInfo info = dns.DNSLookup('www.myname.com');

}


All compiles right. Now the question is... how can I consum this webservice from a S-Control?


I'd tried something like this ont he s-control
var result = sforce.apex.execute('tempuriOrg' , 'Replicator',{arg:"new Apex user!"} );
alert(result);
</script>


The call works don't work because a class problem. It seems to fails when at this line  of the class
strikeironIplookup.DNSInfo info = dns.DNSLookup('www.myname.com')

If I comment that line strikeironIplookup.DNSInfo info = dns.DNSLookup('www.myname.com'), and I put a return Strings, works and the string is returnet and printed out on the s-control.

The code on S-Control.
var result = sforce.apex.execute('tempuriOrg' , 'Replicator',{arg:"new Apex user!"} );
alert ('DEBUG 1 xx ');
alert('DEBUG 2 xx ');
alert(result);


Thanks!