Querying a Web Service - InfoPath Dev
in

InfoPath Dev

Querying a Web Service

Last post 08-10-2005 11:14 PM by Coita Thierry. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 08-08-2005 02:32 PM

    • speddi
    • Not Ranked
    • Joined on 08-08-2005
    • USA
    • Posts 6

    Querying a Web Service

    Hi! I am trying to query a web service through managed code but somehow get this message that. The web service takes to input parameters namely serachcolumn and searchtext.

    System.NullReferenceException
    Object reference not set to an instance of an object.
    at HLA.HLA.CTRL3_22_OnClick(DocActionEvent e) in c:\hla\formcode.cs:line 60
    at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)


    Here is the code that I am following:

    DataObject objDO = null;
    objDO = thisXDocument.DataObjects["getPatient"];

    IXMLDOMDocument3 domXML = (IXMLDOMDocument3) objDO.DOM;
    domXML.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:s0=\"http://tempuri.org/\"");
    IXMLDOMNode QueryInput = objDO.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/s0:getPatient/s0:SearchColumn" );
    IXMLDOMNode RidNode = thisXDocument.DOM.selectSingleNode("/my:myFields/my:SearchGroup/my:ddlSearch");
    QueryInput.text = RidNode.text;
    objDO.Query();

    IXMLDOMNode QueryInput1 = objDO.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/s0:getPatient/s0:SearchText" );
    IXMLDOMNode RidNode1 = thisXDocument.DOM.selectSingleNode("/my:myFields/my:SearchGroup/my:txtSearch");

    QueryInput1.text = RidNode1.text;
    objDO.Query();

    I tried to follow the article listed in infopath dev using IXMLDOMDocument3 and changing the property it somehow does not work any suggestions!!!

    Thanks in advacne



    speddi
  • 08-08-2005 09:30 PM In reply to

    Hi Speddi,
    On which line you are getting error here.
    Try this out and let me know, on which line you are getting the error.

    IXMLDOMDocument3 domXML = (IXMLDOMDocument3) thisXDocument.DataObjects["getPatient"];
    domXML.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:s0=\"http://tempuri.org/\"");


    Agni
    InfoPath Dev India
  • 08-09-2005 08:31 AM In reply to

    • speddi
    • Not Ranked
    • Joined on 08-08-2005
    • USA
    • Posts 6
    Hi Agni,

    IXMLDOMDocument3 domXML = (IXMLDOMDocument3) thisXDocument.DataObjects["getPatient"].DOM;
    domXML.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:s0=\"http://tempuri.org/\"");
    IXMLDOMNode QueryInput = objDO.DOM.selectSingleNode("dfs:myFields/dfs:queryFields/s0:getPatient/s0:SearchColumn");
    IXMLDOMNode RidNode = thisXDocument.DOM.selectSingleNode("/my:myFields/my:SearchGroup/my:ddlSearch");
    QueryInput.text = RidNode.text;

    I tried what you have suggested and still get a System.NullReferenceException at the last line of the code given above. For some reason when I view domXML in the debuggeer window then I see that the node value is System.DBNull.Value and nodetypedvalue is System.DBNull.value am I missing something.

    Thanks in advance




    speddi
  • 08-10-2005 02:07 AM In reply to

    Hi speddi,

    Are you that RidNode1 is not empty? if you put this value in a string like this:

    string toto= RidNode.text;

    Have somethings inner? Put break point in the debugger for see

    If it's the case! Are you sure that QueryInput has the good path in your secondary datasource? You can verify! Put an expression box in design mode click Fx and after insert field or group choose the field of your desire and after click edit XPath(advanced) and infopath show you the good path compare with the path that you have in your code!

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 08-10-2005 09:54 AM In reply to

    • speddi
    • Not Ranked
    • Joined on 08-08-2005
    • USA
    • Posts 6
    does not work.

    I was debugging this and found out that there are no child nodes under dfs:queryfields

    i debugges the following piece of code
    domXML.selectSingleNode("dfs:myFields/dfs:queryFields")

    Am i missing anything. Any help on this will be greatly appreciated

    Thanks in advance.

    --Sumanth.


    speddi
  • 08-10-2005 08:38 PM In reply to

    Hi Speddi,
    When you created the webservice connection, did you get the parameters to fill out?
    If you got parameters to fill, then you should be able to see the prameters in the datasourse section in the InfoPath designer taskpane.

    If the parameters are avalilable in the datasource, now open the dataconnections .xml file and check out if the parameters are available.

    please check out all of the above things.

    Agni
    InfoPath Dev India
  • 08-10-2005 11:14 PM In reply to

    Hi,

    Like I say in my last post the easy way to verify the path in your secondary datasource is first see in design mode data source menu if your query fields exist

    if not make an update of your secondary datasource for do this go on tools, dataconnection and clik your datasource (getPatient)and click modify do one more time this wizard and your data source is uptdated now see if your query fields are here!

    and after to that step by step and after delete this control:

    Put an expression box in design mode.
    click Fx and after insert field or group
    choose the field of your desire (in your case the query fields "SearchColumn")
    after click the checkbox "edit XPath(advanced)" and infopath show you the good path compare with the path that you have in your code!

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.