[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Receive stream from post http

Posted on 2006-04-19
5
Medium Priority
?
262 Views
Last Modified: 2008-02-01
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

regards
0
Comment
Question by:Dnx_7
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:naveenkohli
ID: 16486864
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.
0
 
LVL 2

Author Comment

by:Dnx_7
ID: 16486953
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

regards
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 16487035
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".
http://www.netomatix.com/HttpPostData.aspx

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.

http://www.netomatix.com/Products/DocumentManagement/HTMLParserNet.aspx
0
 
LVL 23

Accepted Solution

by:
naveenkohli earned 2000 total points
ID: 16501100
Here is complete sample of what you are trying to do.

http://www.netomatix.com/development/xmlwebrequest.aspx
0
 
LVL 2

Author Comment

by:Dnx_7
ID: 16501440
great, thank you very much
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question