Cannot Retrieve Data From Web Service Using Manage - InfoPath Dev
in

InfoPath Dev

Cannot Retrieve Data From Web Service Using Manage

Last post 06-12-2005 03:38 AM by Shanthi Reddy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-06-2005 01:53 PM

    Cannot Retrieve Data From Web Service Using Manage

    Hello,

    I have a Web Service (GetADUsers) that I use As a Data Connection to Get a list of Users. The Web Service has four columns: AccountName, Email, Domain, DisplayName. I bound the Data Connection to a Drop Down (AccountName as Value, DisplayName as Display). When I the User selection is changed I need to get the Email and Domain for this User. I tried to set up a rule on the Drop Down, but I am always getting the first item in the list. I then tried to pull the data using code (VB.NET) as follows:

    -********************************************************************
    Dim NameSpaces As String = "xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'" &
    "xmlns:dsf='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'" & _
    " xmlns:tns='http://tempuri.org/Users.xsd'" & _
    " xmlns:i0='http://tempuri.org/Users.xsd'"

    Dim doc As IXMLDOMDocument3 = thisXDocument.DataObjects("GetADUsers").DOM

    doc.setProperty("SelectionNamespaces", NameSpaces)

    Dim AccountName As String = thisXDocument.DOM.selectSingleNode("//my:User").text

    'Get the selected node
    Dim selectedNode As DOMNode = doc.selectSingleNode( _
    "/dfs:myFields/dfs:dataFields/tns:GetADUsersResponse/tns:GetADUsersResult/i0:Users/i0:User[AccountName='" & AccountName & "']" & _
    "/i0:Domain")
    -********************************************************************

    And I get nothing for the selectedNode.

    If I use Only the
    doc.selectSingleNode("/dfs:myFields/dfs:dataFields")

    I get the fields.

    I Tried many versions of the "GetADUsersResponse" section, i.e. tns:GetADUsersResponse, i0:GetADUsersResponse, GetADUsersResponse but I always get nothing. My xml file looks like this:

    -********************************************************************
    <?xml version="1.0" encoding="utf-8" ?>
    - <Users xmlns="http://tempuri.org/DirectoryServices/ADUsers">
    - <xs:schema id="Users" targetNamespace="http://tempuri.org/Users.xsd" xmlns:mstns="http://tempuri.org/Users.xsd" xmlns="http://tempuri.org/Users.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
    - <xs:element name="Users" msdata:IsDataSet="true">
    - <xs:complexType>
    - <xs:choice maxOccurs="unbounded">
    - <xs:element name="User">
    - <xs:complexType>
    - <xs:sequence>
    <xs:element name="DisplayName" type="xs:string" minOccurs="0" />
    <xs:element name="Domain" type="xs:string" minOccurs="0" />
    <xs:element name="AccountName" type="xs:string" minOccurs="0" />
    <xs:element name="Email" type="xs:string" minOccurs="0" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    - <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
    - <Users xmlns="http://tempuri.org/Users.xsd">
    - <User diffgr:id="User1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
    <DisplayName>Bates, Aaron</DisplayName>
    <Domain>DomainName</Domain>
    <AccountName>AccountName</AccountName>
    <Email>Email</Email>
    </User>
    -********************************************************************

    Would love to hear suggestions to resolve this issue. You can email me to: [email protected]

    Thanks!

    Sharone Shani.
  • 06-12-2005 03:38 AM In reply to

    Re: Cannot Retrieve Data From Web Service Using Manage

    One suggestion is to use IXMLDOMDocument2 instead of IXMLDOMDocument3 and see if that will help. Could you also send the xml file which looks something like this which will a better idera of the Xpath

    <dfs:myFields xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:ns3="http://autonomysystems.com/webservices/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-02-14T15:56:41" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <dfs:queryFields>
    <ns3:QueryDocuments>
    <ns3:docTypeName>ses_cartender</ns3:docTypeName>
    <ns3:xpath></ns3:xpath>
    <ns3:index1></ns3:index1>
    <ns3:index2></ns3:index2>
    <ns3:index3></ns3:index3>
    </ns3:QueryDocuments>
    </dfs:queryFields>
    <dfs:dataFields>
    <ns3:QueryDocumentsResponse>
    <ns3:QueryDocumentsResult>
    <ns3:Success>false</ns3:Success>
    <ns3:Errors>
    <ns3:ErrorInfo>
    <ns3:Code></ns3:Code>
    <ns3:Description></ns3:Description>
    </ns3:ErrorInfo>
    </ns3:Errors>
    <ns3:ExecutionTime></ns3:ExecutionTime>
    </ns3:QueryDocumentsResult>
    <ns3:docInfos>
    <ns3:DocumentInfo>
    <ns3:DocID></ns3:DocID>
    <ns3:Content></ns3:Content>
    </ns3:DocumentInfo>
    </ns3:docInfos>
    </ns3:QueryDocumentsResponse>
    </dfs:dataFields>
    </dfs:myFields>


    Shanthi
    InfoPathDev India
    Shanthi Reddy
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.