I'm trying to run the query "SELECT MetadataComponentId FROM MetadataComponentDependency" via tooling connection. and I get the following error-

com.sforce.ws.ConnectionException: unable to find end tag at:  START_TAG seen ...ntId></records><records xsi:type="sf:MetadataComponentDependency">... @1:597
    at com.sforce.ws.bind.TypeMapper.consumeEndTag(TypeMapper.java:437)
    at com.sforce.soap.tooling.sobject.MetadataComponentDependency.load(MetadataComponentDependency.java:48)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:674)
    at com.sforce.ws.bind.TypeMapper.readArray(TypeMapper.java:580)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:558)
    at com.sforce.soap.tooling.QueryResult.setRecords(QueryResult.java:166)
    at com.sforce.soap.tooling.QueryResult.loadFields1(QueryResult.java:293)
    at com.sforce.soap.tooling.QueryResult.loadFields(QueryResult.java:259)
    at com.sforce.soap.tooling.QueryResult.load(QueryResult.java:253)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:674)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:556)
    at com.sforce.soap.tooling.QueryResponse_element.setResult(QueryResponse_element.java:46)
    at com.sforce.soap.tooling.QueryResponse_element.loadFields1(QueryResponse_element.java:105)
    at com.sforce.soap.tooling.QueryResponse_element.loadFields(QueryResponse_element.java:81)
    at com.sforce.soap.tooling.QueryResponse_element.load(QueryResponse_element.java:75)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:674)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:556)
    at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:180)
    at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:154)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
    at com.sforce.soap.tooling.ToolingConnection.query(ToolingConnection.java:651)

Note that When I use this tooling connect to run other queries it's work but when I try to query dependency API I get this error. Note that When I run the dependency API query in developer console it's work. I already check that the version of the jar and the version of the connection config suitable to dependency API.

What should be the problem?

  • You mentioned that you have checked the version of the jar is compatible with the MetadataComponentDependency pilot. Can you please share the version numbers you are using. It will need to be generated from a Tooling API WSDL v43.0 (or greater) where the pilot feature is enabled. – Daniel Ballinger Sep 13 '18 at 0:24
  • this is the version - <!-- Salesforce.com Tooling API version 43.0 Copyright 2006-2018 Salesforce.com, inc. All Rights Reserved -->. and the jar version is the same. in the stack trace it's run MetadataComponentDependency code, but throw this exception – eliranyosef Sep 13 '18 at 6:51
  • So, definitely the right API version. Does the WSDL contain a definition for the MetadataComponentDependency sObject? Like <xsd:complexType name="MetadataComponentDependency">. Without that the code won't be able to extract the sObject. – Daniel Ballinger Sep 13 '18 at 6:59
  • yes, it's exist. <xsd:complexType name="MetadataComponentDependency"> <xsd:complexContent> <xsd:extension base="ens:sObject"> <xsd:sequence> <xsd:element name="MetadataComponentId" minOccurs="0" type="xsd:string" nillable="true"/> <xsd:element name="MetadataComponentName" minOccurs="0" type="xsd:string" nillable="true"/> (and so on...). – eliranyosef Sep 13 '18 at 7:03
  • That all seems to checkout. I had no problem running your sample SOQL query against the Tooling API from .NET. All the elements are strings, so the validation issues should be minimal. Definitely seems like an issue with the sforce Java wrapper. Try something like SELECT Id, MetadataComponentId FROM MetadataComponentDependency as the Id on the sObject might be related to the issue (shouldn't be, but would be quick to check) – Daniel Ballinger Sep 13 '18 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.