Receive stream from post http

Hi experts

i need to create a function in my webservice that can receive a stream from a post http

how can i manage that?

also the content-type of the post http is text/xml and the webservice only accept application/x-www-form-urlencoder
do i have to change something in my webservice?

please help

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1. If you are sending the data as XML then you need to set "Conteny-Type" to "text/xml"
2. When response comes, you need to check the content type to make sure it is set to "text/xml" if thats what are expecting
3. When response comes back, the stream is already in ResponseStream property of "HttpResponse" object. You just need to read all the bytes and save them as XML document.
Dnx_7Author Commented:
hi naveenkohli

i'm a little bit constrained to ask this but if you can show me an example of :

- how to set content type to text/xml? web.config?
- how can you check that the "post" that arrive into the webservice is text/xml content type?
- an example of using responsestream with httpresponse?

thank you in advance

1. Look at the code in following link. See how it is setting the content type to "application/x-www-form-urlencoder". You need to replace that with "text/xml".

2. Response has property "ContentType". Its a string type. Check for "text/xml" substring in it.

3. Download HTMLParser library from following link. In HttpResponseManager class you will find all the code that checks content type and reads the content stream in byte arrays.
Here is complete sample of what you are trying to do.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dnx_7Author Commented:
great, thank you very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.