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
URVASHIURVASHI 

Invoking Bulk Api from Salesforce

Hi

I am new to Salesforce

I have a bulk api code in C# which reads data from sql server database and imports it to Salesforce.This code works fine in the Visual Studio 2008.

But my requirement is to call the code from Salesforce,so i am using Soap Api for it.

I have created a webservice in C# and in a function named getbulkdata() i have pasted my bulk api code there.

Now this code works fine in the Webservice test client i.e. it imports data from sql server to salesforce.

But now when i m calling the same code from Salesforce it gives me the following error:

 

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Unable to connect to the remote server faultcode=a:InternalServiceFault faultactor=

Error is in expression '{!getSaveToObjectPage}'

 

 

 

 

The wsdl2Apex class getbulkdata() method is as below:

 

 public String Getbulkdata(String tablename,String databasename,String Objectname) {
            sqlServerConnector23.Getbulkdata_element request_x = new sqlServerConnector23.Getbulkdata_element();
            sqlServerConnector23.GetbulkdataResponse_element response_x;
            request_x.tablename = tablename;
            request_x.databasename = databasename;
            request_x.Objectname = Objectname;
            Map<String, sqlServerConnector23.GetbulkdataResponse_element> response_map_x = new Map<String, sqlServerConnector23.GetbulkdataResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://tempuri.org/IService1/Getbulkdata',
              'http://tempuri.org/',
              'Getbulkdata',
              'http://tempuri.org/',
              'GetbulkdataResponse',
              'sqlServerConnector23.GetbulkdataResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetbulkdataResult;
        }

 

The method is called from salesforce in the following way:

 

 public PageReference getSaveToObjectPage() {
     sqlArray23.ArrayOfstring a = new sqlArray23.ArrayOfstring();
     sqlServerConnector23.BasicHttpBinding_IService1 stub = new sqlServerConnector23.BasicHttpBinding_IService1();
     String operation='insert';
     stub.timeout_x = 120000; 
     
       
    String Message= stub.Getbulkdata(tablename,databasename,obj name);
   
           PageReference newpage = new PageReference('/apex/SqlServer2005Login_Import6');
            newpage.setRedirect(false); 
              return newpage;  
     
     }

 

 Can some one please tell me y am i getting the Soap Fault unable to connect to remote server.

As the same code is working fine in webservice (WCF) Test Client.

 

 

Thanks in advance.

Please let me know if you require anythg more like the bulk api code or something else.

 

 

 

 

 

 

 

 

 

 

MartinHaagenMartinHaagen

Hi Urvashi,

 

are you sure the connection between Salesforce and the Web Service works? Are there any firewalls etc in between that could block the call? 

 

 

URVASHIURVASHI

Yes by specifying the proxy settings the connection between salesforce and webservice works fine.Regarding firewall im nt sure,need to check with it.

For bulk api code is there any specific port that need to be opened for making a call to bulk api code through a webservice?

As the entire webservice code is working except for the bulk api code section.

Should i share my webservice as well to give u a clear idea about what i am doing?

 

 

Thanks.

Urvashi.

MartinHaagenMartinHaagen

Hi,

 

this is an outbound web service call so http or https should be used unless you have provided anything else in the endpoint URL. Is the endpoint in the generated class correct? 

 

 

akash gupta034856688323083473akash gupta034856688323083473
Hi Urvashi ,

I am getting 500 internal error (SoapAction Http header missing) while fetching data using bulkapi.
can u pls help me resolve this issue.
waiting for ur promt reply.