• DM
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies

Hi,

I am looking for some advice. Anything you can tell me would be greatly appreciated.

I have recently deployed a .net .aspx form on a server outside my company's internal corporate network.

The form is unable to communicate with salesforce through the enterprise edition api. I have downloaded the latest WSDL file.

The error message I am getting seems to indicate that the connection request is timing out before the login completes.  I am using the login code from the vb.net 5.0 api samples

In the past, when I deployed .aspx forms for internal use only, I had to supply network credentials to the login code in order to get past my company's proxy server and communicate with salesforce.

Since this latest form is deployed on an externally accessable server I am guessing that this server's firewall is preventing my form from connecting to salesforce.

I have looked at some other postings which have suggested opening port 443 since the API uses https and putting in firewall exceptions for 63.146.199.* block of ips which the salesforce servers use. My server admin believes that opening port 443 should be sufficient and there is no need to put in firewall exceptions for that block of ips. Does anyone have any comments on this?

Can anyone tell me what the exact sequence of events for an api login is? Are other ports or ip's used?

Is there some commonly understood way to supply some necessary information example credentials to the firewall. If I was running a form internally I would supply credentials to the proxy during the salesforce login.

Or am I missing something here.

Thanks

Dan

 

  • May 10, 2005
  • Like
  • 0

Hi,

I am currently unable to delete records from a custom object created in both the enterprise and developer editions. I can login successfully and insert records.

 As of last week, the code that I hade to delete records from this custom object worked but today for some reason I am getting errors.

Any help would be appreciated.

The custom object is called cognos. The Java 1.4 code I created is based on the Java API 2.5 samples.

queryIds() retrieves an array of ID which is used by deleteCognos()

I can successfully retrieve an array of record IDs but when the API delete operation is called inside deleteCognos() I get errors. I retrieve the user ID as a way, for me, to diferentiate between each record. Its not used by deleteCognos().

This is some sample output:

Record 0: a00300000000IVEAA2 User Id: alan.brothers@aliant.ca
Record 1: a00300000000IVFAA2 User Id: alden.parker@aliant.ca
Record 2: a00300000000IVGAA2 User Id: andrew.bourque@aliant.ca
Record 3: a00300000000IVJAA2 User Id: alan.brothers@aliant.ca
Record 4: a00300000000IVKAA2 User Id: alden.parker@aliant.ca
Record 5: a00300000000IVLAA2 User Id: andrew.bourque@aliant.ca

ErrorStatus Code: INVALID_ID_FIELD
Error message invalid record id for this type

ErrorStatus Code: INVALID_ID_FIELD
Error message invalid record id for this type

ErrorStatus Code: INVALID_ID_FIELD
Error message invalid record id for this type

ErrorStatus Code: INVALID_ID_FIELD
Error message invalid record id for this type

ErrorStatus Code: INVALID_ID_FIELD
Error message invalid record id for this type

ErrorStatus Code: INVALID_ID_FIELD
Error message invalid record id for this type

When I ran my code today it stopped after 6 records but there are 92 in the object.

I downloaded the latest enterprise wsdl and recompiled it but that didn't help.

 private ID[] queryIds(){

  QueryResult qr = null;
  _QueryOptions qo = new _QueryOptions();
  qo.setBatchSize(new Integer(40));
  binding.setHeader("SoapService", "QueryOptions", qo);
  ID[] cog_ids = null;
  

  try
  {
   qr = binding.query("select id, user_id__c from cognos__c");

   if (qr.getSize() != 0)
   {
    boolean bContinue = true;
    int loopCount = 0;
    
    
    
    while (bContinue)
    {
        for (int j=0; j        {
          
     //System.out.println("Record " + loopCount + " id " + (qr.getRecords()[j]).getId().getValue());

     //save the cognos ids in a class array
     // resize array as needed
     if(loopCount == 0)
     {
        cog_ids = new ID[]{(qr.getRecords()[0]).getId()};
        System.out.println("Record " + loopCount + ": " + (cog_ids[0].getValue()) +" User Id: "+ ((Cognos__c)qr.getRecords()[0]).getUser_ID__c()); 
     }else{
        ID[] tempCog_ids = null;
        tempCog_ids = new ID[cog_ids.length + 1];
        for (int i = 0; i < cog_ids.length; i++)
      tempCog_ids[i] = cog_ids[i];
     
         tempCog_ids[cog_ids.length] = (qr.getRecords()[j]).getId();
         cog_ids  = tempCog_ids;
         System.out.println("Record " + loopCount +": " + (cog_ids[loopCount].getValue())+" User Id: "+ ((Cognos__c)qr.getRecords()[j]).getUser_ID__c());
     }  
     loopCount++;
     
     
         } 
     if (qr.isDone())
     {
      bContinue = false;
      //System.out.println("Stop");
            }else{
            qr = binding.queryMore(qr.getQueryLocator());
            //System.out.println("Query More");
     }    
          }
    
   }else{
    System.out.println("\nThere are no Cognos records stored.");
    getUserInput("\nHit return to continue..."); 
   }


       // System.out.println("\nQuery succesfully executed.");
     //   getUserInput("\nHit return to continue...");
           
                      } catch (UnexpectedErrorFault uef) {
                              System.out.println(uef.getExceptionMessage());
                      } catch (Exception ex)
  {
   System.out.println("\nFailed to execute query succesfully, error message was: \n"
        + ex.getMessage());
   ex.printStackTrace();
   getUserInput("\nHit return to continue...");
  }
       return cog_ids;

}
    

private void deleteCognos() {
if (!loggedIn) {
  if (!login())
 return;
}
  
try { 
 ID[] cognos_ids = queryIds();
 DeleteResult[] deleteResults = binding.delete(cognos_ids);
    // Process the results
    for (int i=0;i       DeleteResult deleteResult = deleteResults[i];
       // Determine whether delete succeeded or had errors
       if (deleteResult.isSuccess()) {
          // Get the id of the deleted record
          System.out.println("Successfully deleted " +deleteResult.getId());
        }else {
        
         Error[] errors = deleteResult.getErrors();
         for(int k = 0; k < errors.length; k++){
    System.out.println("\nErrorStatus Code: " + errors[k].getStatusCode().toString()); 
    System.out.println("Error message " + errors[k].getMessage());

 

 }
  
      }
   }

} catch (UnexpectedErrorFault uef) {
         System.out.println(uef.getExceptionMessage()); 


}catch (RemoteException ex) {
 System.out.println("\nFailed to succesfully delete Cognos records, error message was: \n" + ex.getMessage());
 getUserInput("\nHit return to continue...");
   }  


}

Message Edited by DM on 04-12-2004 11:59 AM

  • April 12, 2004
  • Like
  • 0

Hi,

First I would like to thank those who provided guidance to my previous questions. I have another newbie question for you.

I have been able to successfully compile and run the quickstart.java and samples.java code based on the information previously provided.

I am trying to create a java class which will allow me to query and update a custom object I created in the developer edition. The object is called cognos__c in the enterprise wsdl file I generated.

The following is the import statements and query function I have based on the samples. I want to write a query which will allow me to retrieve the object's id:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;

import javax.xml.rpc.ServiceException;

import com.sforce.soap.enterprise.DescribeGlobalResult;
import com.sforce.soap.enterprise.DescribeSObjectResult;
import com.sforce.soap.enterprise.Field;
import com.sforce.soap.enterprise.FieldType;
import com.sforce.soap.enterprise.GetUserInfoResult;
import com.sforce.soap.enterprise.ID;
import com.sforce.soap.enterprise.LoginResult;
import com.sforce.soap.enterprise.PicklistEntry;
import com.sforce.soap.enterprise.QueryResult;
import com.sforce.soap.enterprise.ResetPasswordResult;
import com.sforce.soap.enterprise.SaveResult;
import com.sforce.soap.enterprise.SetPasswordResult;
import com.sforce.soap.enterprise.SforceServiceLocator;
import com.sforce.soap.enterprise.SoapBindingStub;
import com.sforce.soap.enterprise._QueryOptions;
import com.sforce.soap.enterprise._SessionHeader;
import com.sforce.soap.enterprise.fault.ExceptionCode;
import com.sforce.soap.enterprise.fault.LoginFault;
import com.sforce.soap.enterprise.sobject.Account;
import com.sforce.soap.enterprise.sobject.Contact;
import com.sforce.soap.enterprise.sobject.SObject;
import com.sforce.soap.enterprise.sobject.Task;
import com.sforce.soap.enterprise.sobject.User;
import com.sforce.soap.enterprise.fault.*;

 

private void query(){

  QueryResult qr = null;
  _QueryOptions qo = new _QueryOptions();
  qo.setBatchSize(new Integer(3));
  binding.setHeader("SoapService", "QueryOptions", qo);
  
  try
  {
   qr = binding.query("select id from cognos__c");
   
    for (int i=0;i<qr.getRecords().length;i++)  {
     cognos__c con = (cognos__c) qr.getRecords()[i];
     String id = con.getId();
     System.out.println("id " +id);
    }
    
    
   


        System.out.println("\nQuery succesfully executed.");
   getUserInput("\nHit return to continue...");
                      } catch (UnexpectedErrorFault uef) {
                              System.out.println(uef.getExceptionMessage());
                      } catch (Exception ex)
  {
   System.out.println("\nFailed to execute query succesfully, error message was: \n"
        + ex.getMessage());
   getUserInput("\nHit return to continue...");
  }


 }

When I try to compile my java source code from a command prompt using the command line:

javac Custom.java

where Custom is the name of the class containing the above code,  I get the following error

Custom.java:474: cannot resolve symbol
symbol  : class cognos__c
location: class Custom
                                        cognos__c con = (cognos__c) qr.getRecords()[i];
                                        ^
Custom.java:474: cannot resolve symbol
symbol  : class cognos__c
location: class Custom
                                        cognos__c con = (cognos__c) qr.getRecords()[i];
                                                         ^
2 errors

I know I need to let the Java compiler know about my custom object but I am unclear on how I do this. I am assuming I would use an import statement in my Custom.java class. It seems like I need to generate Java code for the custom object cognos__c that I created in the developer edition but how would I do this? Or is there a parameter I should use when invoking Javac to let it know about the wsdl file?

Thanks for your help

DM

Message Edited by DM on 02-11-2004 11:37 AM

  • February 11, 2004
  • Like
  • 0

Hi,

I am trying out some sample code which I downloaded from the java getting started package on the sforce.com website. I am trying out Samples.java and quickstart.java.

I followed all the steps outlined in the quick start guide on the api documentation closely but I am not able to connect to the custom object I created in the developer edition.

I installed axis and java in my class path and generated and downloaded a wsdl file using the developer edition user interface.

I use the following command line

java Samples org.apache.axis.wsdl.WSDL2Java -a -T 1.2 C:\enterprise.wsdl

I am prompted for the username and password I created in the user interface which I then enter.

But then I get

Creating the binding to the web service...
LOGGING IN NOW....

Failed to successfully login, error message was:
; nested exception is:
        java.net.ConnectException: Connection timed out: connect

Press the RETURN key to continue...

Is this a problem with the proxy server used by my company? Do I need to change the login url used by soap?

Thanks for your help

DM

  • February 10, 2004
  • Like
  • 0

I'm new to SForce, so pardon the newbie question.

My company has created a custom object in the Enterprise Edition.

I would like to do some java application development using this custom object.

As I understand it, I should do any development work using the Developer Edition.

Is it possible to copy the Enterprise Edition custom object into the Developer edition without have to manually recreate all the fields and data using the user interface?

If so how would I do it?

Thanks

DM

 

  • February 09, 2004
  • Like
  • 0

Hi,

I am looking for some advice. Anything you can tell me would be greatly appreciated.

I have recently deployed a .net .aspx form on a server outside my company's internal corporate network.

The form is unable to communicate with salesforce through the enterprise edition api. I have downloaded the latest WSDL file.

The error message I am getting seems to indicate that the connection request is timing out before the login completes.  I am using the login code from the vb.net 5.0 api samples

In the past, when I deployed .aspx forms for internal use only, I had to supply network credentials to the login code in order to get past my company's proxy server and communicate with salesforce.

Since this latest form is deployed on an externally accessable server I am guessing that this server's firewall is preventing my form from connecting to salesforce.

I have looked at some other postings which have suggested opening port 443 since the API uses https and putting in firewall exceptions for 63.146.199.* block of ips which the salesforce servers use. My server admin believes that opening port 443 should be sufficient and there is no need to put in firewall exceptions for that block of ips. Does anyone have any comments on this?

Can anyone tell me what the exact sequence of events for an api login is? Are other ports or ip's used?

Is there some commonly understood way to supply some necessary information example credentials to the firewall. If I was running a form internally I would supply credentials to the proxy during the salesforce login.

Or am I missing something here.

Thanks

Dan

 

  • May 10, 2005
  • Like
  • 0