Passing Xml to Stored Procedure exposed as WebService in SQL2005

  • Hi I am trying to PASS xml to the stored procedure which is exposed as webservice in sql Server 2005 but getting following Error

    There was an error in the incoming SOAP request packet: Client, InvalidXml, InvalidEscapingSequence

    my code in .net is

    XmlDocument l_doc = new XmlDocument();

    XmlDocumentFragment l_frag = l_doc.CreateDocumentFragment();

    l_frag.InnerXml = " ";

    // Create an XmlNode array (should never require more than one element).

    System.Xml.XmlNode[] xmlnodes = new System.Xml.XmlNode[1];

    // Put the XmlDocumentFragment in the array and fill your XmlDt

    xmlnodes[0] = (System.Xml.XmlNode)l_frag;

    XmlNodeList l_nodeList = l_doc.SelectNodes("//items");

    XmlNode[] xnode = new XmlNode[l_nodeList.Count];

    AMCS_WasteSkipSQLSERVER.xml l_xml = new AMCS_WasteSkipManagement.AMCS_WasteSkipSQLSERVER.xml();

    l_xml.Any = xnode ;

    SqlInt32 ErrorCode = 0;

    SqlString ErrorText = "";

    try

    {

    m_wsSQL.TestXmlInput(l_xml, ref ErrorCode, ref ErrorText);

    }

    catch (System.Web.Services.Protocols.SoapException ex)

    {

    MessageBox.Show(ex.InnerException.ToString());

    }

  • Hi,

    I don't know if you found a solution for your problem (hope so, since 2009 ...), but I recently had the same problem, and found a solution.

    As crazy as it sounds, this is due to the naming of your stored procedure parameters.

    If the name contains the pattern '_xml', you will have the problem. Change anything (remove the _, double the x, ...), and your problem will be solved !

    Regards.

    JN.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply