2010-04-03 221 views
0

我從這裏生成的java web服務客戶端 - >http://api.search.live.net/search.wsdl ..我想搜索並列出返回值。 如何顯示結果?Web服務客戶端Java

我的代碼是:

import java.rmi.RemoteException; 
import com.microsoft.schemas.LiveSearch._2008._03.Search.*; 

public class searchtry { 
public static void main(String[] args) throws RemoteException { 
    LiveSearchPortTypeProxy client=new LiveSearchPortTypeProxy(); 
    SearchRequest request=new SearchRequest(); 
    SearchRequestType1 type1=new SearchRequestType1(); 
    sorgu.setAppId("*********************************"); //Windows Live gave this id for using that service 
    sorgu.setSources(new SourceType[]{SourceType.Web}); 
    sorgu.setQuery("Java"); 
    aratip.setParameters(request); 
    SearchResponseType0 answer= client.search(type1); 
    System.out.println(answer.toString()); 
} 
+0

println輸出的內容是什麼? – 2010-04-03 19:47:16

+0

請格式化您的代碼,這很容易... – miku 2010-04-03 19:54:42

+0

http://stackoverflow.com/questions/2567849/java-web-service-client-from-microsoft-live-search可能的重複 – nos 2010-04-03 20:27:54

回答

1

你可以看一下生成的類SearchResponseType0,看看有什麼做的toString方法做(如果存在)。 否則,您需要使用其他方法打印來自對象的值int可以訪問各個結果條目的對象