Dnx_7
asked on
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-url encoder
do i have to change something in my webservice?
please help
regards
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-url
do i have to change something in my webservice?
please help
regards
ASKER
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
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
1. Look at the code in following link. See how it is setting the content type to "application/x-www-form-ur lencoder". 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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great, thank you very much
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.