下面是根据某篇SCI论文的WOS<span style="font-family: Arial, Helvetica, sans-serif;">获取某篇SCI论文被引用次数[Web of Science 统计]</span>
<span style="font-family:Arial, Helvetica, sans-serif;">由于涉及到授权</span><span style="font-family: Arial, Helvetica, sans-serif;">,代码中地址并不是真实地址,仅供学习之用!!</span>
<%@ page language="java" import="java.util.*,java.io.*,java.net.HttpURLConnection,java.net.URL,java.net.*,database.*,java.sql.*"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>获取某篇SCI论文被引用次数[Web of Science 统计]</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="引用次数">
<meta http-equiv="description" content="获取某篇SCI论文被引用次数[Web of Science 统计]">
</head>
<body>
<%
List<String> uilist = new ArrayList<String>();
String sql = "select top 10 * from Table where ({ fn LENGTH(Field82) } = 19)";
GetConn getCon = new GetConn();
Connection con = getCon.GetConnection();
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next())
{
String subui = rs.getString("Field82").substring(3, rs.getString("Field82").length());
uilist.add(subui);
}
String ui = "";
/* String ui = (String) request.getAttribute("ui");
if (ui != null && !"".equals(ui) && ui.length() == 19)
{
ui = ui.substring(3, ui.length()); */
%>
<table>
<%
for(int i=0;i<uilist.size();i++){
ui = uilist.get(i);
System.out.println(ui);
%>
<tr>
<td height="30" align="left">
<span class="blue_title">SCI引用频次:</span>
<span class="blue_text">
<%
StringBuffer sb = new StringBuffer("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
sb.append("<request xmlns=\"http://www.xxxx.com/xxxx\">");
sb.append("<fn name=\"LinksAMR.retrieve\">");
sb.append("<list>");
sb.append("<map>");
sb.append("</map>");
sb.append("<map>");
sb.append("<list name=\"WOS\">");
sb.append("<val>timesCited</val>");
sb.append("<val>citingArticlesURL</val>");
sb.append("</list>");
sb.append("</map>");
sb.append("<map>");
sb.append("<map name=\"cite_1\">");
sb.append("<val name=\"ut\">" + ui + "</val>");
sb.append("</map>");
sb.append("</map>");
sb.append("</list>");
sb.append("</fn>");
sb.append("</request>");
URL url = new URL("https://xx.xxxxx.com/xx/xxxx");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Content-Type","text/xml;charset=UTF-8");
conn.setRequestMethod("POST");
conn.setRequestProperty("Charset", "UTF-8");
conn.setRequestProperty("Content-Length",String.valueOf(sb.length()));
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setConnectTimeout(5000);
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
os.write(sb.toString().getBytes("UTF-8"));
os.flush();
os.close();
if (conn.getResponseCode() == 200) {
String line = null;
String body = "";
InputStream is = conn.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
while ((line = br.readLine()) != null) {
body += line;
}
if (body.indexOf("<val name=\"timesCited\">") == -1) {
out.print(" 0");
System.out.println("次数== -1");
} else {
ui = body.substring(
body.indexOf("<val name=\"timesCited\">"),
body.lastIndexOf("</val>"));
String linkstr = body.substring(
body.lastIndexOf("http://"),
body.indexOf("]]>"));
out.print(" <a href=\"" + linkstr
+ "\" target=\"_blank\">" + ui + "</a>");
System.out.println("ui:" + ui);
}
// out.print(body);
conn.disconnect();
}
%>
</span>
</td>
</tr>
<%
}
%>
</table>
</body>
</html>