passing xml to servlet file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I'm writig an application that sends an http request to java servlet file.
I have to pass an xml file to the servlet.

How should I pass xml file to the file.

When I try to access the url directly it shows me

Forbidden
You do not have permission to access /RequestListenerServlet on this server.

Additionally, error 403 Forbidden was encountered while attempting to use
ErrorDocument to handle the request.


Thanks in advance,

das
 
Das,

This sounds like a permissions issue to me. How are you making the
request? I recommend that you use the HttpWebRequest class, and configure
the Credentials property to provide a user that can access the page.

As for sending the XML file, once you have the HttpWebRequest instance,
you can call GetRequestStream and you will get a stream that will enable you
to write directly to the request stream.

Hope this helps.
 
Hi Nicholson,
Thanks a lot for the reply, at the moment I'm not looking at the code. Ya
I'm using HttpWebRequest class can you please write some code for setting the
credential & passing the xml file to the server.

The main objective is setting the credentials and passing the xml file to
the target server.

Thanks a lot...


Regards,

das

Nicholas Paldino said:
Das,

This sounds like a permissions issue to me. How are you making the
request? I recommend that you use the HttpWebRequest class, and configure
the Credentials property to provide a user that can access the page.

As for sending the XML file, once you have the HttpWebRequest instance,
you can call GetRequestStream and you will get a stream that will enable you
to write directly to the request stream.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Das said:
Hi all,
I'm writig an application that sends an http request to java servlet file.
I have to pass an xml file to the servlet.

How should I pass xml file to the file.

When I try to access the url directly it shows me

Forbidden
You do not have permission to access /RequestListenerServlet on this
server.

Additionally, error 403 Forbidden was encountered while attempting to use
ErrorDocument to handle the request.


Thanks in advance,

das
 
Das,

It's simple. Just call the Credentials property and set it to an
instance of NetworkCredentials, where you can set a username and password.

Then, call the GetRequestStream, and then call the methods on the Stream
returned to write the file to the request stream. You might have to change
the content type of the request, but that should be too hard (it's just
another property on the HttpWebRequest).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Das said:
Hi Nicholson,
Thanks a lot for the reply, at the moment I'm not looking at the code. Ya
I'm using HttpWebRequest class can you please write some code for setting
the
credential & passing the xml file to the server.

The main objective is setting the credentials and passing the xml file to
the target server.

Thanks a lot...


Regards,

das

Nicholas Paldino said:
Das,

This sounds like a permissions issue to me. How are you making the
request? I recommend that you use the HttpWebRequest class, and
configure
the Credentials property to provide a user that can access the page.

As for sending the XML file, once you have the HttpWebRequest
instance,
you can call GetRequestStream and you will get a stream that will enable
you
to write directly to the request stream.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Das said:
Hi all,
I'm writig an application that sends an http request to java servlet
file.
I have to pass an xml file to the servlet.

How should I pass xml file to the file.

When I try to access the url directly it shows me

Forbidden
You do not have permission to access /RequestListenerServlet on this
server.

Additionally, error 403 Forbidden was encountered while attempting to
use
ErrorDocument to handle the request.


Thanks in advance,

das
 
Back
Top