0
votes

I am attempting to pass this string through a C# code but fails:

<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:Body1479374</soap:Body></soap:Envelope>

System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(string);

Tried to send as whole and as 3 parts but failing within Sectiona

string Sectiona = @"<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<acceptMessage xmlns = "http://ws.connectors.connect.mirth.com/" >< arg0 xmlns="">";

string Sectionb = "1479374";

string Sectionc = "</soap:Body></soap:Envelope>";

string DATA = Sectiona + Sectionb + Sectionc;

1

1 Answers

0
votes

You soap body tag is wrong. Use xml linq :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string xml = "<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>1479374</soap:Body></soap:Envelope>";
            XDocument doc = XDocument.Parse(xml);
        }
    }
}