0

I'm trying to retrieve data from Birst using WSDL. I generated the WSDL on Salesforce and got the generated Apex classes and the method executeQueryInSpace:

public WS_Birst_wwwBirstCom.CommandQueryResult executeQueryInSpace(String token,String query,String spaceID) {
        WS_Birst_wwwBirstCom.executeQueryInSpace_element request_x = new WS_Birst_wwwBirstCom.executeQueryInSpace_element();
        request_x.token = token;
        request_x.query = query;
        request_x.spaceID = spaceID;
        WS_Birst_wwwBirstCom.executeQueryInSpaceResponse_element response_x;
        Map<String, WS_Birst_wwwBirstCom.executeQueryInSpaceResponse_element> response_map_x = new Map<String, WS_Birst_wwwBirstCom.executeQueryInSpaceResponse_element>();
        response_map_x.put('response_x', response_x);
        WebServiceCallout.invoke(
          this,
          request_x,
          response_map_x,
          new String[]{endpoint_x,
          'http://www.birst.com/executeQueryInSpace',
          'http://www.birst.com/',
          'executeQueryInSpace',
          'http://www.birst.com/',
          'executeQueryInSpaceResponse',
          'WS_Birst_wwwBirstCom.executeQueryInSpaceResponse_element'}
        );
        response_x = response_map_x.get('response_x');
        return response_x.executeQueryInSpaceResult;
    }

When I call the method as follow:

 token = soapInstance.Login(username, ssopassword);
 soapInstance.inputHttpHeaders_x.put('Cookie', soapInstance.outputHttpHeaders_x.get('Set-Cookie'));
 try{
     WS_Birst_wwwBirstCom.CommandQueryResult response_x;
     response_x = soapInstance.executeQueryInSpace(token, query ,spaceId);
    }
  catch(Exception e){}

I keep getting the error: " Web service callout failed: Unable to parse callout response. Apex type not found for element rows"

Edit - relevant WSDL attached:

<s:element name="executeQueryInSpace">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
        <s:element minOccurs="0" maxOccurs="1" name="query" type="s:string" />
        <s:element minOccurs="0" maxOccurs="1" name="spaceID" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>

<wsdl:operation name="executeQueryInSpace">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Execute a Birst Logical Query.  Arguments are the Login token, the Birst logical query, and the space Id. Returns the first 1000 results.  See queryMore for retrieving the remainder.</wsdl:documentation>
  <wsdl:input message="tns:executeQueryInSpaceSoapIn" />
  <wsdl:output message="tns:executeQueryInSpaceSoapOut" />
</wsdl:operation>


<wsdl:operation name="executeQueryInSpace">
  <soap:operation soapAction="http://www.birst.com/executeQueryInSpace" style="document" />
  <wsdl:input>
    <soap:body use="literal" />
    <tns:validation>
      <tns:assertions>
        <tns:assert>
          <tns:expression>string-length(//b:query) &lt; 131072</tns:expression>
          <tns:description>Query length must shorter than 128k</tns:description>
        </tns:assert>
        <tns:assert>
          <tns:expression>string-length(/s:Envelope/s:Body/b:executeQueryInSpace/b:token) = 32</tns:expression>
          <tns:description>Invalid token</tns:description>
        </tns:assert>
        <tns:assert>
          <tns:expression>string-length(//b:spaceID) = 36</tns:expression>
          <tns:description>Space ID must be 36 characters</tns:description>
        </tns:assert>
        <tns:assert>
          <tns:expression>string-length(//b:query) &gt; 0</tns:expression>
          <tns:description>Query must contain a value</tns:description>
        </tns:assert>
      </tns:assertions>
    </tns:validation>
  </wsdl:input>
  <wsdl:output>
    <soap:body use="literal" />
  </wsdl:output>
</wsdl:operation>
3
  • Can you share the WSDL in question? Commented Feb 21, 2018 at 20:56
  • Also, try capturing the debug log in a developer edition org. It will include the fall SOAP response. You are possibly getting an HTML response rather than a SOAP response. Commented Feb 21, 2018 at 20:58
  • Thank you @DanielBallinger, I edited the question and unfortunately we do not run a developer edition Commented Feb 25, 2018 at 7:41

1 Answer 1

1

Based on your snippets I assume the WSDL is the same or similar to the one at https://app2102.bws.birst.com/CommandWebService.asmx?WSDL

From your error message:

Web service callout failed: Unable to parse callout response. Apex type not found for element rows

there appears to be something unexpected in the response.

My generated executeQueryInSpace method is expecting to return a wwwBirstCom.CommandQueryResult via the intermediate wwwBirstCom.executeQueryInSpaceResponse_element.executeQueryInSpaceResult.

It is the CommandQueryResult that contains a rows member of type wwwBirstCom.ArrayOfArrayOfString.

If you aren't in a developer edition org where you can see the SOAP response directly you will need to manually call the API from something like SOAPUI so you can see what response comes back. Pay particular attention to how the CommandQueryResult rows appear.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .