ershad
ershad

Reputation: 121

BizTalk Server and SalesForce - INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session

I'm working on an integration scenario between SalesForce and BizTalk Server 2010. I have read the following blogs

http://seroter.wordpress.com/2009/10/11/orchestrating-the-cloud-part-ii-creating-and-consuming-a-salesforce-com-service-from-biztalk-server/

http://soa-thoughts.blogspot.com.au/2010/08/biztalk-salesforce-and-msmq-part-i.html

http://soa-thoughts.blogspot.com.au/2010/08/biztalk-salesforce-and-msmq-part-ii.html

I set the sessionId in a message assignment shape as described in the posts:

SfdcMessage(WCF.Headers) = "<headers><SessionHeader><sessionId>00DK0000005Du2o!AREAQLnrXpVFRAAgwT_Z7iaK0do1IltgHqDLyDfLhbkUGqvFMvzNURdgRtKdPc47cO9sZpOPJ0x8q496vQJsXKGrXt4BcdLW</sessionId></SessionHeader></headers>";

However when my send port calls the SalesForce custom web service I receive the following error

A message sent to adapter "WCF-BasicHttp" on send port "WcfSendPort_SP" with URI https://abc.xyz is suspended.

Error details: System.ServiceModel.FaultException: sf:INVALID_SESSION_IDINVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session

at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)

I did some more research and came across these posts:

http://boards.developerforce.com/t5/General-Development/INVALID-SESSION-ID-Invalid-Session-ID-found-in-SessionHeader/td-p/74031

http://boards.developerforce.com/t5/Perl-PHP-Python-Ruby-Development/INVALID-SESSION-ID-Invalid-Session-ID-found-in-SessionHeader/td-p/66846

http://boards.developerforce.com/t5/General-Development/INVALID-SESSION-ID-Invalid-Session-ID-found-in-SessionHeader/td-p/200705

Has anyone encountered this issue?

Any help is appreciated.

Cheers,

Upvotes: 1

Views: 6533

Answers (1)

ershad
ershad

Reputation: 121

A couple of thing in regards to this:

The blog posts I'm referring to in my question are too old so superfell is right in that the namespace needs to be added in the SessionHeader which is also mentioned here: http://boards.developerforce.com/t5/General-Development/INVALID-SESSION-ID-Invalid-Session-ID-found-in-SessionHeader/td-p/200705 "Your SessionHeader and sessionId elements in the soap header are not in any namespace, they need to be in the xml namesapce defined by the WSDL. The newer API endpoints are stricter about this."

A friend pointed me to the book "Microsoft BizTalk 2010: Line of Business Systems Integration" where the author writes: “Do not forget to put a namespace on the SessionHeader node as the Salesforce.com API is strict about this and will return an invalid token message if the namespace is missing.” In the book the correct format of the SOAP header is stated as:

SFDC_QueryRequest(WCF.Headers) = "<headers><SessionHeader xmlns='urn:enterprise.soap.sforce.com'><sessionId>" + Chapter10_SFDC.TokenManager.TokenManager.SessionId + "</sessionId></SessionHeader></headers>";

Basically I was missing the namesace xmlns='urn:enterprise.soap.sforce.com'.

Also when configuring your send port make sure to import the custom binding *_Custom.BindingInfo.xml and NOT the .BindingInfo.xml or else you will still have sessionId issues.

Cheers.

Upvotes: 5

Related Questions