applet
-----------------------------------------------------------------------
URL httpurl = new URL(url);
HttpURLConnection httpConn = (HttpURLConnection)httpurl.openConnection();
httpConn.setRequestMethod( "POST" );
httpConn.setRequestProperty("Host",host);
httpConn.setRequestProperty("Content-Type",contype);
httpConn.setRequestProperty( "Content-Length",String.valueOf(postStr.length()));
httpConn.setRequestProperty("SOAPAction",soapaction);
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
PrintWriter out = new PrintWriter(httpConn.getOutputStream());
out.print(postStr);
out.flush();
out.close();
---------------------------------------servlet-----------------------------------------
BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream()));
String inputLine;
String result ="";
while ((inputLine = in.readLine()) != null)
{
result += inputLine+"\n";
}
in.close();
------------------------------------------------------
-----------------------------------------------------------------------
URL httpurl = new URL(url);
HttpURLConnection httpConn = (HttpURLConnection)httpurl.openConnection();
httpConn.setRequestMethod( "POST" );
httpConn.setRequestProperty("Host",host);
httpConn.setRequestProperty("Content-Type",contype);
httpConn.setRequestProperty( "Content-Length",String.valueOf(postStr.length()));
httpConn.setRequestProperty("SOAPAction",soapaction);
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
PrintWriter out = new PrintWriter(httpConn.getOutputStream());
out.print(postStr);
out.flush();
out.close();
---------------------------------------servlet-----------------------------------------
BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream()));
String inputLine;
String result ="";
while ((inputLine = in.readLine()) != null)
{
result += inputLine+"\n";
}
in.close();
------------------------------------------------------
解决方案 »
- Java中调用Weblogic上的JDBC连接问题
- 关于extjs window 的问题,奇怪?????
- 求一半包半闭的正则表达式
- 请问一个在Myeclipse下配置Hibernate JNDI数据源的问题
- 高手帮忙,jasperreport报表在linux上中文乱码
- Spring datasource 的问题
- 怎样做出这个效果 分不够再加
- 一个SQL问题update,在线等待,(不知为什么,进不去数据库开发版,只好在这里发)
- 请教各位高手,本人不才,请问怎样在点击超链接之后,打开的窗口没有菜单、没有状态栏、没有常用工具、地址栏?(急盼急盼,在线等待)
- response.encodeRedirectURL()的作用?
- 我是一个初学者,不知从何下手学
- 请教各位:如何用calendar获得两位数的月份和日期?
2. dbStream.flush();try moving line 2 before line 1 in your code, ie, flush it first before writing....
what's your error message anyway? just the result not being assigened?
http://www.j-nine.com/pubs/applet2servlet/Applet2Servlet.html