You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Muhammad Owais Ansari <ow...@cyber.net.pk> on 2005/12/17 08:32:47 UTC
Form Data
Hi, All
I am unable to get the posted xml data from a dotnet application (sending
code attached) using the ServletInputStream (code attached).
While if I tried to get the same posted data/XML in cgi pearl (code
attached) and asp.net thought the inputstream it picks the data/XML as form
data,
The application sending the xml data is not under my control hence can not
change the way its working.
----------------------------------------------------------------------------
------------------------------------
DotNet Code for sending XML
----------------------------------------------------------------------------
------------------------------------
Dim txtURN As String
Dim sentXML As String
txtURN = "http://tomcatserver:8080/dsl/ShowStreamInput.jsp"
' Comments : Creating XML dom
sentXML = "<?xml version=""1.0""?><palindrome>Hello
Bilal</palindrome>"
uidoc.document.txtSent = sentXML
With objSendXMLDOM
.async = False
.loadXML sentXML
End With
' Comments : Now Sending the XML
With objXMLHTTP
.open "POST", txtURN, False
.send objSendXMLDOM
End With
----------------------------------------------------------------------------
------------------------------------
----------------------------------------------------------------------------
------------------------------------
ShowStreamInput.jsp
----------------------------------------------------------------------------
------------------------------------
<%@ page import="java.io.*"%>
<%
InputStream in = request.getInputStream();
StringBuffer input = new StringBuffer();
while(true)
{
System.out.println("its running");
int ch = in.read();
if(ch==-1)
break;
System.out.println((char)ch);
input.append(((char)ch));
}
System.out.println("inputStream: "+input.toString());
%><%=input.toString()%>
----------------------------------------------------------------------------
------------------------------------
----------------------------------------------------------------------------
------------------------------------
ASP.net code which is picking the data
----------------------------------------------------------------------------
------------------------------------
Try
Dim fso As New System.IO.BinaryReader(Request.InputStream)
fso.ReadString()
Catch ex As Exception
End Try
----------------------------------------------------------------------------
------------------------------------
----------------------------------------------------------------------------
------------------------------------
CGI Perl code which is picking the data
----------------------------------------------------------------------------
------------------------------------
#!/opt/portal/6.2/bin/perl
require 'pin_webutils.pl';
print "Content-type: text/html\n\n";
&pin_process_form_data ();
print "<br><br>";
foreach $key (keys(%FORM))
{
$val = $FORM{"$key"};
print "<br>*** $key = $val\n";
}
----------------------------------------------------------------------------
------------------------------------
Does any one have a clue; I'll be very great full for any kind help.
Regards,
M. Owais Ansari