Thread View: microsoft.public.inetserver.iis
2 messages
2 total messages
Started by Malcolm Ferguson
Tue, 23 Nov 1999 00:00
Help needed POSTing from Java to IIS 4.0/ISAPI
Author: Malcolm Ferguson
Date: Tue, 23 Nov 1999 00:00
Date: Tue, 23 Nov 1999 00:00
38 lines
2336 bytes
2336 bytes
Hi,
I'm having problems posting from an applet/application to an ISAPI
extension running under IIS 4.0. Can anybody tell me what I'm doing
wrong please. I got the code from Sun's sample stuff. I'm using JDK
1.1.8.
The following is the basic code that I'm using. Uncommenting the line
that declares "out" will cause a "FileNotFoundException" exception to be
thrown from sun.net.www.protocol.http.HttpURLConnection.getInputStream
(the line where "in" is declared and inited). On the server side
(inetinfo.exe running in MSVC++), I get a debug trace along the lines of
"Warning: no handler for command '...". The code as it stands works
without doing a POST. I have even tried specifying the "Content-Length"
in the request property, but to no avail.
try {
URLConnection connection = new URL(m_strPostUrl).openConnection();
connection.setDoOutput(true);
//PrintWriter out = new PrintWriter(connection.getOutputStream());
//out.println("Text posted from the client");
//out.close();
BufferedReader in = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
catch (Exception excp) {
excp.printStackTrace();
}
}
MFC "feature" - Re: Help needed POSTing from Java to IIS 4.0/ISAPI
Author: Malcolm Ferguson
Date: Tue, 23 Nov 1999 00:00
Date: Tue, 23 Nov 1999 00:00
60 lines
3148 bytes
3148 bytes
Found it! After debugging through MFC ISAPI, I've determined it to be a
"feature" of MFC that was causing the problem. It seems that MFC expects
there to be no parameters to the ISAPI method. It also expects the handler
to have one string parameter, and that there is no ON_PARSE_COMMAND_PARAMS
macro for the ISAPI method. The POST data is passed as the string param.
Therefore, to work:
ON_PARSE_COMMAND(myMethod, CRptServerExtension, ITS_PSTR/*......*/)
//ON_PARSE_COMMAND_PARAMS(......)
:
:
void CMyServerExtension::myMethod(CHttpServerContext* pCtxt),
LPCTSTR szPostData)
{
// Do something
}
Malcolm Ferguson wrote:
> Hi,
>
> I'm having problems posting from an applet/application to an ISAPI
> extension running under IIS 4.0. Can anybody tell me what I'm doing
> wrong please. I got the code from Sun's sample stuff. I'm using JDK
> 1.1.8.
>
> The following is the basic code that I'm using. Uncommenting the line
> that declares "out" will cause a "FileNotFoundException" exception to be
> thrown from sun.net.www.protocol.http.HttpURLConnection.getInputStream
> (the line where "in" is declared and inited). On the server side
> (inetinfo.exe running in MSVC++), I get a debug trace along the lines of
> "Warning: no handler for command '...". The code as it stands works
> without doing a POST. I have even tried specifying the "Content-Length"
> in the request property, but to no avail.
>
> try {
> URLConnection connection = new URL(m_strPostUrl).openConnection();
> connection.setDoOutput(true);
>
> //PrintWriter out = new PrintWriter(connection.getOutputStream());
> //out.println("Text posted from the client");
> //out.close();
>
> BufferedReader in = new BufferedReader(new
> InputStreamReader(connection.getInputStream()));
> String inputLine;
>
> while ((inputLine = in.readLine()) != null)
> System.out.println(inputLine);
>
> in.close();
> }
> catch (Exception excp) {
> excp.printStackTrace();
> }
> }
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads