• saachinahujaaov
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies

Hi,

 

ISSUE :

We are using Intershop Infinity  as our App Server and We have successfully created the SoAP client. We Are able to successfully login to SF server. However we are encountering the following error of Invalid Session ID

 

Error Excerpt :

 

appserver0: An exception occured invoking service login().
appserver0: AxisFault
appserver0:  faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_SESSION_ID
appserver0:  faultSubcode:
appserver0:  faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
appserver0:  faultActor:
appserver0:  faultNode:
appserver0:  faultDetail:
appserver0:  {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>
appserver0:
appserver0: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
appserver0:  at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
appserver0:  at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
appserver0:  at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
appserver0:  at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
appserver0:  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
appserver0:  at javax.xml.parsers.SAXParser.parse(Unknown Source)
appserver0:  at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
appserver0:  at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
appserver0:  at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
appserver0:  at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:675)
appserver0:  at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
appserver0:  at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
appserver0:  at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
appserver0:  at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
appserver0:  at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
appserver0:  at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
appserver0:  at org.apache.axis.client.Call.invoke(Call.java:2553)
 
CODE EXCERPT :

            Soap service = (new SforceServiceLocator()).getSoap();
           // LoginResult loginResult = service.login(username, password);
    
            SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
            binding.setTimeout(600000);
            LoginResult loginResult = binding.login(username, password);
            System.out.println("serviceResult....." + loginResult.getServerUrl());
            // Create a new session header object and set the
            // session id to that returned by the login
            binding._setProperty(
                SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
                loginResult.getServerUrl());
          
            // Create a new session header object and set the session id to that
            // returned by the login
            SessionHeader sh = new SessionHeader();
           
            System.out.println("Server ID: " + loginResult.getSessionId());
            System.out.println("Service name:" + new SforceServiceLocator().getServiceName());
            //sh.setSessionId(loginResult.getSessionId());
           
           binding.setHeader(
                new SforceServiceLocator().getServiceName().getNamespaceURI(),
                "SessionHeader",
                sh);
            System.out.println("SH SESS ID: " +sh.getSessionId()); 
               
          //*****************************************************************     

            Contact contact;
            SObject[] cons = new Contact[2];
          
            System.out.println("create called....3");
            for (int j = 0; j < 2; j++) {
                contact = new Contact();
                System.out.println("In loop...");
                contact.setAssistantName("Jane");
                contact.setAssistantPhone("777.777.7777");
                contact.setDepartment("Purchasing");
                contact.setDescription("International IT Purchaser");
                contact.setEmail("
joeblow@isp.com");
                contact.setFax("555.555.5555");
                contact.setMailingCity("San Mateo");
                contact.setMailingCountry("US");
                contact.setMailingState("CA");
                contact.setMailingStreet("1129 B Street");
                contact.setMailingPostalCode("94105");
                contact.setMobilePhone("888.888.8888");
                contact.setFirstName("Joe");
                contact.setLastName("Blow");
                contact.setSalutation("Mr.");
                contact.setPhone("999.999.9999");
                contact.setTitle("Purchasing Director");
                cons[j] = contact;
            }
            System.out.println("Cons length: "+cons.length);
           
           <<ERROR LINE>> SaveResult[] sr = binding.create(cons); <<ERROR LINE>>
           
            for (int j = 0; j < sr.length; j++) {
                           if (sr[j].isSuccess()) {
                               System.out.println("A contact was created with an id of: "
                                       + sr[j].getId());
                                      
                           }
               
            }

 

Please Advise.

Thanks

Saachin,

Hi,

 

ISSUE :

We are using Intershop Infinity  as our App Server and We have successfully created the SoAP client. We Are able to successfully login to SF server. However we are encountering the following error of Invalid Session ID

 

Error Excerpt :

 

appserver0: An exception occured invoking service login().
appserver0: AxisFault
appserver0:  faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_SESSION_ID
appserver0:  faultSubcode:
appserver0:  faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
appserver0:  faultActor:
appserver0:  faultNode:
appserver0:  faultDetail:
appserver0:  {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>
appserver0:
appserver0: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
appserver0:  at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
appserver0:  at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
appserver0:  at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
appserver0:  at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
appserver0:  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
appserver0:  at javax.xml.parsers.SAXParser.parse(Unknown Source)
appserver0:  at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
appserver0:  at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
appserver0:  at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
appserver0:  at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:675)
appserver0:  at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
appserver0:  at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
appserver0:  at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
appserver0:  at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
appserver0:  at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
appserver0:  at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
appserver0:  at org.apache.axis.client.Call.invoke(Call.java:2553)
 
CODE EXCERPT :

            Soap service = (new SforceServiceLocator()).getSoap();
           // LoginResult loginResult = service.login(username, password);
    
            SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
            binding.setTimeout(600000);
            LoginResult loginResult = binding.login(username, password);
            System.out.println("serviceResult....." + loginResult.getServerUrl());
            // Create a new session header object and set the
            // session id to that returned by the login
            binding._setProperty(
                SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
                loginResult.getServerUrl());
          
            // Create a new session header object and set the session id to that
            // returned by the login
            SessionHeader sh = new SessionHeader();
           
            System.out.println("Server ID: " + loginResult.getSessionId());
            System.out.println("Service name:" + new SforceServiceLocator().getServiceName());
            //sh.setSessionId(loginResult.getSessionId());
           
           binding.setHeader(
                new SforceServiceLocator().getServiceName().getNamespaceURI(),
                "SessionHeader",
                sh);
            System.out.println("SH SESS ID: " +sh.getSessionId()); 
               
          //*****************************************************************     

            Contact contact;
            SObject[] cons = new Contact[2];
          
            System.out.println("create called....3");
            for (int j = 0; j < 2; j++) {
                contact = new Contact();
                System.out.println("In loop...");
                contact.setAssistantName("Jane");
                contact.setAssistantPhone("777.777.7777");
                contact.setDepartment("Purchasing");
                contact.setDescription("International IT Purchaser");
                contact.setEmail("
joeblow@isp.com");
                contact.setFax("555.555.5555");
                contact.setMailingCity("San Mateo");
                contact.setMailingCountry("US");
                contact.setMailingState("CA");
                contact.setMailingStreet("1129 B Street");
                contact.setMailingPostalCode("94105");
                contact.setMobilePhone("888.888.8888");
                contact.setFirstName("Joe");
                contact.setLastName("Blow");
                contact.setSalutation("Mr.");
                contact.setPhone("999.999.9999");
                contact.setTitle("Purchasing Director");
                cons[j] = contact;
            }
            System.out.println("Cons length: "+cons.length);
           
           <<ERROR LINE>> SaveResult[] sr = binding.create(cons); <<ERROR LINE>>
           
            for (int j = 0; j < sr.length; j++) {
                           if (sr[j].isSuccess()) {
                               System.out.println("A contact was created with an id of: "
                                       + sr[j].getId());
                                      
                           }
               
            }

 

Please Advise.

Thanks

Saachin,

Hi all.

I need create SoapBindingStub object w/o calling

LoginResult lr = binding.login(userName, password);

I need to avoid the 'full scenario':

SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
LoginResult lr = binding.login(userName, password);
binding = (SoapBindingStub) new SforceServiceLocator().getSoap(new URL(lr.getServerUrl()));
_SessionHeader sh = new _SessionHeader();
sh.setSessionId(lr.getSessionId());
binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader", sh);


The main idea is:
I want to recieve session ID value from the web-link then I want to create correct/working SoapBindingStub object WITHOUT invocation binding.login(userName, password) method.

is is possible to do? How is better accomplish it?

Now I'm trying something like that:

SforceServiceLocator locator = new SforceServiceLocator();
System.out.println("----- service URL is = " + locator.getSoapAddress()); // URL is correct !
binding = (SoapBindingStub) locator.getSoap();

// I can try to make a dummy call but it doesn't help
// binding.describeGlobal();

_SessionHeader sh = new _SessionHeader();
sh.setSessionId(sessionId);
binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader", sh);

I'm getting error (on the dummy binding.describeGlobal() or on the real subseqWS call):

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Destination URL not reset. The URL returned from login must be set in the SforceService
faultActor:
faultNode:
faultDetail:
{urn:fault.enterprise.soap.sforce.com}fault: UNKNOWN_EXCEPTIONtionCode> Destination URL not reset. The URL returned from login must be set in the SforceService
Destination URL not reset. The URL returned from login must be set in th
e SforceService