Populate webservice XML Node parameter - InfoPath Dev
in

InfoPath Dev

Populate webservice XML Node parameter

Last post 04-20-2005 05:56 AM by Agni Jonnalagadda. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-15-2005 01:53 AM

    Populate webservice XML Node parameter

    Hi All,

    Please could someone advise me on how to populate an XML Node parameter on a secondary data source webservice call. The simplified code below errors with "The left-hand side of an assignment must be a variable, property or indexer" I understand the error but i am now confused as to how i am going to populate this non simple data type webservice parameter.

    // Create new XML Document.
    System.Xml.XmlDataDocument xmlDataDoc = new System.Xml.XmlDataDocument();

    // Populate document.
    xmlDataDoc.LoadXml("<HELP><Scott>Test</Scott></HELP>");

    // Create Node.
    System.Xml.XmlNode xmlNodeParam = xmlDataDoc.FirstChild;

    // Assign Node to webservice parameter.
    thisXDocument.GetDOM("BuildTaskPane").selectSingleNode("//*[local-name()='xmlNodeData']") = xmlNodeParam;

    xmlNodeData is the name of secondary data source queryField.
    Any pointers would be greatly appreciated.

    Many thanks in advance, Scott



  • 03-16-2005 02:28 AM In reply to

    Re: Populate webservice XML Node parameter

    Hi ScottAtRVC,
    I dont know whether i understood your problem in full or not, but let me put your question in my words

    before answering it.

    You want to submit XML as an Input parameter to a webservice dataconnection.
    If my understanding is correct here is the solution:

    1. If webservice wants xml as a string you can pass your xml as below

    thisXDocument.GetDOM("BuildTaskPane").selectSingleNode("//*[local-name()='xmlNodeData']").text = "<HELP><Scott>Test</Scott></HELP>";

    2. If webservice wants xml as a child to your "xmlNodeData" node then you need to do the following

    //create a dom with your XML
    string sXml = "<HELP><Scott>Test</Scott></HELP>" ;
    IXMLDOMDocument oXml = thisXDocument.CreateDOM();
    oXml.async = false;
    oXml.loadXML(sXml);
    //Append your dom to the Node the selected Node
    thisXDocument.GetDOM("BuildTaskPane").selectSingleNode("//*[local-name()='xmlNodeData']").appendChild(oXml)


    Hope this Helps!

    Agni
    InfopathDev India
  • 03-16-2005 02:57 AM In reply to

    Re: Populate webservice XML Node parameter

    Agni. Thanks for your reply and time. This worked a treat. The only difference was i needed to assign a Node to the parameter and not a document. So the final code was;

    //create a dom with your XML
    string sXml = "<HELP><Scott>Test</Scott></HELP>" ;

    IXMLDOMDocument oXml = thisXDocument.CreateDOM();
    oXml.async = false;
    oXml.loadXML(sXml);

    IXMLDOMNode oNode = oXml.createNode(System.Xml.XmlNodeType.Element, "Data", string.Empty);
    oNode = oXml.documentElement;


    //Append your dom to the Node the selected Node
    thisXDocument.GetDOM("BuildTaskPane").selectSingleNode("//*[local-name()='xmlnodeDOM']").appendChild(oNode);

    Once again, many thanks for your time.
    kind regards
    Scott
  • 04-20-2005 05:56 AM In reply to

    Re: Populate webservice XML Node parameter

    Great to know that it helped you :).

    Agni
    InfopathDev India
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.