2

I have a webservice that used the Bing Search API. When i try to call the webservice, I get a callout exception saying

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Client error faultcode=soapenv:Client faultactor=http://api.search.live.net:80/soap.asmx

I am not sure how to fix this. I tried to google this but couldn't find a solution. Below is the line where this is happening.

WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://schemas.microsoft.com/LiveSearch/2008/03/Search/Search',
              'http://schemas.microsoft.com/LiveSearch/2008/03/Search',
              'SearchRequest',
              'http://schemas.microsoft.com/LiveSearch/2008/03/Search',
              'SearchResponse',
              'schemasMicrosoftComLivesearch200803.SearchResponse_element'}
            );

This code is a part of the generated class from the WSDL.

Any help will be really appreciated.

3
  • and what does your code look like where you invoke the method? Show how you instantiate it, what you set, etc (obfuscate the api key and sensitive info)
    – Eric
    Oct 27, 2014 at 18:33
  • 1
    Have you used SOAPUI to test whether its issue with SFDC or configuration. Oct 27, 2014 at 18:56
  • I may be looking at the wrong API here, but I not that the core search API is available using 3 different protocols, and if I was using this API I would choose the JSON one because Apex has decent classes for making HTTP requests and handling JSON and you have control of the code. Apex has limitations in the WSDLs that it supports and problems are hard to debug (as you are finding out).
    – Keith C
    Oct 27, 2014 at 21:08

1 Answer 1

1

I assume you are using the WSDL from http://api.search.live.net/search.wsdl?

You will want to check the CALLOUT_RESPONSE that appears immediately after the CALLOUT_REQUEST in the Debug log. Unfortunately it is difficult to see the full error from the CalloutException. You might want to promote the classic idea SOAPFault Information for Apex.

Here is a sample call with an invalid AppId:

schemasMicrosoftComLivesearch200803.BingPort bingService = new schemasMicrosoftComLivesearch200803.BingPort();

schemasMicrosoftComLivesearch200803.SearchRequest parameters = new schemasMicrosoftComLivesearch200803.SearchRequest();
parameters.Query = 'Hello World';
parameters.AppId = '12345';
parameters.Sources = new schemasMicrosoftComLivesearch200803.ArrayOfSourceType();
parameters.Sources.SourceType = new string[]{'Web'}; // TODO: Not sure of valid value here.

schemasMicrosoftComLivesearch200803.SearchResponse response = bingService.Search_x(parameters);

You can see in the CALLOUT_RESPONSE the error message that the SearchRequest.AppId is an invalid value.

enter image description here

You must log in to answer this question.

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