Soap Post Request

Hi all i am new to Soap request and i am trying to work out how i can do a POST request to one of our partners to send them information in XML format

the code i have so far is, any help would be appreciated, as i said this is my first time doing it this way, i can do it with JavaScript no problem but the receiving nginx server doesn’t have cors access.

also another this doing it server side would it even pass the CORS?

 @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System.Data.Sql;
@using System.Xml.Linq;
@using System.Text.RegularExpressions;
@using System.Security.Cryptography;
@using System.Text;
@using Umbraco.Core.Models;
@using System;
@using System.Net;
@using System.IO;
@using Stream;
@using StreamReader;
@using StreamWriter;

@{
    var uri = new Uri("https://icstest.3bm.nl/salesforce/salesforce.asmx?op=HelloWorld");
    var req = (HttpWebRequest)WebRequest.CreateDefault(uri);
    req.ContentType = "text/xml; charset=utf-8";
    req.Method = "POST";
    req.Accept = "text/xml";
    req.Headers.Add("SOAPAction", "https://icstest.3bm.nl/salesforce/HelloWorld");

    var strSoapMessage = @"<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/ 'xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'><soap:Body><add xmlns='http://tempuri.org/'><a>23</a><b>5</b></soap:Body></soap:Envelope>";

    var stream = new StreamWriter(req.GetRequestStream(), Encoding.UTF8);
    stream.Write(strSoapMessage);
}

Thanks

David


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/83824-soap-post-request