任何人都知道为什么我会收到此错误。我正在尝试发送 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/