I am sending a SOAP request to a Partner webservice using C#,
public class EODReproting : System.Web.Services.WebService
{
/// <summary>
/// Execute a Soap WebService call
/// </summary>
[WebMethod(MessageName = "SendZRARequest")]
public void Execute()
{
HttpWebRequest request = CreateWebRequest();
XmlDocument soapEnvelopeXml = new XmlDocument();
soapEnvelopeXml.LoadXml(@"
<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ser=""http://service.bank.pmt.zra"" xmlns:xsd="" http://bean.bank.pmt.zra/xsd"">
<soapenv:Header/>
<soapenv:Body>
<ser:processPaymentNotificationReport>
<!--Zero or more repetitions:-->
<ser:pmtNotifyReport>
<!--Optional:-->
<xsd:amountPaid>XXXX</xsd:amountPaid>
<!--Optional:-->
<xsd:bankBranchCode>XXXXX</xsd:bankBranchCode>
<!--Optional:-->
<xsd:bankTransNo>XXXXX</xsd:bankTransNo>
<!--Optional:-->
<xsd:datePaid>XXXXXX</xsd:datePaid>
<!--Optional:-->
<xsd:paymentRegTransNo>XXXXXX</xsd:paymentRegTransNo>
<!--Optional:-->
<xsd:status>S</xsd:status>
<!--Optional:-->
<xsd:taxPayerName>BYAN MARTIN</xsd:taxPayerName>
<!--Optional:-->
<xsd:tin>1002760252</xsd:tin>
<!--Optional:-->
<xsd:transactionId>XXXXXXX</xsd:transactionId>
</ser:pmtNotifyReport>
</ser:processPaymentNotificationReport>
</soapenv:Body>
</soapenv:Envelope>");
using (Stream stream = request.GetRequestStream())
{
soapEnvelopeXml.Save(stream);
}
using (WebResponse response = request.GetResponse())
{
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
string soapResult = rd.ReadToEnd();
}
}
}
}
/// <summary>
/// Create a soap webrequest to [Url]
/// </summary>
/// <returns></returns>
public HttpWebRequest CreateWebRequest()
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://XX.XX.XX.XX:9999/ZraWebService/services/EODPaymentNotificationReportService.EODPaymentNotificationReportServiceHttpSoap11Endpoint/");
webRequest.Headers.Add("SOAPAction", "urn:processPaymentNotificationReport");
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
webRequest.Proxy = null;
return webRequest;
}
}
}
when invoking this method, I am getting an error logged in my logs folder,
2015.01.09 10:20:25.8485->The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse()
at EODReporting.ZRAEODReproting.Execute()
The partner tells me to send the request using HTTP/1.0, I want to do this in my code above. How can I do this ?