java - 发送 POST 到 HTTPS - 逻辑问题

标签 java http post stored-procedures https

任何人都知道为什么我会收到此错误。我正在尝试发送 POST 请求,这是我收到的错误消息。

服务器响应:

Error while dispatching hrxml [ Server was unable to process request. --> Procedure or function 'sp__LogMessage' expects parameter '@pi_ClientID', which was not supplied.   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at DispatchService.HRISMessageRouter.MessageRouter.Route(String HRXML)
   at DispatchService.DispatchMessage.Dispatch(String HRXML)]

我的代码:

URL link = new URL("https://example.com/example.asp"); 
        HttpsURLConnection com = (HttpsURLConnection) link.openConnection();
                  String l;

        con.setRequestMethod("POST");
con.setDoInput(true); 
        con.setDoOutput(true);
        con.setRequestProperty("name", "rrrrr");
        con.setRequestProperty("pwd", "ffff");

        OutputStream os = con.getOutputStream();

        os.flush();

        InputStream is = con.getInputStream();

        BufferedReader rd = new BufferedReader(new InputStreamReader(is));

          StringBuffer r = new StringBuffer(); 

          while((l = rd.readLine()) != null) {

            r.append(l);

            r.append('\r');

          }

          rd.close();

          System.out.println("out "+ r.toString());

我尝试过调试代码等,但仍然无法找到发生这种情况的可能原因。谁能帮我找出这个问题的原因和可能的解决方案?

最佳答案

错误信息是:

Server was unable to process request. --> Procedure or function 'sp__LogMessage' expects parameter '@pi_ClientID', which was not supplied.

这看起来像服务器上的 SQL 存储过程。检查以确保向其提供了客户端 ID。

关于java - 发送 POST 到 HTTPS - 逻辑问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10859851/

相关文章:

Java : static keyword in middle of class

google-chrome - Chrome 63 将 http 更改为 https

linux - 如何将延迟添加到 http 音频流

PHP 多形式验证和重定向

使用 HttpWebRequest 的 C# Ebay API 订单后 check_eligibility

java - Selenium webdriver :org. openqa.selenium.InvalidElementStateException:元素已禁用,因此可能无法用于操作

java - 未能延迟初始化角色集合 : could not initialize proxy - no Session error in @ManyToMany mappin annotation in Hibernate?

java - 获取未读短信数量的更快方法?

wordpress - 如何将我在 Http 中的所有帖子/页面重定向到 Https

使用 Jersey MultiFormData 的 Javascript 表单发布 - 空指针异常