Question
· Aug 14, 2017

Dependency loop error when importing SalesForce WSDL

I am trying to import the SalesForce Enterprise WSDL in InterSystems Ensemble Studio using the SOAP Add-In. However, when I do so I receive a class dependency loop, Error #5316 during compilation. The WSDL is the standard WSDL provided with SalesForce and works fine in SoapUI. In the SalesForce WSDL it is allowed for an object A to include an object B as an element, while at the same time object B is allowed object A as an element. I think this is what causes the class dependency loop for InterSystems. Does anyone has any suggestion how I can circumvent this error? Rewriting the WSDL is not an option as it includes over 900 objects which all refer to at least 10 other objects.

Here is the error:

ERROR #5316: Class dependency loop for classes 'SforceService.AcceptedEventRelation,SforceService.Account,SforceService.AccountContactRelation,SforceService.AccountContactRole,SforceService.AccountFeed,SforceService.AccountHistory,SforceService.AccountPartner,SforceService.AccountShare,SforceService.AccountTag,SforceService.AccountTeamMember,SforceService.ActionLinkGroupTemplate,SforceService.ActionLinkTemplate,SforceService.ActivityHistory,SforceService.AdditionalNumber,SforceService.Announcement,SforceService.ApexClass,SforceService.ApexComponent,SforceService.ApexEmailNotification,...'
Detected 1 errors during compilation in 0.523s.

Here is a small excerpt of the SalesForce WSDL. You see that this AccountContactRole-element refers to an Account element. In turn, the account-element (not included in excerpt) refers in the same way to the AccountContactRole-element.

<complexType name="AccountContactRole">
    <complexContent>
        <extension base="ens:sObject">
            <sequence>
            <element name="Account" nillable="true" minOccurs="0" type="ens:Account"/>
            <element name="AccountId" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="Contact" nillable="true" minOccurs="0" type="ens:Contact"/>
            <element name="ContactId" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="CreatedBy" nillable="true" minOccurs="0" type="ens:User"/>
            <element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
            <element name="IsDeleted" nillable="true" minOccurs="0" type="xsd:boolean"/>
            <element name="IsPrimary" nillable="true" minOccurs="0" type="xsd:boolean"/>
            <element name="LastModifiedBy" nillable="true" minOccurs="0" type="ens:User"/>
            <element name="LastModifiedById" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="LastModifiedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
            <element name="Role" nillable="true" minOccurs="0" type="xsd:string"/>
            <element name="SystemModstamp" nillable="true" minOccurs="0" type="xsd:dateTime"/>
            </sequence>
        </extension>
    </complexContent>
</complexType>

Based on the answer(s) below I tried the following:

1. Recompiling the project only recompiles the existing classes and not those imported from the SalesForce WSDL.

2. Recompiling the specific classes just gives the dependency loop.

3. When I recompile after adding the DependsOn-keyword I get an error that the classes that are depended upon don't exist. I can't compile them either due to the dependency loop.

So the problem here is that class A refers to class B and vice versa so I don't have a good starting point for compiling my classes. Any further ideas?

Solution

1. Change the classes to %Persistent. I was importing the WSDL with the classes as %Serial. When I re-imported them and checked them as %Persistent it all compiled!

Discussion (7)1
Log in or sign up to continue

Hi Tom,

What is the Type of the classes that you are creating - are they Serial? 

If so, this could explain the error as Serial classes cannot embed themselves (directly or indirectly).

If you can try creating Persistent classes instead of Serial let us know how that works for you.

Note - with Persistent classes, as I understand this is Ensemble, you will need to take care of deleting the various instances generated, once you purge the messages. See this Post for further details if relevant.

Hope this helps.