0

I need to make a search over soap using wsdl file at http://api.search.live.net/search.wsdl url. I used eclipse with apache axis2 to generate java client files as in the http://courses.coreservlets.com/Course-Materials/pdf/web-services/Axis2-Clients.pdf tutorial. I wrote in main this code

            BingServiceStub stub = new BingServiceStub("http://api.search.live.net:80/soap.asmx");
            stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, false);
            BingServiceStub.SearchRequest request = new BingServiceStub.SearchRequest();
            request.setQuery("blahblah");
            request.setAppId("APP ID");
//          request.setAdult(BingServiceStub.AdultOption.Moderate);
//          request.setImage(null);
//          request.setMarket("2.0");
            SourceType type = SourceType.Web;
            ArrayOfSourceType types = new ArrayOfSourceType();
            types.addSourceType(type);
            request.setSources(types);
            BingServiceStub.SearchRequestE requestE = new BingServiceStub.SearchRequestE();
            requestE.setParameters(request);
            BingServiceStub.SearchResponseE response = stub.search(requestE);

But I got this error

org.apache.axis2.AxisFault: Client error
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at com.microsoft.schemas.livesearch._2008._03.search.BingServiceStub.search(BingServiceStub.java:182)
    at client.BingServiceClient.main(BingServiceClient.java:40)

I learned that bing search api migrated to windows azure. There are some changes in search urls but I couldn't find documentation about soap type requests.

Need help ?

kml_ckr
  • 2,211
  • 3
  • 22
  • 35

2 Answers2

0

I am not sure why you have referenced Window Azure in your posting because you have two ways to access to Bing search 1) Using old Big Developer Search 2) Windows Azure Market Place

If you have got your Bing Search AppID from Windows Azure Data Market then the URL is https://api.datamarket.azure.com/Bing/Search/Web?query

However if you have got your AppID from Bing Developer center then you can still use it till 1 August 2012 using the following URL: http://api.search.live.net/xml.aspx?Appid=App&query

Based on your above code, you are using the Bing Developer site URL so that is not Windows Azure Data Market Specific and and based on Bing Search API 2.0 so you can take a look below sample and fix your code as some settings are not correct as documented below:

Using the Live Search API Version 2.0 with Java and the API's SOAP Interface

If you have got your AppID from Windows Azure Market Place then you can use the method which is described at the same place where you found your AppID etc..

AvkashChauhan
  • 20,495
  • 3
  • 34
  • 65
0

Migrating from bing search to azure, appid concept replaced with account key . I followed http://courses.coreservlets.com/Course-Materials/pdf/web-services/Axis2-Clients.pdf and wrote account key instead of appid in the code below

request.setAppId("APP ID");

it does not solve the problem i got client error. I think a new tutorial must be written for soap because of migrating to azure. The url you gave me was written in 2009 http://www.bing.com/community/site_blogs/b/developer/archive/2009/05/28/using-the-live-search-api-version-2-0-beta-with-java-and-the-api-s-soap-interface.aspx
it is old.

kml_ckr
  • 2,211
  • 3
  • 22
  • 35
  • In your query you are connecting to URL ("http://api.search.live.net:80/soap.asmx") which is not the DataMarket URL. the link I gave you still applicable for non Data market live search. If you are using Azure, please use URL https://api.datamarket.azure.com/Bing/Search/Web? which is the correct one. – AvkashChauhan Jun 29 '12 at 15:51