473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Csharp .NET - VS2003 - console application - Webservicerequest and sending SOAP body

Dav
I used soapUI (webservice testing tool) to test thrird party secure ondemand webservice and worked fine and communicating from our proxy. they authenticated our proxy port . but when i deploy .NET console C# client to test, I am not getting response and throwing Internal exception error 500. don't know what i am missing in the following code and looks to me everything is fine.
Note: basic authentication is not required, bcos they onfigured our proxy.

Any help would be great and I really appreciate that. Thanks.
namespace SampleSoapClient
{

class SampleCall
{

[STAThread]
public static void Main(string[] args)
{

HttpWebRequest req =

(HttpWebRequest)WebRequest.Create("https://");
System.Net.WebProxy myProxy = new System.Net.WebProxy("my-proxy:80",false);
req.Proxy = myProxy;

string soapRequestStr;
soaprequest = " SOAP BODY";
string errMsg;

req.Method = "POST";
req.ContentType = "text/xml";
req.ContentLength = soaprequest.Length;
//req.Accept = "text/xml";
// REQUEST IS FIND AND NOT THROWING ANY EXCEPTION
try
{
Stream myStream = req.GetRequestStream();
StreamWriter sWriter = new StreamWriter(myStream);
sWriter.Write(soapRequestStr);
sWriter.Close();

}
catch(Exception exp)
{
errMsg = "Stream writer object error : " + exp.Message;
Console.WriteLine(errMsg);
}

// RESPONSE IS THROWING EXCEPTION. Internal Web exception error 500

WebResponse resp = null;
StreamReader sReader = null;
string result;
try
{
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
resp = req.GetResponse();
Stream respStream = resp.GetResponseStream();
sReader = new StreamReader(respStream);
result = sReader.ReadToEnd();
}
catch(Exception ex)
{
errMsg = "Response error : " + ex.Message;
Console.WriteLine(errMsg);
}

} // main
} // class SampleCall
} // namespace

Jun 27 '08 #1
2 1996

"Dav" wrote in message news:20****************@cooltoad.com...
>I used soapUI (webservice testing tool) to test thrird party secure
ondemand webservice and worked fine and communicating from our proxy. they
authenticated our proxy port . but when i deploy .NET console C# client to
test, I am not getting response and throwing Internal exception error 500.
don't know what i am missing in the following code and looks to me
everything is fine.
-------

Is there not a more detailed explanation of the error in the application or
system event log on the machine?

Jun 27 '08 #2
It just throwing me out as soon as the web response object called. the error was
"The remote server returned an error (500) Internal Server Error"
status Protocol error
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call...
0
by: Craig | last post by:
We have a customer who sent us a WSDL containing the following snippet: <message name="PP6000.Execute"> <part name="Xmlreaderlvcaux" type="xsd:string"/> </message> We imported this into our...
4
by: Mark | last post by:
i have a very simple web servive Imports System.Web.Services <System.Web.Services.WebService(Namespace:="urn:Example1")> _ Public Class Example1 Inherits System.Web.Services.WebService
3
by: mark kurten | last post by:
I have a soap message that looks like this. s = s & " <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" s = s & " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" s =...
0
by: Chris | last post by:
I have a customer who wants to send us a XML message like this: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">...
9
by: savvy | last post by:
i'm trying to compile a simple console application for sending a mail, my main idea is to schedule it to a particular time for sending mails using the windows schedular task lateron. Therefore i...
2
by: Paul Hale | last post by:
I have a vb.net web service and client that are both working fine. If someone wanted to consume our web service using .NET, no problem. Im a little confused on how non .NET clients would use the...
3
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce...
3
by: Joshua Beall | last post by:
Hi All, I've got the following PHP code: $service = new SoapClient("http://www.webservicex.net/length.asmx? wsdl"); $result = $service->ChangeLengthUnit(10,"Inches","Centimeters");...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.