[SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html;
java代码:
package util;
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import oracle.soap.encoding.soapenc.EncUtils;
import oracle.search.query.webservice.client.*;
import oracle.search.query.webservice.client.OracleSearchService;
public class TestWS {
public static void main(String[] args) {
try{
//创建代理或存根访问oracle ses 查询web服务
OracleSearchService stub = new OracleSearchService();
//设置soap网址(web服务端点)
stub.setSoapURL("http://pc-3.yskj.com:7777/search/query/search");
//执行基本搜索
String queryString="oracle";
//参数1:查询字符串;参数2: 开始index;参数3:文件要求; 参数4: 是否删除重复; 参数5:标记重复; 参数6:返回估计命中数;
OracleSearchResult result=stub.doOracleSimpleSearch(queryString, new Integer(1), new Integer(3),Boolean.FALSE,Boolean.FALSE,Boolean.TRUE);
//获取估计命中数
int estimatedHitCount = result.getEstimatedHitCount().intValue();
//进程的结果
ResultElement[] resElements = result.getResultElements();
for(int i=0; i<resElements.length; i++){
System.out.println("标题:"+resElements[i].getTitle());
System.out.println("摘录:"+resElements[i].getSnippet());
System.out.println("网址:"+resElements[i].getUrl());
}
}catch(Exception ex){
ex.printStackTrace();
}
}
}
异常信息:
[SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html; charset=UTF-8", must starts with "text/xml". Response was:
.............
at org.apache.soap.rpc.Call.getEnvelopeString(Call.java:209)
at org.apache.soap.rpc.Call.invoke(Call.java:268)
at oracle.search.query.webservice.client.OracleSearchService.makeSOAPCallRPC(OracleSearchService.java:1164)
at oracle.search.query.webservice.client.OracleSearchService.doOracleSimpleSearch(OracleSearchService.java:788)
at util.TestWS.main(TestWS.java:19)