你怎么写的?
应该不会有问题的,或者对方不支持post(有可能只支持doget)

解决方案 »

  1.   

    boolean flag=false;
        HttpURLConnection httpConn=null;
        FileInputStream fin = null;
        OutputStream out = null;
        InputStreamReader isr = null;
        BufferedReader in = null;
        try {
          //与商户建立一个连接
          URL url = new URL(Url);
          //打开连接
          httpConn = (HttpURLConnection) url.openConnection();
          fin = new FileInputStream(xmlFile2Send);
          ByteArrayOutputStream bout = new ByteArrayOutputStream();
          copy(fin, bout);
          byte[] b = bout.toByteArray();
          httpConn.setRequestProperty("Content-Length", String.valueOf(b.length));
          //以xml格式传送
          httpConn.setRequestProperty("Content-Type", "text/xml; charset=GB2312");
          httpConn.setRequestMethod("POST");
          httpConn.setDoOutput(true);
          httpConn.setDoInput(true);
          out = httpConn.getOutputStream();
          out.write(b);
          out.flush();
          httpConn.connect();
          //获取输入流
          isr = new InputStreamReader(httpConn.getInputStream());
          in = new BufferedReader(isr);
          StringBuffer buf = new StringBuffer();
          String inputLine;
          while ( (inputLine = in.readLine()) != null)
          {
            buf.append(inputLine);
          }      if (buf.toString().trim().equalsIgnoreCase("ok")) {
            Tools.trace(buf.toString().trim());
            flag=true;
          }
          else {
            flag=false;
          }    }catch (MalformedURLException ex) {
          Tools.error(ex);
        }
        catch (IOException ex) {
          Tools.error(ex);
        }
        finally {
          //关闭操作
          Tools.closeBufferedReader(in);
          Tools.closeInputStreamReader(isr);
          Tools.closeOutputStream(out);
          Tools.closeFileInputStream(fin);
          Tools.closeHttpURLConnection(httpConn);
        }
        return flag;
      }
      

  2.   

    可能需要登录验证,你先用POST方式将用户帐号和口令提交后在请求URL
      

  3.   

    他们没有设置账号和密码
    并且直接请求web页面的时候是可以的
    我现在在用程序请求的时候,可以连接到对方
    只是不能获得对方网页里面显示的内容