user849169
user849169

Reputation: 36

BizTalk and SalesForce integration: the query or retrieve function returns unknown type

I'm integration a legacy on premise BizTalk Server with SFDC (Salesforce CRM on Demand). I'm using BizTalk 2009 with WCF custom ports. I have imported the enterprise WSDL and successfully used it to create an accounts in SFDC. The problem occurs when I try to use the retrieve (or query) function to get user details, everything is working nicely except when I try to "use" the response message.

Request:

<ns0:retrieve xmlns:ns1="urn:sobject.enterprise.soap.sforce.com" xmlns:ns0="urn:enterprise.soap.sforce.com">
    <ns0:fieldList>Name, Email</ns0:fieldList>
    <ns0:sObjectType>User</ns0:sObjectType>
    <ns0:ids>005900000023xmcAAA</ns0:ids>
</ns0:retrieve>

Receive pipeline is the standard XMLReceive.

Response message:

<retrieveResponse xmlns="urn:enterprise.soap.sforce.com">
    <result xsi:type="sf:User" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <sf:Id xmlns:sf="urn:sobject.enterprise.soap.sforce.com">005900000023xmcAAA</sf:Id>
        <sf:Email xmlns:sf="urn:sobject.enterprise.soap.sforce.com">[email protected]</sf:Email>
        <sf:Name xmlns:sf="urn:sobject.enterprise.soap.sforce.com">Julian Redwood</sf:Name>
    </result>
</retrieveResponse>

Error Details:"Unable to read the stream produced by the pipeline. Details: The value 'sf:User' is invalid according to its schema type 'http://www.w3.org/2001/XMLSchema:QName' - 'sf' is an undeclared namespace. ".

Upvotes: 1

Views: 341

Answers (1)

Dijkgraaf
Dijkgraaf

Reputation: 11527

Yes, that response is rather messed up.

It declares the a default name space at the root xmlns="urn:enterprise.soap.sforce.com" It doesn't declare the sf namespace prefix at the root e.g. (xmlns:sf="urn:sobject.enterprise.soap.sforce.com"). And then for user has it as xsi:type="sf:User" where it then doesn't have the sf prefix defined for the result node.

Either it needs to declare it either in the root or at the result node level.

Option 1) If you the ESB Toolkit you could try and use the ESB Add Namespace pipeline component and add the NamspacePrefix = sf and NamspaceBase = urn:enterprise.soap.sforce.com

Option 2) Raise it as in issue with Salesforce as that is not valid.

Or both.

Upvotes: 1

Related Questions