Trust Question - InfoPath Dev
in

InfoPath Dev

Trust Question

Last post 03-07-2007 10:27 AM by Greg Collins. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 03-02-2007 09:34 AM

    Trust Question

    Hello,

    In an InfoPath form I need to access a few web services using Jscript. Accessing the web services via JScript force me to create a fully trusted form?

    Thanks
  • 03-02-2007 11:52 AM In reply to

    If you are using a Web Service Data Connection, then you should not require full trust. If you are trying to write all the script needed to communicate directly with the Web sercice, then you might need full trust (not sure).
  • 03-02-2007 12:16 PM In reply to

    Greg,

    Thanks for the reply. When using Web Service Data Connection can I do the following:

    1) Pass paramters?
    2) Call it not as start up but rather using jscript for certain events?

    Thanks
  • 03-02-2007 12:33 PM In reply to

    yes to both. You establish the data connection using the designer. Then in script, you can set the parameters and call the Method function as necessary. The last page of the data connection wizard has a check box that you can clear in order to prevent the WS from being called onload.
  • 03-05-2007 12:04 PM In reply to

    Greg,

    Thanks for the help. I am struggling parsing through the xml response from the web service call. I have the following xml response:

    [left]<dfs:myFields xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:tns=\"http://localhost/LinkService/LinkService.asmx\">
    <dfs:queryFields>
    <tns:GetDirectives></tns:GetDirectives>
    </dfs:queryFields>
    <dfs:dataFields>
    <GetDirectivesResponse xmlns=\"http://localhost/LinkService/LinkService.asmx\">
    <GetDirectivesResult>
    <Content>
    <treeObjectID>2</treeObjectID>
    <parentObjectID>0</parentObjectID>
    <label>General Manual</label>
    <contentItemID>0</contentItemID>
    <fileID>0</fileID>
    <citation>GM</citation>
    <displayOrder>1</displayOrder>
    <hidden>false</hidden>
    <maxDisplay>10</maxDisplay>
    <allowRollUp>false</allowRollUp>
    </Content>
    ....

    I am using the following jscript code to parse the xml. I cannot get it to work. Any ideas?

    domXML = XDocument.GetDOM("GetDirectives");
    domXML.setProperty("SelectionNamespaces", "xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'");

    var objWorkflowNodes = domXML.selectNodes("/dfs:myFields/dfs:dataFields/GetDirectivesResponse/GetDirectivesResult/Content");

    objWorkflowNodes.Length = 0
  • 03-05-2007 02:56 PM In reply to

    You need to make sure you include all the appropriate namespaces. The XML you display above doesn't actually show the namespaces on each node... but they are still there. If you were to open the .xml file created when you set up your data connection you would be able to see a valid namespace on each node.

    You will need to set both namespaces in the setProperty() function. Then most likely your xpath should be something like (but you have to verify the namespaces per node):

    /dfs:myFields/dfs:dataFields/tns:GetDirectivesResponse/tns:GetDirectivesResult/tns:Content
  • 03-06-2007 08:05 AM In reply to

    Greg,

    Thanks for the help. I set the other property and still does not work. I created an alert to display the xml to see the actual xml and it exactly like the xml I posted before. So, the path you posted does not work. Any other ideas? Based on the xml this path should work:

    /dfs:myFields/dfs:dataFields/GetDirectivesResponse/GetDirectivesResult/Content


  • 03-06-2007 11:55 AM In reply to

    Displaying the XML in the alert will not show the true results. You will need to extract your form files and look at the actual .xml file created by InfoPath when you established your data connection.

    For example, the fact that your XML shows the following:

    <GetDirectivesResponse xmlns=\"http://localhost/LinkService/LinkService.asmx\">

    indicates that GetDirectivesResponse uses the 'tns' namespace. So at least that node will require the 'tns:' to be added to it.

    Looking at the contents of the ACTUAL file will reveal what namespace (if any) each node is required to have.
  • 03-06-2007 02:59 PM In reply to

    Greg,

    Thanks for your help. You were correct and it helped alot to extract the form files. I also had a question about adding parameters using Jscript. I got it to work by add a blank parameter via the wizard and then using DOM I changed tha value. Is there a better way to do this or is this it?

    Thanks
  • 03-07-2007 10:27 AM In reply to

    That is one way -- probably the easiest. The other way is to use insertBefore() or appendChild() functions to add the nodes. But, of course, they must be valid nodes for that WebService query parameters. It's probably safest to just do like you already did.
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.