Click here to Skip to main content
15,915,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I need help in my code migration.Thanks in advance.

I have an asp code which has to be migrated to asp.net (Current ASP code uses com components(Server.CreateObject ("MSXML2.ServerXMLHTTP")) to post the data to Partner System ( Remote Server) which i have to migrate to .net)
Issue:
I am facing difficulty in determining how to read the request (XML Data)in my webpage,which is posted through "POST" method from Fusion system through WebService.
Fusions system is going to send xml data to webpage through “HTTP Post” method and our Webpage has to read the request and send that XML data to Partner System( Remote System).
Below is the sample code which is used by fusion to post the data:

string sPostURL =(string) Utility.RegUtil.getAppConfig("PostURL",typeof(System.String));
string sPostURLUser=(string) Utility.RegUtil.getAppConfig("PostURLUser",typeof(System.String));
string sPostURLPassword=(string) Utility.RegUtil.getAppConfig("PostURLPassword",typeof(System.String));
string sHTTPResponse = "";
MSXML2.ServerXMLHTTPClass objXMLPost = new MSXML2.ServerXMLHTTPClass();
objXMLPost.setTimeouts(60000, 60000, 300000, 60000);
objXMLPost.open("POST", sPostURL, false, sPostURLUser,sPostURLPassword);
objXMLPost.setRequestHeader("Content-Type", "text/xml");
objXMLPost.send(sXmlToPost);
while (objXMLPost.readyState != 4)
{
//Application.DoEvents();
}
sHTTPResponse = objXMLPost.responseText;
if (objXMLPost.status !=200)
sHTTPResponse="";
return sHTTPResponse;


In my C# .net application I am trying to use HttpWebRequest and HttpWebResponse to post the data to Partner System.
Posted
Updated 14-Sep-11 4:11am
v2
Comments
BobJanova 14-Sep-11 10:12am    
Edited to put code in a <pre> block. Please help everyone by formatting your question nicely to start with :)

1 solution

That should directly translate to a HttpWebRequest. Set the method to POST, the mime type to text/xml and the content to whatever is in sXmlToPost. And respond to an event instead of sitting in a hot wait for it to finish.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900