Infopath Forms Services and Web Services (Infopath 2007 / MOSS 2007)



    HI all,

    I have written a simple web service that returns a string value.

    here is the code for the web service:


    <WebMethod> _

    Public Function getString() as String

    Return "TestString"

    End Function


    If I test the webservice from the service.asmx page it returns the correct value and works.


    Next i created a browser enabled from with a field called test-string-text-box

    I have created a secondary data connection to a the web service called getString, and disabled the store a copy on form option and left the automatically retrieve data option enabled.


     Next i went to the form open options and set the following actions:

    1 - Query data using a web service: getString

    2 - set a fields value: test-string-text-box = result of the getString web service retrieval.


     I converted the data connection to a UCDX file and tried both link type relative and link type store options, approving the UDCX files and uploading them to the central data connection store.


    Lastly i pulbished the form as a content type to a MOSS 2007 sharepoint library.


    When i open the form in a web browser it does not set the value of the text box to the result of the get string command.


    I have no idea what the problem is, any suggestions?


     Thanks in advance.


    Saturday, November 03, 2007 11:07 AM

All replies

  • Does it work if you just run it from the client (not from MOSS).


    Your steps seem correct to me.


    Can you tell if your web service is even being invoked by InfoPath?


    Saturday, November 03, 2007 12:59 PM

    HI Paul,


    If i use the infopath client to open the form the data is displayed in the field that i have bound the web service result to. I am guessing this means the web service is being invoked.


    I have also tried adding a refresh button to the form and tried to set the values after opening the form and this is also not working.


    Thanks for your reply.



    Saturday, November 03, 2007 1:08 PM
  • Have you found a solution to this problem yet?  I am having a problems with a secondary data connection not working in the browser as well.  The first problem I had was solved by adding the username and password to the .udcx file as follows:


          <udc:UseExplicit CredentialType="NTLM">
              <udc: Password>Password</udc: Password>


    "There is no space between the <udc: Password> above, but if I don't add the space, then a smiley face appears Stick out tongue


    This section will replace the existing udc:Authentication section of the file.


    Unfortunately, this approach did not solve my second problem.  I think the second problem has to do with the code I am using behind the form.  Keep up with my other post if you would like:


    Anyway, try my first fix to see if it is Authentication related and hopefully it will help point you in the right direction.



    Thursday, November 08, 2007 3:32 PM
  • Hi Bryant,


    I have inserted the authentication code and it still makes no difference. The big problem i have is that there is no error. It just does't populate the values.


    Thanks for your reply anyway.




    Monday, November 12, 2007 8:21 AM
  • Were you able to find a solution to your problem ?

    Monday, January 14, 2008 3:43 AM
  • Here is a sample UDC file for readonly type of web service. Hope this helps....


    Code Snippet


    <?xml version="1.0" encoding="UTF-8"?>
    <?MicrosoftWindowsSharePointServices ContentTypeID="0x010100B4CBD48E029A4ad8B62CB0E41868F2B0"?>
    <udc:DataSource MajorVersion="2" MinorVersion="0" xmlns:udc="">
     <udc:Description>Format: UDC V2; Connection Type: WebService; Purpose: ReadOnly;</udc:Description>
     <udc:Type MajorVersion="2" MinorVersion="0" Type="WebService">
      <udc:SubType MajorVersion="0" MinorVersion="0" Type=""/>
     <udc:ConnectionInfo Purpose="ReadOnly">

       <udc:ServiceUrl UseFormsServiceProxy="false">http://ServerName/WebServiceDirectoryName/WebServiceName.asmx</udc:ServiceUrl>
       <udc:ServiceUrl UseFormsServiceProxy="false"><udc:ServiceUrl>
       <udc:FileName>Specify a filename or formula</udc:FileName>
       <udc:FolderName AllowOverwrite=""/>



    Friday, January 25, 2008 12:58 AM