• vsw00t
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi all,

 

I recently came across a problem where I had a Visualforce page displayed on a page layout and the height of it needed to be defined according to how many records were returned in the list I was displaying. After doing a little poking around, I came up with a cool solution I am happy to share. First step, the div that displays the Visualforce page is actually given the id of the Visualforce page itself - so you need to first find the id of the Visualforce page. Next, create an S-Control to do an onload resizing of this particular div element based on a query defined within the script itself. Below is an example of resizing a Visualforce page displayed on the account that displays a list of active contacts.

 

<script type="text/javascript" src="/js/functions.js"></script> 
<script src="/soap/ajax/12.0/connection.js"></script> 
<script type="text/javascript">
window.onload = resizeWindow(); 
function resizeWindow(){
	//Ensure a valid Salesforce connection.
	sforce.connection.sessionId = "{!API.Session_ID}"; 
	//Set account id of account used in contact query.
	var accountid = "{!Account.Id}";
	//Retrieve a list of contacts on the account that are not inactive.
	result = sforce.connection.query("Select Id from Contact where AccountId = '"+accountid+"' and Inactive__c != true"); 
	//Create a pixel variable to assign the dynamic height. This example adds an extra 50px to display the top part of the page in 	the case no records are retrieved.
	contactsize = result.getArray("records").length*30+50+'px';
	//Retrieve the height of the div the Visualforce page lies in and set it to the new dynamic size. The id is the actual id of 	the Visualforce page.
	top.document.getElementById("066P00000008bke").height = contactsize;
	}
</script>

 

Next, add this S-Control to the page layout with a height of 0px and this should resize your page onload. Enjoy!

 

Hi All,

 

I m facing a problem on one of our java interface with Salesforce. This interface integrates contacts in Salesforce from an input file. The process use MultiThreading for executing some tasks.
When
 the interface is runned it inserts some records and generates an INVALID_SESSION_ID error.

 

Below the entire java error that we have:

AxisFault
 faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_SESSION_ID
 faultSubcode:
 faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: 00DR0000000F5jb!ARYAQCGEvJx62RSz.K3fEQPT6Dx6ufkHD8cqw9pKOr5uIDme2MgT9_Kinf3x_OL6pKgcrXJYFK.6V7hMOo4cNRKV1dOpQqo3
 faultActor:
 faultNode:
 faultDetail:
        {urn:fault.enterprise.soap.sforce.com}UnexpectedErrorFault:<ns1:exceptionCode>INVALID_SESSION_ID</ns1:exceptionCode><ns1:exceptionMessage>Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: 00DR0000000F5jb!ARYAQCGEvJx62RSz.K3fEQPT6Dx6ufkHD8cqw9pKOr5uIDme2MgT9_Kinf3x_OL6pKgcrXJYFK.6V7hMOo4cNRKV1dOpQqo3</ns1:exceptionMessage>

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: 00DR0000000F5jb!ARYAQCGEvJx62RSz.K3fEQPT6Dx6ufkHD8cqw9pKOr5uIDme2MgT9_Kinf3x_OL6pKgcrXJYFK.6V7hMOo4cNRKV1dOpQqo3
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:104)
        at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:90)
        at com.sforce.soap.enterprise.fault.UnexpectedErrorFault.getDeserializer(UnexpectedErrorFault.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
        at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
        at org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
        at org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
        at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at com.sforce.soap.enterprise.SoapBindingStub.logout(SoapBindingStub.java:4462)
        at com.mycompany.sfdcInterface.SFDCAPIProcessor.InsertIntoSFDC.updateIntoSFDC(InsertIntoSFDC.java:55)
        at com.mycompany.sfdcInterface.SFDCAPIProcessor.InsertIntoSFDC.run(InsertIntoSFDC.java:40)
        at java.lang.Thread.run(Thread.java:619)

 

The  Code :

 SoapBindingStub   sfdc = (SoapBindingStub) new SforceServiceLocator().getSoap();
     loginResult = sfdc.login(username,password);
     sfdc._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());
     SessionHeader sh = new SessionHeader();
     sh.setSessionId(loginResult.getSessionId());
     configObj.getsfdcAPIDtls().setServerURL(loginResult.getServerUrl());
     configObj.getsfdcAPIDtls().setSessionId(loginResult.getSessionId());
     sfdc.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),"SessionHeader", sh);
   
     return sfdc;  
  

            String externalID= configObj.getsfdcAPIDtls().getExternalID();

         upsertResult = binding.upsert(externalID,upsertArr);

Please can you help me to find the source of this problem and correct it?

 

Thanks,

Siva.