InfoPath referencing a Web Service - InfoPath Dev
in

InfoPath Dev

InfoPath referencing a Web Service

Last post 02-10-2007 04:34 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-08-2007 08:12 AM

    • snufse
    • Not Ranked
    • Joined on 02-01-2007
    • USA
    • Posts 12

    InfoPath referencing a Web Service

    I have a form that have an identification number. Thet number is an employee code and I have already written a web service that retrieves the employee name. This is the 1st time I work with InfoPath.

    I am trying to do a programming interface on the ValidateEvent for the "identificationNumber" field where I need to call the web service and return the name of the employee. I put the employee's name into the "name" field in the form.

    Step 1: I click on the "add a web reference". That takes me to the Add Web reference pop-up screen. I locate the the URL (http://localhost:3035/WebServiceTest1/Service.asmx) and then click "add reference" button.

    The value "localhost" appears in the reference field even if my web service is "WebServiceTest1". Is this correct? I changed the reference to "WebServiceTest1" which is the actual web service. Is this ok?

    Step 2: I now write my code like this.

    Imports WebServiceTest1

    Public Sub identificationNumber_Validating(ByVal sender As Object, ByVal e As XmlValidatingEventArgs)
    Dim MyWebService As New WebServiceTest1.Service
    Dim MyString As String
    MyString = FormState("_identificationNumber").ToString
    MyString = MyWebService.GetEmployeeName(MyString)
    FormState("_name") = MyString
    End Sub


    Does the code seem to be correct? How do I test and execute? Can anyone help? Thank you.


  • 02-10-2007 04:34 PM In reply to

    Re: InfoPath referencing a Web Service

    Hi Rolf,

    Is your Web service running on your local machine? If so, localhost is correct. However, that won't work when you have to roll it out to a server that you want other people to access.

    Why do you need to write code? Just use the Data Connection wizard to add the parameter based on the field in your form.
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.