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
jingzhijingzhi 

INVALID_SESSION_ID exception, using enterprise.wsdl, because of the soap service endpoint changed?

I used enterprise.wsdl (13.0) to generate the Web service stub, then
call the Salesforce Web service in java using loginBySessionId(String sid, String sURL),
while both the sessionId and serviceUrl is sent by virtual force page.

It works fine before the soap service endpoint has changed to 14.0:
https://www.salesforce.com/services/Soap/c/14.0
But it doesn't work now.

I didn't change my java code and page code.
I thought it should work well using the old version soap service, but things not.
Because of the exception, I also tried to update the wsdl file to 14.0, and rebuild my application.
But it doesn't work too.

NOW, my application cannot be used because of this exception.
Do there any one faced the same headache problem?

The following is the exceptions:

AxisFault
faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_SESSION_ID
faultSubcode:
faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
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</ns1:exceptionMessage>

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session

....

Kunpeng Yang - 13/Oct/08 07:45 PM AxisFault faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_SESSION_ID faultSubcode: faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session 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</ns1:exceptionMessage> INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
jingzhijingzhi
I send the {!$Api.Session_ID} & {!$Api.Enterprise_Server_URL_140} to the java servlet side.
Through my test, the soap service endpoint 13.0 still works well,
but why the sessionId invalid?
jingzhijingzhi
AxisFault
 faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_SESSION_ID
 faultSubcode:
 faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
 faultActor:
 faultNode:
 faultDetail:
    {urn:fault.enterprise.soap.sforce.com}UnexpectedErrorFault:<ns1:exceptionCode>INVALID_SESSION_ID</ns1:exceptionCode><ns1:exceptionMessage>Invalid Session ID fo
und in SessionHeader: Illegal Session</ns1:exceptionMessage>

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    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(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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 com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    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.getUserInfo(Unknown Source)
    at TestSfdcWSClient.loginBySessionId(TestSfdcWSClient.java:144)
    at TestSfdcWSClient.main(TestSfdcWSClient.java:50)



SuperfellSuperfell
Thanks for the report, we are investigating this, can you confirm that you're using API merge fields from a visualForce page to access the serverUrl & SessionId for this api call?
jingzhijingzhi
Simon,

Thanks for your reply.
My visualForce page looks like


<form name="myForm" method="post" >
      <input type="hidden" name="sId" value="{!$Api.Session_ID}" />
      <input type="hidden" name="sUrl" value="{!$Api.Enterprise_Server_URL_130}" />
      ....
 
</form>

Then, I call the Web service in java using loginBySessionId
Code:
public boolean loginBySessionId(String sId, String sUrl)
throws Exception
{
// checking url
URL uri = new URL(sUrl);

// binding
SforceServiceLocator serviceLocator = new SforceServiceLocator();
SoapBindingStub binding = new SoapBindingStub();
SessionHeader sh = new SessionHeader();

sh.setSessionId(sId);
String ns = serviceLocator.getServiceName().getNamespaceURI();

binding.setHeader(ns, "SessionHeader", sh);
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, uri
.toString());

GetUserInfoResult userInfoResult = binding.getUserInfo(); // throw exception

return true;

}



However, the login(String userName, String password) method still works well,
and the loginBySessionId() method also works well if you call it using the loginResult,
Code:
loginResult = sfdc.login(userName, pwd);  
loginBySessionId(loginResult.getSessionId(), loginResult.getServerUrl()); // works

 



 


Peter KempPeter Kemp
I'm having a similar issue.  I am changing some very old salesforce code that currently works fine with

https://www.salesforce.com/services/Soap/c/7.0

the new wsdl has

https://www.salesforce.com/services/Soap/c/14.0

and it no longer works.

Any more ideas on this?

Thanks

Pete
SuperfellSuperfell
Most likely the namespace on the sessionHeader element you're creating doesn't match the WSDL correctly.