Getting Object reference not set to an instance of an object error when run the Web Service RRS feed

  • Question

  • In Infopath 2003 I have added the web service as my secondary data source. It has a query field call tmsSummaryId(its int64). It is a parameter of my web service method.

    I am trying to query the web service using user Input

    I wrote following code.

    public void CTRL1_23_OnClick(DocActionEvent e)
                    // Write your code here.
                    IXMLDOMNode filed6 = thisXDocument.DOM.selectSingleNode("//my:field6");
                    IXMLDOMDocument2 domXml = (IXMLDOMDocument2)thisXDocument.DataObjects["GetCustomerData"].DOM;
                    domXml.setProperty("SelectionNamespaces", "xmlns:dfs='' xmlns:ns1=' http://localhost:6548/BusinessServices'");
                    IXMLDOMNode queryField = domXml.selectSingleNode("/dfs:myFields/dfs:queryFields");
                    //IXMLDOMNode queryField = domXml.selectSingleNode("/dfs:myFields/dfs:dataFields/GetCustomerDataResponse/GetCustomerDataResult/ParentName");
                    //filed2.text = queryField.nodeValue;
                    queryField.text =field6.text;


    when the executing the Query() method is giving an error calling

    System.NullReferenceException: Object reference not set to an instance of an object

    Can any one please help on this


    • Changed type Udaya726 Wednesday, April 21, 2010 12:27 PM I need an answer for this
    Wednesday, April 21, 2010 12:21 PM

All replies

  • Hi Udaya726,

    Thanks for your post.

    This forum is focusing on the Open XML SDK which provides developers a set of classes to easily create, consume, and manipulate Open XML files (e.g. wordprocessing, spreadsheet and presentation) without the need for automating Office client applications. Your question seems not related to the SDK and you might find other forum such as Innovate on Office which you may get more helpful information.

    BTW, from your shared error info, I guess there is some problem on thisXDocument.DataObjects["GetCustomerData"] which is null in runtime. So you may need to check the value of thisXDocument.DataObjects["GetCustomerData"] carefully.

    Hope this helps. If you have any question, please let me know.



    Thursday, April 22, 2010 2:06 AM
  • Thanks Lu,

    First of all sorry for the inconvenience. I was new to forums. So I mistakenly put this in this category.In the my question I add a Quick watch and looked the thisXDocument.DataObjects["GetCustomerData"].Its not empty.

    After add my web service into the info path It seems like follow.





     I have overcome this problem by accesing the node by like this

    IXMLDOMNode queryField = domXml.selectSingleNode("/dfs:myFields/dfs:queryFields").firstChild.firstChild

    But my objective is to address the node without using firstChild option.

    If i give as follows it gives the same error

    IXMLDOMNode queryField = domXml.selectSingleNode("/dfs:myFields/dfs:queryFields/ns1:GetCustomeData/ns1:tmsSummaryId")


    When i add a quick watch to this it gives null.


    Thursday, April 22, 2010 8:42 AM
  • Hi Udaya726,

    I'm afraid based on my knowledge I can't figure out the problem. Besides Innovate on Office, another suggestion is to raise the question in this newsgroup:, in which you might find more helpful information.



    Friday, April 23, 2010 10:11 AM