I can't connect to web service on VSTA - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

I can't connect to web service on VSTA

Last post 10-26-2012 08:16 AM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-24-2012 08:40 AM

    • axi23
    • Not Ranked
    • Joined on 10-24-2012
    • Posts 3

    I can't connect to web service on VSTA

     Hello,

     I'm trying to connect to a web service method hosted in Sharepoint . When i did it from the program i'm allow to get result cut when i do it on FormEvents_Loading method, it doesnt give me any result but unfortuantely it doesn´t give any error too.

     FormEvents_Loading code

     

           public void FormEvents_Loading(object sender, LoadingEventArgs e)
            {

        
                    WebServiceConnection connection= (WebServiceConnection)this.DataConnections["getAttachs"];


                    XmlDocument inputDoc = new XmlDocument();
                    XmlDocument outputDoc = new XmlDocument();
                    XmlDocument errorDoc = new XmlDocument();

                    // Create the XPathNavigator objects for the documents
                    XPathNavigator inputNav = inputDoc.CreateNavigator();
                    XPathNavigator outputNav = outputDoc.CreateNavigator();
                    XPathNavigator errorNav = errorDoc.CreateNavigator();

    connection.Execute(inputNav, outputNav, errorNav);


                    XPathNodeIterator outIterator = outputNav.CreateNavigator().Select("/dfs:myFields/dfs:dataFields/ns1:getAttachsResponse/ns1:getAttachsResult/ns1:string", NamespaceManager);
              
                   }
               

    outIterator.count always return 0 value ,so it seems that it never fills a iterator. 

     Someone have any idea that why happens this?

     Thanks,

     Regards           

     

    Filed under:
  • 10-24-2012 09:41 AM In reply to

    Re: I can't connect to web service on VSTA

    The code in your post won't actually compile, will it? You are using inputNav, etc prior to actually executing the connection?
    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-24-2012 09:55 AM In reply to

    • axi23
    • Not Ranked
    • Joined on 10-24-2012
    • Posts 3

    Re: I can't connect to web service on VSTA

    Oh my god! Sorry. I forgot to paste execute action and then i pasted it in wrong place.

     I edit my first post with correct code. 

    Thanks for your answer

     Regards

     

  • 10-24-2012 10:02 AM In reply to

    Re: I can't connect to web service on VSTA

    I'd put some breakpoints in the code and run in debug so you can check the errorNav and the outputNav. Here's some help on how to do that in case you need it.
    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-26-2012 03:11 AM In reply to

    • axi23
    • Not Ranked
    • Joined on 10-24-2012
    • Posts 3

    Re: I can't connect to web service on VSTA

     Thanks! VSTA debuger is very cool.

    My problem wasn't in connection but i had outIterator always null. This happened because outputnav navigator returns  only [ns1:getAttachsResponse/ns1:getAttachsResult/ns1:string] so i have to select only that XPath.

     Thanks for your answers Hilary.

     Best regards

  • 10-26-2012 08:16 AM In reply to

    Re: I can't connect to web service on VSTA

    It is amazing how much easier it is write code when you can run in debug and figure out what your mistakes are, and it is something I think is often assumed (incorrectly) that everyone already knows this....
    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

Page 1 of 1 (6 items)
Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.