谁能把这段JAVA代码转化成C#? 多谢~
代码如下:package com.juneyao;
import
import
import
import
import
import
import
import
import
import
import
import
import
import java.util.ArrayList;
import java.util.Properties;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class einfo extends HttpServlet {
ArrayList list = new ArrayList();
public einfo() {
super();
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/xml");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
//// 查询xml
String xml="<EticketQueryReq><Sid>hubs</Sid><StartCity>PEK</StartCity>" +
"<EndCity>SHA</EndCity><DepTime>20080830</DepTime></EticketQueryReq>";
String resXml="";
try {
resXml=send(xml);
} catch (Exception e) {
e.printStackTrace();
}
out.print(resXml);
out.flush();
}
String send(String xml)throws Exception{
url = new ("http://www.); //http://192.168.0.151:6666/einfo
con = url.openConnection(); //http://localhost:8080/portal_v/einfo
con.setUseCaches(false);
con.setDoOutput(true);
con.setDoInput(true);
/*缓存*/
BufferedReader fin = new BufferedReader(new StringReader(xml));
StringBuffer stringbuffer = new StringBuffer();
byte bt1[] = xml.getBytes("utf-8");
char ac[] = new char[2048];
int i;
while ((i = fin.read(ac)) > 0)
stringbuffer.append(ac, 0, i);
fin.close();
/*发送*/
OutputStream dataOut = con.getOutputStream();
dataOut.write(bt1);
dataOut.flush();
dataOut.close();
/*获取服务器端返回信息*/
InputStream in =con.getInputStream();
InputStreamReader inreader = new InputStreamReader(in);
BufferedReader bureader = new BufferedReader(inreader);
String stringValue = "";
String resXML="";
while(( stringValue = bureader.readLine()) != null){
resXML=resXML+stringValue;
}
in.close();
return resXML;
}
public void init() throws ServletException {
}
}