+ Start a Discussion

How to call external dotnet web services with parameters?

       Please guide me where i can get the working samples on how to call external dotnet web services with parameters and capture the response back and display it within force.com.

   I have created Apex Class from .NET WSDL. But while accessing methods of that class in a S-control I am not getting any response or error.  The generated apex class  is as follows:

//Generated by wsdl2apex

public class tempuriOrg {
public class HelloWorld_element {
private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
private String[] field_order_type_info = new String[]{};
public class ServiceSoap {
public String endpoint_x = 'http://localhost:2351/SampleWebSer/Service.asmx';
private String[] ns_map_type_info = new String[]{'http://tempuri.org/', 'tempuriOrg', 'http://doc.sample.com/docSample', 'docSampleComDocsample'};
public String HelloWorld() {
tempuriOrg.HelloWorld_element request_x = new tempuriOrg.HelloWorld_element();
tempuriOrg.HelloWorldResponse_element response_x;
Map<String, tempuriOrg.HelloWorldResponse_element> response_map_x = new Map<String, tempuriOrg.HelloWorldResponse_element>();
response_map_x.put('response_x', response_x);
new String[]{endpoint_x,
response_x = response_map_x.get('response_x');
return response_x.HelloWorldResult;
public class HelloWorldResponse_element {
public String HelloWorldResult;
private String[] HelloWorldResult_type_info = new String[]{'HelloWorldResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
private String[] field_order_type_info = new String[]{'HelloWorldResult'};

I have accessed this class methods in S-control as :



<script type="text/javascript" src="/js/functions.js"></script>

<script src="/soap/ajax/11.0/connection.js"></script>

<script src="/soap/ajax/11.0/apex.js"></script>


function demo()

var result = sforce.apex.execute('tempuriOrg.ServiceSoap' , 'HelloWorld' );

document.getElementById('userNameArea').innerHTML = result;




<body onload=demo()>

<div id=userNameArea>



Please tell me about  how to debug apex code step by step. Also any guidence related to above problem will be very helpful.

Thanks in advance ..

Well, for one thing, you didn't actually define any webService methods in your Apex.  You have to make a method with the webService keyword for your AJAX to call.

May I suggest you reread the Force.com Cookbook starting with page 67?  It covers this topic exactly.
Visit the following link : http://sriramp84.blogspot.in/2012/10/salesforceapex-callout-to-external.html

it works fine for me.....