Click here to Skip to main content
15,894,907 members
Home / Discussions / C#
   

C#

 
AnswerRe: HL7 integration with C# Pin
DaveyM6925-Jul-08 9:12
professionalDaveyM6925-Jul-08 9:12 
AnswerRe: HL7 integration with C# Pin
Bob Nadler25-Jul-08 12:25
Bob Nadler25-Jul-08 12:25 
AnswerRe: HL7 integration with C# Pin
#realJSOP26-Jul-08 0:47
mve#realJSOP26-Jul-08 0:47 
GeneralHL7 integration with C# PinPopular
Bob Nadler30-Jul-08 17:44
Bob Nadler30-Jul-08 17:44 
QuestionCharArrayReader Pin
DwR25-Jul-08 8:25
DwR25-Jul-08 8:25 
AnswerRe: CharArrayReader Pin
SomeGuyThatIsMe25-Jul-08 8:26
SomeGuyThatIsMe25-Jul-08 8:26 
AnswerRe: CharArrayReader Pin
DaveyM6925-Jul-08 9:04
professionalDaveyM6925-Jul-08 9:04 
QuestionHttpRequest and Submit button in html Pin
f4hd25-Jul-08 8:24
f4hd25-Jul-08 8:24 
Hi,

I'm trying to run a ccxml, and consequently, a voiceXML page externally from the server (like through my application) and the documentation of the server mention that it can be done using HTTP POST.

Following is a simple example of html that works and successfully starts a call on a remote destination


<html>
	<body>
		<form method="post" action="http://localhost:4045/basichttp" enctype="application/x-www-form-urlencoded">
			ID="Form1">
			name: <input type="text" name="name" size="40" value="OutBoundCallEvent" id="Text1" />
			<br />
			URI to be contacted by the outbound: <input type="text" name="ToBeContacted_URI" size="52" value="10.2.50.42" id="Text5" />
			<br />
			VoiceXML URI: <input type="text" name="VoiceXML_URI" size="73" value="file:///C:/voiceXML/three.vxml">
				ID="Text6" />
			<br />
			CCXML URI: <input type="text" name="uri" size="75" value="file:///C:/CCXML/outboundcall.ccxml">
				ID="Text7" />
			<br />
			<input type="submit" id="Submit1" name="Submit1">
		</input></input></input></form>
	</body>
</html>


But I want to achieve the same effect through my c# application and I am using HttpRequest and HttpResponse to mimic submitting the form above.

following is my attempt on this

string uri = @"http://localhost:4045/basichttp";
string data = @"name=OutBoundCallEvent&ToBeContacted_URI=10.2.50.42&VoiceXML_URI=file:///C:/voiceXML/three.vxml&uri=file:///C:/CCXML/outboundcall.ccxml";
byte [] bytes = System.Text.Encoding.ASCII.GetBytes(data);

HttpWebRequest req = (HttpWebRequest) WebRequest.Create(uri);
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
req.ContentLength = bytes.Length;

System.IO.Stream os = req.GetRequestStream();
os.Write (bytes, 0, bytes.Length);
os.Close();

HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
if (resp== null)
{
    MessageBox.Show("Problem in sending response!");
}


System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
string result = sr.ReadToEnd().Trim();
MessageBox.Show("All done!");


Now when I try to get the response using HttpResponse I get an error " The remote server returned an error: (400) Bad Request."

Q1 Does writing the data into the stream means the server has send the data just like pressing the submit button? or does the using the gerResponse method this happens?
Q2 Is there something im missing in order to achieve a simple submit function? I have tried sending some data over to an asp page and use response like above and it all seems to work fine.

Any help will be greatly appreciated.
Kind Regards
Fahd
AnswerRe: HttpRequest and Submit button in html Pin
f4hd31-Jul-08 5:40
f4hd31-Jul-08 5:40 
QuestionWebServices in C#.net Pin
balu1234525-Jul-08 8:01
balu1234525-Jul-08 8:01 
AnswerRe: WebServices in C#.net Pin
Ashfield25-Jul-08 8:26
Ashfield25-Jul-08 8:26 
GeneralRe: WebServices in C#.net Pin
SomeGuyThatIsMe25-Jul-08 8:29
SomeGuyThatIsMe25-Jul-08 8:29 
GeneralRe: WebServices in C#.net Pin
balu1234525-Jul-08 8:36
balu1234525-Jul-08 8:36 
GeneralRe: WebServices in C#.net Pin
Ashfield25-Jul-08 9:13
Ashfield25-Jul-08 9:13 
QuestionProblem setting FormBorderStyle = WindowState.Maximized Pin
dlarkin7725-Jul-08 5:50
dlarkin7725-Jul-08 5:50 
AnswerRe: Problem setting FormBorderStyle = WindowState.Maximized Pin
DaveyM6925-Jul-08 6:17
professionalDaveyM6925-Jul-08 6:17 
GeneralRe: Problem setting FormBorderStyle = WindowState.Maximized Pin
dlarkin7725-Jul-08 6:22
dlarkin7725-Jul-08 6:22 
QuestiononBefore unload event Pin
Archana New to Dotnet25-Jul-08 5:30
Archana New to Dotnet25-Jul-08 5:30 
AnswerJavascript question :rolleyes: Pin
led mike25-Jul-08 5:43
led mike25-Jul-08 5:43 
QuestionTaking order with PDA Pin
Yulianto.25-Jul-08 4:55
Yulianto.25-Jul-08 4:55 
AnswerRe: Taking order with PDA Pin
hammerstein0525-Jul-08 5:33
hammerstein0525-Jul-08 5:33 
GeneralRe: Taking order with PDA Pin
DaveyM6925-Jul-08 6:21
professionalDaveyM6925-Jul-08 6:21 
GeneralRe: Taking order with PDA Pin
DaveyM6925-Jul-08 6:34
professionalDaveyM6925-Jul-08 6:34 
AnswerRe: Taking order with PDA Pin
DaveyM6925-Jul-08 8:07
professionalDaveyM6925-Jul-08 8:07 
Questionlan based application Pin
umeshdaiya25-Jul-08 4:04
umeshdaiya25-Jul-08 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.