• soma
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 30
    Replies

This issue appears to be nearly a year old, but there was never a resolution given at the time it was first posted. I've recently begun experiencing this same issue and I've been unable to identify the root cause. Applications I've been running for more than a year have never experienced this issue and then, rather spontaneously, sessions were suddenly becoming prematurely invalid. Please see this thread posted over a year ago regarding the same issue. I just posted to that thread but noticed that the post didn't actually bump the thread to the top of the general development thread listing.

  • May 06, 2009
  • Like
  • 0

1. Is there a newer method of calling out to web services from javascript other than through remoteFunction()?

 

2. During an attempt to access a web service being hosted outside Salesforce by means of remoteFunction(), I'm seeing a confusing parameter being referenced as the culprit of an error:

 

 

Internal Server Error:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Server was unable to read request. ---&gt; There is an error in XML document (46, 27). ---&gt; Value cannot be null.

Parameter name: dest</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>

 

 Neither in the SOAP message I'm constructing to communicate with the web service nor in expected parameters outlined in the WSDL for my web service is there a parameter named "dest." Here's an example of an outgoing SOAP message this error applies to:

 

 

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Send xmlns="http://my.webservices.com/">
<token>97ed86a3970b48e3887b6978c600f048</token>
<meetingId>Meet-002104</meetingId>
<toEmailAddresses>
</toEmailAddresses>
<bccEmailAddresses>
</bccEmailAddresses>
<participants>
<EmailParticipants>
<EmailAddress>cgarrett@p4healthcare.com</EmailAddress>
<ParticipantDetails>
<ParticipantInfo>
<Id>a0YS000000065WwMAI</Id>
<Name>Chris1 Garrett</Name>
<Type>Physician</Type>
</ParticipantInfo>
<ParticipantInfo>
<Id>a0YS000000065WxMAI</Id>
<Name>Chris2 Garrett</Name>
<Type>Physician</Type>
</ParticipantInfo>
<ParticipantInfo>
<Id>a0YS000000065X1MAI</Id>
<Name>Chris3 Garrett</Name>
<Type>Physician</Type>
</ParticipantInfo>
<ParticipantInfo>
<Id>a0YS000000065X6MAI</Id>
<Name>Chris4 Garrett</Name>
<Type>Physician</Type>
</ParticipantInfo>
<ParticipantInfo>
<Id>a0YS000000065X7MAI</Id>
<Name>Chris5 Garrett</Name>
<Type>Physician</Type>
</ParticipantInfo>
<ParticipantInfo>
<Id>a0YS000000065X8MAI</Id>
<Name>Chris6 Garrett</Name>
<Type>Physician</Type>
</ParticipantInfo>
</ParticipantDetails>
</EmailParticipants>
</participants>
<fromEmailAddress>cgarrett@p4healthcare.com</fromEmailAddress>
<subject>this is a test; do not reply</subject>
<body>test message</body>
<useHtml>true</useHtml>
</Send>
</soap:Body>
</soap:Envelope>

 

 Notice the supposed null parameter mentioned in the error message is on line 46, character 27 of this SOAP message. That doesn't quite make sense, as that particular position references the '>' character of "</ParticipantDetails>".

 

Any suggestions?

 

 

  • February 17, 2009
  • Like
  • 0

1. Is there a newer method of calling out to web services from javascript other than through remoteFunction()?

2. During an attempt to access a web service being hosted outside Salesforce by means of remoteFunction(), I'm seeing a confusing parameter being referenced as the culprit of an error:

 

 

Internal Server Error: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <soap:Fault> <faultcode>soap:Client</faultcode> <faultstring>Server was unable to read request. ---&gt; There is an error in XML document (46, 27). ---&gt; Value cannot be null. Parameter name: dest</faultstring> <detail /> </soap:Fault> </soap:Body> </soap:Envelope>

 

 Neither in the SOAP message I'm constructing to communicate with the web service nor in expected parameters outlined in the WSDL for my web service is there a parameter named "dest." Here's an example of an outgoing SOAP message this error applies to:

 

 

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Send xmlns="http://my.webservices.com/"> <token>97ed86a3970b48e3887b6978c600f048</token> <meetingId>Meet-002104</meetingId> <toEmailAddresses> </toEmailAddresses> <bccEmailAddresses> </bccEmailAddresses> <participants> <EmailParticipants> <EmailAddress>cgarrett@p4healthcare.com</EmailAddress> <ParticipantDetails> <ParticipantInfo> <Id>a0YS000000065WwMAI</Id> <Name>Chris1 Garrett</Name> <Type>Physician</Type> </ParticipantInfo> <ParticipantInfo> <Id>a0YS000000065WxMAI</Id> <Name>Chris2 Garrett</Name> <Type>Physician</Type> </ParticipantInfo> <ParticipantInfo> <Id>a0YS000000065X1MAI</Id> <Name>Chris3 Garrett</Name> <Type>Physician</Type> </ParticipantInfo> <ParticipantInfo> <Id>a0YS000000065X6MAI</Id> <Name>Chris4 Garrett</Name> <Type>Physician</Type> </ParticipantInfo> <ParticipantInfo> <Id>a0YS000000065X7MAI</Id> <Name>Chris5 Garrett</Name> <Type>Physician</Type> </ParticipantInfo> <ParticipantInfo> <Id>a0YS000000065X8MAI</Id> <Name>Chris6 Garrett</Name> <Type>Physician</Type> </ParticipantInfo> </ParticipantDetails> </EmailParticipants> </participants> <fromEmailAddress>cgarrett@p4healthcare.com</fromEmailAddress> <subject>this is a test; do not reply</subject> <body>test message</body> <useHtml>true</useHtml> </Send> </soap:Body> </soap:Envelope>

 

 Notice the supposed null parameter mentioned in the error message is on line 46, character 27 of this SOAP message. That doesn't quite make sense, as that particular position references the '>' character of "</ParticipantDetails>".

 

Any suggestions?

 

 

  • February 17, 2009
  • Like
  • 0
I don't know how many people have managed to deploy to their production environment without a single issue in Eclipse, but this process has been a nightmare for me causing me hours of completely unnecessary work, so now I'm going to take some time to write up the crap I've gone through to inform other users as well as Salesforce. Before I say anything else, though, I'd like to propose that Salesforce enable a means to directly transfer code from a sandbox to live within the Salesforce UI with the possibility of not requiring unit testing. Now, on with my story.

I wrote a trigger and a utility class and modified them directly in the sandbox environment without the use of Eclipse. I did most of the revisions in an external editor then copied/pasted those modifications into the sandbox. I performed a variety of tests to prove that my code was working properly without the use of unit tests. When I was ready to deploy my code to the live environment almost THREE WEEKS AGO, I was at a complete loss of what to do. I didn't see any buttons in the sandbox that said "move to live" or anything in the live environment that would allow me to create a trigger by editing code directly (like you can do with s-controls), so I began doing some research. I discovered two paths to deployment: the ANT tool and Eclipse. Honestly, I was opposed to having to use either route. It seemed to me that having to download third party tools to move code from the sandbox to live was a very broken process. I researched using the ANT tool, as there appeared to be more documentation provided by Salesforce for using this tool than using Eclipse, but then I saw a few posts in this community suggesting that using the ANT tool was a very tedious, error-prone process, so I went with Eclipse (version 3.3.1.1). There was almost no documentation provided by Salesforce regarding the use of Eclipse--documentation that did exist for this route was exceedingly sparse and lacks any real substance or troubleshooting information.

So, I started a new Force.com project in Eclipse we'll call Foo. I entered all the credentials and made the "SOAP Endpoint" point to "https://www.salesforce.com/services/Soap/u/11.1", which is the live environment. I figured I could just paste all my code into this new project then save it to live. When the project was created, the first thing I noticed were subfolders in Foo/src that had no value to this project whatsoever; these were subfolders named "AJAX Tools", "crystalreports.com release v1.2", "Financial", and "VerticalResponse for AppExchange". I could only guess these were installed applications/packages in our Salesforce environment, but what were they doing in my project?! I figured, okay, well, this is stupid, but I'll ignore these folders and put everything beneath the "unpackaged" subfolder. I recreated my trigger and utility class, then attempted to "Synchronize with Server", "Save to Server", and "Refresh from Server", but nothing worked. A dialog would pop up saying "Operation in progress..." but then it would close without any information. Nothing was working. I did more research and figured it might have to do with the fact that I wasn't running any tests, so I created a quick testMethod and ran it. Still nothing. I went in and tweaked the project settings, changed the "SOAP Endpoint" to "https://test.salesforce.com/services/Soap/u/11.1" and modified the credentials so I could access the sandbox and magically, all of the Force.com menu options started doing something. So that's great, I thought, now I can manipulate items in the sandbox, but that doesn't achieve anything.

More research led me to trying the test unit route. I figured if I created some code to test my trigger and utility class and achieve full coverage, I'd be past one of the stages of this horrible deployment process. So, I created a new class to house my testMethods and the first testMethod I wrote was to test my utility class. Right-click, Force.com, Run Tests and voila, utility class is 100% covered--it was small, had almost no conditionals, and didn't modify any objects in Salesforce, so 100% coverage for this was trivial. Now, time to test the trigger. Developing the testMethod for this was beyond tedious, causing me days of trouble, and I had other tasks and projects to attend to at work that actually accomplished something. Ultimately, with another pair of eyes examining the test code, I discovered the error was a misplaced 'insert' line. Fortunately, all this time I was running tests, all I had to do was right click in the code of my test class, go down to Force.com, and 'Run Tests'. The test coverage status would display in a pane in the "Apex Code Test Runner" and it applied to both my trigger and my utility class. After finally achieving 100% coverage of the trigger, I attempted the first deploy. First, I was prompted about files not being synchronized so I decided to attmept a synchronization, but because of the presence of some oddities in other files beneath those extra packages, such as "Financial", full synchronization didn't seem to work, so I skipped this and continued with deployment. Second, I encountered problems with the version number, since the sandbox is running 12.0 and this would be written into the meta files for the code, but the live environment is running 11.1, so conflicts arose. Next, I was posed with a deployment plan which had all kinds of references to things associated with the other aforementioned applications, and this was yet another annoyance, but I could safely ignore these inclusions. So, I found the pieces of the plan relating to my trigger, utility class, and test class, checked them, validated deployment, and finally deployed successfully--that was fairly painless.

Then my next nightmare started: I had to change a single literal string value being assigned to a variable in my trigger, so I would have to do this then redeploy. I modified the literal string and ran tests again. This time, however, the code coverage shown in the "Apex Code Test Runner" applied to the test class itself (which makes no sense) and neither the trigger nor the utility class were mentioned. The only way I could get the test class to run against something other than itself was to right click on the "classes" subfolder (i.e. Foo/src/unpackaged/classes), which contained both the test class and utility class, then go to Force.com > Run Tests. The code coverage then showed 100% coverage for both the utility class and the test class. I decided to try a deploy without running the tests directly like this, and when I came to the deployment plan I noticed something very odd: the deployment plan had "Overwrite" options for my trigger and utility class, but they belonged to the "Financial" application and were not in the "unpackaged" category. I exited the deployment dialog and expanded the "Financial" folder and its "classes" and "triggers" subfolders which revealed copies of my utility class and trigger. Now, beneath my project, my trigger and utility class existed both beneath "Financial" and "unpackaged". I selected the copies beneath "Financial" and deleted them, a dialog appeared saying they did not exist on the server so they would only be deleted locally--wonderful. Then I went to issue another deployment. Oops, version issues, have to modify those meta files then deploy again. Came back to the deployment plan (after having to enter my credentials and select a SOAP Endpoint for the deployment for the umpteenth time) and found my trigger and utility class marked for deletion from the Financial package, but there was no mention of "Adding" or "Overwriting" for my trigger and utility class under the "unpackaged" package. So, I ran the deploy, deleted the faux trigger and utility class from "Financial" and attempted to deploy again hoping the plan would display my classes under the "unpackaged"--nothing. Where the hell did they go?

I created another project, pasted my code, attempted to run tests but saw my test class was receiving 100% coverage with no mention of my trigger or utility class, so that's still broken, but I issued a deploy, anyway. Deploy failed saying my trigger was only 35% covered. I examined the test code and discovered a line I must have commented out somewhere in the confusion, then deployed, again. Finally, almost three weeks later, 100% coverage, successful validation, successful deployment.

I shouldn't have to massage a third party IDE to deploy something from the sandbox to live, but I did and needless to say, I'm beyond frustrated.


Message Edited by soma on 03-07-2008 11:54 AM
  • March 07, 2008
  • Like
  • 0
I have a synchronous web service (written in C#) that takes a while to do some work. I'd like to make an asynchronous call to it from Salesforce using remoteFunction(), however, remoteFunction() expects its onSuccess property to be set to something, and I believe it also expects some sort of return from the web service, but if the web service doesn't return a value in a timely manner, a timeout occurs. I'd like to just have the remoteFunction() initiate the web method then not be concerned about a return value. The web method will do its work and send an email with a report when it's done. Is this possible?
  • February 28, 2008
  • Like
  • 0
I recently installed Eclipse 3.3.1.1 for Java Developers and I installed the Force.com Apex plug-in, as well. I started a new Force.com project and added a new Apex Class, though I added this class under the default "unpackaged" category (so in the package explorer pane it appears under <project name>/src/unpackaged/classes/<class name>.cls). If I right click > Force.com > Run Tests, a dialog appears saying "Operation in progress..." (which closes immediately), and then the "Apex Code Test Runner" pane pops up, but no information appears within the pane indicating any sort of test was run. When I set the "Logging Level" to "Profiling (maximum verbosity)", I see several messages indicating there is no profiling information for SOQL, DML, and method invocations. It's as if the interface runs, but it executes no real analysis.

When I attempt to synchronize, save to the server, or apply the project to the server, the same thing occurs. An "Operating in progress..." dialog pops up, then nothing else occurs indicating anything has happened.

Here's the class I'm attempting to run tests on:
Code:
global class XmlEmailUtil {
 public static String AddXmlTagPair(String name, String value) {
  if (name == null) { return ''; }
  
  return 
   '   <tag_pair>\n' +
   '    <name>' + name + '</name>\n' +
   '    <values>\n' +
   '     <value>' + value + '</value>\n' +
   '    </values>\n' +
   '   </tag_pair>\n';
 }
 
 public static void SendXmlEmail(String id, String body, String toAddress) {
  Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
  
  email.setToAddresses(new String[] { toAddress });
  email.setSubject(id);
  email.setPlainTextBody(body);
  
  Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
 }
 
 static testMethod void TestAddXmlTagPair() {
  AddXmlTagPair(null, null);
  AddXmlTagPair(null, 'value');
  AddXmlTagPair('name', null);
  AddXmlTagPair('name', 'value');
 }
 
 static testMethod void TestSendXmlEmail() {
  SendXmlEmail(null, null, null);
  SendXmlEmail(null, null, 'cgarrett@p4healthcare.com');
  SendXmlEmail(null, 'body', null);
  SendXmlEmail(null, 'body', 'cgarrett@p4healthcare.com');
  SendXmlEmail('id', null, null);
  SendXmlEmail('id', null, 'cgarrett@p4healthcare.com');
  SendXmlEmail('id', 'body', null);
  SendXmlEmail('id', 'body', 'cgarrett@p4healthcare.com');
 }
}

 

  • February 12, 2008
  • Like
  • 0
I'm not sure if this is an upsert issue or if I am simply not setting a variable to a proper value, but after a successful upsert, the checkbox field does not appear to be checked if I set it to true. I have an object "Object__c" which has a checkbox field "Checkbox__c" and an ID field "Id", and I set the checkbox in the following way:

Object__c myObj = new Object__c[1];

if (somethingIsTrue)
    myObj[0].Checkbox__c = true;
else
    myObj[0].Checkbox__c = false;

Then I upsert:

if (sfdc.upsert("Id", myObj)[0].success)
    // yay!

This is all pretty standard, so I don't know why the checkbox isn't checked if set to true, but I'm wondering if I should be setting it to the literal string "true" or the numerical value 1 instead of the boolean value "true". Any ideas?

  • November 13, 2007
  • Like
  • 0
There are a few functions which do not seem to return values themselves and, instead, mandate the use of onSuccess and onFailure, such as sforce.connection.remoteFunction(). I have only seen examples of how these methods are to be used, but documentation is otherwise sparse. I'd like to be able to call sforce.connection.remoteFunction() synchronously and if it is successful, continue executing other actions, but making a call from within an onSuccess function seems limiting. For instance, I have a function foo() that expects an array of data, but I only want to call this function if the remoteFunction() call was successful. If I generate the array of data before I call remoteFunction(), then I want to pass this array of data to foo() when remoteFunction() is successful, how can this be accomplished? Do I simply have to make this variable array global? Should I simply rework my logic so that I generate the array of data within foo()?

Ideally, I would like to be able to set some variable success in onSuccess and onFailure and then check its value outside of the scope of remoteFunction(), but even with global variables this doesn't seem to be working.
  • October 16, 2007
  • Like
  • 0
I generated an Apex class from a WSDL generated by a webservice I wrote that exists outside Salesforce. The resulting class has the format:

class PackageNameWebservices {
    class WebserviceSoap {
       public String endpoint_x = 'http://www.example.com/webservice.asmx';
       private String[] ns_map_type_info = new String[]{ 'http://www.example.com/', 'PackageNameWebservices' };
       ...
       public String WebserviceFunction(String arg) {...}
    }
    class SomeReturnedResponse_element {...}
    class SomeReturnedResponse {...}
}

Now, in an s-control, I'm trying to access the WebserviceFunction(), however, since it's inside of a class inside of another class (the top-level class), I rewrote the above, pulling everything inside of the WebserviceSoap class out into the top-level class, itself. I call WebserviceFunction from the s-control as follows:

sforce.apex.execute("PackageNameWebservices", "WebserviceSoap", {arg:"foo"});

When I run the s-control, I the following javascript alert pops up:

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'soapenv:Client', faultstring:'No operation available for request
{http://soap.sforce.com/schemas/package/PackageNameWebservice}WebserviceFunction, please check the WSDL for the service.", }

Any ideas as to what could be causing this?
  • October 12, 2007
  • Like
  • 0
I created a simple webservice in C# for the purposes of processing some data to send emails. One of the parameters for a function of my webservice was called "from". I generated the WSDL for this webservice (and removed all SOAP 1.2 tags), then went to the sandbox to generate the Apex code from the WSDL. The code was generated, but there was an error (see the generated Apex class following this discussion). It took me quite a while to figure out what the problem was. Examining the Apex code revealed nothing, but then I read another post in this forum where someone noted that he/she was able to generate Apex code with reserved words as variable names, e.g. public String return; and this caused a problem. I suppose 'from' is one of those keywords in Apex, so I renamed the field in my code, rewrote the WSDL, then regenerated the Apex code from the WSDL and all was well. The error and the code that generated the error follows:


The following generated class(es) have compilation errors:

Error: TestingGeneration3

Error: unexpected token: String at 15:16

Code:
//Generated by wsdl2apex

public class TestingGeneration3 {
    public class Authenticate_element {
        public String username;
        public String password;
        private String[] username_type_info = new String[]{'username','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] password_type_info = new String[]{'password','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.example.com/WebServices/','true'};
        private String[] field_order_type_info = new String[]{'username','password'};
    }
    public class Send_element {
        public String toEmails;
        public String bccEmails;
        public String from;   // THE ERROR IS ON THIS LINE
        public String subject;
        public String body;
        private String[] toEmails_type_info = new String[]{'toEmails','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] bccEmails_type_info = new String[]{'bccEmails','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] from_type_info = new String[]{'from','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] subject_type_info = new String[]{'subject','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] body_type_info = new String[]{'body','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.example.com/WebServices/','true'};
        private String[] field_order_type_info = new String[]{'toEmails','bccEmails','from','subject','body'};
    }
    public class ConfirmationEmailSoap {
        public String endpoint_x = 'http://localhost:38851/ConfirmationEmail.asmx';
        private String[] ns_map_type_info = new String[]{'http://www.example.com/WebServices/', 'TestingGeneration3'};
        public Boolean Send(String toEmails,String bccEmails,String from,String subject,String body) {
            TestingGeneration3.Send_element request_x = new TestingGeneration3.Send_element();
            TestingGeneration3.SendResponse_element response_x;
            request_x.toEmails = toEmails;
            request_x.bccEmails = bccEmails;
            request_x.from = from;
            request_x.subject = subject;
            request_x.body = body;
            Map<String, TestingGeneration3.SendResponse_element> response_map_x = new Map<String, TestingGeneration3.SendResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.example.com/WebServices/Send',
              'http://www.example.com/WebServices/',
              'Send',
              'http://www.example.com/WebServices/',
              'SendResponse',
              'TestingGeneration3.SendResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.SendResult;
        }
        public String Authenticate(String username,String password) {
            TestingGeneration3.Authenticate_element request_x = new TestingGeneration3.Authenticate_element();
            TestingGeneration3.AuthenticateResponse_element response_x;
            request_x.username = username;
            request_x.password = password;
            Map<String, TestingGeneration3.AuthenticateResponse_element> response_map_x = new Map<String, TestingGeneration3.AuthenticateResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.example.com/WebServices/Authenticate',
              'http://www.example.com/WebServices/',
              'Authenticate',
              'http://www.example.com/WebServices/',
              'AuthenticateResponse',
              'TestingGeneration3.AuthenticateResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.AuthenticateResult;
        }
    }
    public class AuthenticateResponse_element {
        public String AuthenticateResult;
        private String[] AuthenticateResult_type_info = new String[]{'AuthenticateResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.example.com/WebServices/','true'};
        private String[] field_order_type_info = new String[]{'AuthenticateResult'};
    }
    public class SendResponse_element {
        public Boolean SendResult;
        private String[] SendResult_type_info = new String[]{'SendResult','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.example.com/WebServices/','true'};
        private String[] field_order_type_info = new String[]{'SendResult'};
    }
}

 

Message Edited by soma on 10-02-2007 12:47 AM

  • October 02, 2007
  • Like
  • 0

This issue appears to be nearly a year old, but there was never a resolution given at the time it was first posted. I've recently begun experiencing this same issue and I've been unable to identify the root cause. Applications I've been running for more than a year have never experienced this issue and then, rather spontaneously, sessions were suddenly becoming prematurely invalid. Please see this thread posted over a year ago regarding the same issue. I just posted to that thread but noticed that the post didn't actually bump the thread to the top of the general development thread listing.

  • May 06, 2009
  • Like
  • 0
Hi,

I've got a ASP.NET 2.0 application which acquires a session that is passed to it from SF.

I just started getting this message, and am not sure where to go with it.  The code that is running with it has been functioning for a while without any issues, and it still works some of the time.  Also, even though the API calls are server-side, I've only seen this problem when running IE; Firefox hasn't been a problem so far.  I don't have a setting for "lock sessions to originating IP" - this is the developer version.  Does anybody have any suggestions?

Thanks, Jim
I don't know how many people have managed to deploy to their production environment without a single issue in Eclipse, but this process has been a nightmare for me causing me hours of completely unnecessary work, so now I'm going to take some time to write up the crap I've gone through to inform other users as well as Salesforce. Before I say anything else, though, I'd like to propose that Salesforce enable a means to directly transfer code from a sandbox to live within the Salesforce UI with the possibility of not requiring unit testing. Now, on with my story.

I wrote a trigger and a utility class and modified them directly in the sandbox environment without the use of Eclipse. I did most of the revisions in an external editor then copied/pasted those modifications into the sandbox. I performed a variety of tests to prove that my code was working properly without the use of unit tests. When I was ready to deploy my code to the live environment almost THREE WEEKS AGO, I was at a complete loss of what to do. I didn't see any buttons in the sandbox that said "move to live" or anything in the live environment that would allow me to create a trigger by editing code directly (like you can do with s-controls), so I began doing some research. I discovered two paths to deployment: the ANT tool and Eclipse. Honestly, I was opposed to having to use either route. It seemed to me that having to download third party tools to move code from the sandbox to live was a very broken process. I researched using the ANT tool, as there appeared to be more documentation provided by Salesforce for using this tool than using Eclipse, but then I saw a few posts in this community suggesting that using the ANT tool was a very tedious, error-prone process, so I went with Eclipse (version 3.3.1.1). There was almost no documentation provided by Salesforce regarding the use of Eclipse--documentation that did exist for this route was exceedingly sparse and lacks any real substance or troubleshooting information.

So, I started a new Force.com project in Eclipse we'll call Foo. I entered all the credentials and made the "SOAP Endpoint" point to "https://www.salesforce.com/services/Soap/u/11.1", which is the live environment. I figured I could just paste all my code into this new project then save it to live. When the project was created, the first thing I noticed were subfolders in Foo/src that had no value to this project whatsoever; these were subfolders named "AJAX Tools", "crystalreports.com release v1.2", "Financial", and "VerticalResponse for AppExchange". I could only guess these were installed applications/packages in our Salesforce environment, but what were they doing in my project?! I figured, okay, well, this is stupid, but I'll ignore these folders and put everything beneath the "unpackaged" subfolder. I recreated my trigger and utility class, then attempted to "Synchronize with Server", "Save to Server", and "Refresh from Server", but nothing worked. A dialog would pop up saying "Operation in progress..." but then it would close without any information. Nothing was working. I did more research and figured it might have to do with the fact that I wasn't running any tests, so I created a quick testMethod and ran it. Still nothing. I went in and tweaked the project settings, changed the "SOAP Endpoint" to "https://test.salesforce.com/services/Soap/u/11.1" and modified the credentials so I could access the sandbox and magically, all of the Force.com menu options started doing something. So that's great, I thought, now I can manipulate items in the sandbox, but that doesn't achieve anything.

More research led me to trying the test unit route. I figured if I created some code to test my trigger and utility class and achieve full coverage, I'd be past one of the stages of this horrible deployment process. So, I created a new class to house my testMethods and the first testMethod I wrote was to test my utility class. Right-click, Force.com, Run Tests and voila, utility class is 100% covered--it was small, had almost no conditionals, and didn't modify any objects in Salesforce, so 100% coverage for this was trivial. Now, time to test the trigger. Developing the testMethod for this was beyond tedious, causing me days of trouble, and I had other tasks and projects to attend to at work that actually accomplished something. Ultimately, with another pair of eyes examining the test code, I discovered the error was a misplaced 'insert' line. Fortunately, all this time I was running tests, all I had to do was right click in the code of my test class, go down to Force.com, and 'Run Tests'. The test coverage status would display in a pane in the "Apex Code Test Runner" and it applied to both my trigger and my utility class. After finally achieving 100% coverage of the trigger, I attempted the first deploy. First, I was prompted about files not being synchronized so I decided to attmept a synchronization, but because of the presence of some oddities in other files beneath those extra packages, such as "Financial", full synchronization didn't seem to work, so I skipped this and continued with deployment. Second, I encountered problems with the version number, since the sandbox is running 12.0 and this would be written into the meta files for the code, but the live environment is running 11.1, so conflicts arose. Next, I was posed with a deployment plan which had all kinds of references to things associated with the other aforementioned applications, and this was yet another annoyance, but I could safely ignore these inclusions. So, I found the pieces of the plan relating to my trigger, utility class, and test class, checked them, validated deployment, and finally deployed successfully--that was fairly painless.

Then my next nightmare started: I had to change a single literal string value being assigned to a variable in my trigger, so I would have to do this then redeploy. I modified the literal string and ran tests again. This time, however, the code coverage shown in the "Apex Code Test Runner" applied to the test class itself (which makes no sense) and neither the trigger nor the utility class were mentioned. The only way I could get the test class to run against something other than itself was to right click on the "classes" subfolder (i.e. Foo/src/unpackaged/classes), which contained both the test class and utility class, then go to Force.com > Run Tests. The code coverage then showed 100% coverage for both the utility class and the test class. I decided to try a deploy without running the tests directly like this, and when I came to the deployment plan I noticed something very odd: the deployment plan had "Overwrite" options for my trigger and utility class, but they belonged to the "Financial" application and were not in the "unpackaged" category. I exited the deployment dialog and expanded the "Financial" folder and its "classes" and "triggers" subfolders which revealed copies of my utility class and trigger. Now, beneath my project, my trigger and utility class existed both beneath "Financial" and "unpackaged". I selected the copies beneath "Financial" and deleted them, a dialog appeared saying they did not exist on the server so they would only be deleted locally--wonderful. Then I went to issue another deployment. Oops, version issues, have to modify those meta files then deploy again. Came back to the deployment plan (after having to enter my credentials and select a SOAP Endpoint for the deployment for the umpteenth time) and found my trigger and utility class marked for deletion from the Financial package, but there was no mention of "Adding" or "Overwriting" for my trigger and utility class under the "unpackaged" package. So, I ran the deploy, deleted the faux trigger and utility class from "Financial" and attempted to deploy again hoping the plan would display my classes under the "unpackaged"--nothing. Where the hell did they go?

I created another project, pasted my code, attempted to run tests but saw my test class was receiving 100% coverage with no mention of my trigger or utility class, so that's still broken, but I issued a deploy, anyway. Deploy failed saying my trigger was only 35% covered. I examined the test code and discovered a line I must have commented out somewhere in the confusion, then deployed, again. Finally, almost three weeks later, 100% coverage, successful validation, successful deployment.

I shouldn't have to massage a third party IDE to deploy something from the sandbox to live, but I did and needless to say, I'm beyond frustrated.


Message Edited by soma on 03-07-2008 11:54 AM
  • March 07, 2008
  • Like
  • 0

Hi,i have just develope my first trigger, bu i cannot deploy it in to Unlimited Edition, why?
When i try to deploy the trigger, Eclipse failure the coverage test...

this is my trigger:

 trigger PaymentTerm on Opportunity (before insert, before update) {
   Opportunity[] MyOp = Trigger.
new;
   for (Opportunity p:MyOp){
       if (p.Description != 'World') {
           p.Description = 'World';
          }

      }
    }

thanks

Simone

I have read several posts and done quite a bit of searching. I'm still having trouble. I have the following trigger:

Code:
trigger opportunityContactRoleUpdate on Opportunity (after Insert, after Update)
{

    for(Opportunity o : Trigger.new)
    {
        if((o.StageName == 'Closed Won (Recurring)' || o.StageName == 'Pilot (Recurring)') && o.Recurring_Opportunity__c=='Yes' && o.Probability>=90.0 && o.Client_Id__c==4944)
        {
            Date a = System.today();
            Date b = a.toStartOfMonth();
            Date c = b.addDays(-1);
           
            List<Opportunity> oldOpps = [SELECT id FROM opportunity WHERE Client_Id__c = :o.Client_Id__c AND closedate <= :c ORDER BY closedate DESC LIMIT 1];
           

            List<OpportunityContactRole> ocrs = [SELECT id, OpportunityId FROM OpportunityContactRole WHERE OpportunityId=:oldOpps[0].id];
           
            for(integer i=0; i<ocrs.size(); i++)
            {
                ocrs[i].OpportunityId = o.id;
            }
           
            if(!ocrs.isEmpty())
            {
                update ocrs;
            }
        }
    }
}

 For which I created an Apex Test class to get coverage on:

Code:
public class opportunityContactRoleUpdateTest {

 static testMethod void myTest()
 {
  Opportunity o = new Opportunity(name='Dave 1', stagename='My Stage 1');
  
  insert o;
  
  o.Name = 'Dave 1 Updated';
  o.Stagename = 'My Stage 1 Updated';
  
  update o;
 }

}

I created this based on another post - because the insertion and create of this opportunity would cause my trigger to fire, give me enough coverage.

I'm developing in Eclipse using the Force IDE. These are some of the problems I'm having.

1. I cannot save to the server more that the class definition of my Test class. The body of my class never saves to or gets to my production environment using the 'Save to Server' or 'Synchronize with Server' options in the Force IDE - although it runs, it never saves more than the inital class definition.

2. After I do get it on the server and run the test on it, how do I 'activate' the trigger (which by the way I can save to the server just fine...) Do I have to use the ant method to activate it, or can I do it with the Force IDE...I'm not having any luck finding the method to 'activate' the trigger.

3. I can 'run tests' on my small apex class that I created and it shows me 100% coverage...however it looks to me like it's telling me 100% of the testclass run, and not 100% of my trigger was covered...I would like to 'run all tests' on my apex class from SF, but as I said, i can't get it there...

I'm pretty stuck here. Any suggestions would help me out.

---

Updated: I downloaded and installed the latest Force IDE. I create a new workspace, and a new force.com project - synchronizing with our production env. Now I'm having additional errors when trying to run my test class. I get:

INVALID_OPERATION: Cannot specify both runAllTests and specific RunTests

This happens when I right click on the test class, select 'Force' and then run tests.




Message Edited by dave_mwi on 02-29-2008 12:58 PM

Message Edited by dave_mwi on 02-29-2008 01:00 PM
I recently installed Eclipse 3.3.1.1 for Java Developers and I installed the Force.com Apex plug-in, as well. I started a new Force.com project and added a new Apex Class, though I added this class under the default "unpackaged" category (so in the package explorer pane it appears under <project name>/src/unpackaged/classes/<class name>.cls). If I right click > Force.com > Run Tests, a dialog appears saying "Operation in progress..." (which closes immediately), and then the "Apex Code Test Runner" pane pops up, but no information appears within the pane indicating any sort of test was run. When I set the "Logging Level" to "Profiling (maximum verbosity)", I see several messages indicating there is no profiling information for SOQL, DML, and method invocations. It's as if the interface runs, but it executes no real analysis.

When I attempt to synchronize, save to the server, or apply the project to the server, the same thing occurs. An "Operating in progress..." dialog pops up, then nothing else occurs indicating anything has happened.

Here's the class I'm attempting to run tests on:
Code:
global class XmlEmailUtil {
 public static String AddXmlTagPair(String name, String value) {
  if (name == null) { return ''; }
  
  return 
   '   <tag_pair>\n' +
   '    <name>' + name + '</name>\n' +
   '    <values>\n' +
   '     <value>' + value + '</value>\n' +
   '    </values>\n' +
   '   </tag_pair>\n';
 }
 
 public static void SendXmlEmail(String id, String body, String toAddress) {
  Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
  
  email.setToAddresses(new String[] { toAddress });
  email.setSubject(id);
  email.setPlainTextBody(body);
  
  Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
 }
 
 static testMethod void TestAddXmlTagPair() {
  AddXmlTagPair(null, null);
  AddXmlTagPair(null, 'value');
  AddXmlTagPair('name', null);
  AddXmlTagPair('name', 'value');
 }
 
 static testMethod void TestSendXmlEmail() {
  SendXmlEmail(null, null, null);
  SendXmlEmail(null, null, 'cgarrett@p4healthcare.com');
  SendXmlEmail(null, 'body', null);
  SendXmlEmail(null, 'body', 'cgarrett@p4healthcare.com');
  SendXmlEmail('id', null, null);
  SendXmlEmail('id', null, 'cgarrett@p4healthcare.com');
  SendXmlEmail('id', 'body', null);
  SendXmlEmail('id', 'body', 'cgarrett@p4healthcare.com');
 }
}

 

  • February 12, 2008
  • Like
  • 0