我需要使用http://api.search.live.net/search.wsdl url处的 wsdl 文件对肥皂进行搜索。我使用 eclipse 和 apache axis2 来生成 java 客户端文件,如http://courses.coreservlets.com/Course-Materials/pdf/web-services/Axis2-Clients.pdf教程。我主要写了这段代码
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);
但我得到了这个错误
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)
我了解到 bing search api 已迁移到 windows azure。搜索网址有一些变化,但我找不到有关肥皂类型请求的文档。
需要帮忙 ?