Submitting Infopath to a .net Web Service


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Submitting Infopath to a .net Web Service

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    13

    Submitting Infopath to a .net Web Service

    I have an infopath form and I am trying to submit the data to a Web Service. Now I created the form and a Web Service but it is not passing the values. Here is what I did....

    First I extracted all the files from the form. I then ran the Visual Studio command prompt and ran this against the myschema.zsd file

    xsd.exe myschem.xsd /classes /l:vb /n:InfoPathFormService

    and this is the result of that

    Option Strict Off
    Option Explicit On

    Imports System.Xml.Serialization

    '
    'This source code was auto-generated by xsd, Version=1.1.4322.2300.
    '
    Namespace InfopathFormService

    '<remarks/>
    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-04-03T13:21:09"), _
    System.Xml.Serialization.XmlRootAttribute([Namespace]:="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-04-03T13:21:09", IsNullable:=false)> _
    Public Class New_User

    '<remarks/>
    Public [New] As String

    '<remarks/>
    Public Change As String

    '<remarks/>
    Public Deletion As String

    '<remarks/>
    Public DateofRequest As String

    '<remarks/>
    Public FirstName As String

    '<remarks/>
    Public MiddleInitial As String

    '<remarks/>
    Public Suffix As String

    '<remarks/>
    Public StreetAddress As String

    '<remarks/>
    Public State As String

    '<remarks/>
    Public Zip As String

    '<remarks/>
    Public HomePhone As String

    '<remarks/>
    Public CellPhone As String

    '<remarks/>
    <System.Xml.Serialization.XmlElementAttribute("AlternateE-MailAddress")> _
    Public AlternateEMailAddress As String

    '<remarks/>
    Public DistributionGroups As String

    '<remarks/>
    Public Branch As String

    '<remarks/>
    Public Department As String

    '<remarks/>
    Public Title As String

    '<remarks/>
    Public JobFunction As String

    '<remarks/>
    Public ManagersName As String

    '<remarks/>
    Public BranchPhoneNumber As String

    '<remarks/>
    Public BranchFAXNumber As String

    '<remarks/>
    Public ExpectedStartDate As String

    '<remarks/>
    Public TerminationDate As String

    '<remarks/>
    Public ManagersPhone As String

    '<remarks/>
    <System.Xml.Serialization.XmlElementAttribute("ManagersE-mail")> _
    Public ManagersEmail As String

    '<remarks/>
    Public NewHireChecklistCompleted As String

    '<remarks/>
    Public ERPAccountingAccess As String

    '<remarks/>
    Public ERPB2BAccess As String

    '<remarks/>
    Public ERPServiceCenterAccess As String

    '<remarks/>
    Public ERPApprovalEmail As String

    '<remarks/>
    Public ApproveReject As String

    '<remarks/>
    Public Comment As Comment

    '<remarks/>
    Public signatures2 As signatures2

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public LastName As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public DesktopPC As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public LaptopPC As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public ThinClient As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public P21 As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public P21Play As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public Outlook As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public PumpApplications As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public Engineering As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public Sales As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public Accounting As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public IMP As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public Operations As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public InformationTechnology As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public P21RoleName As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public OutsideSalesrepNumber As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public B2BEmployee As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public CashDrawer As String

    '<remarks/>
    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public AccesstoOutlook As String

    '<remarks/>
    <System.Xml.Serialization.XmlAnyAttributeAttribute()> _
    Public AnyAttr() As System.Xml.XmlAttribute
    End Class

    '<remarks/>
    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-04-03T13:21:09"), _
    System.Xml.Serialization.XmlRootAttribute([Namespace]:="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-04-03T13:21:09", IsNullable:=false)> _
    Public Class Comment

    '<remarks/>
    <System.Xml.Serialization.XmlTextAttribute(), _
    System.Xml.Serialization.XmlAnyElementAttribute()> _
    Public Any() As System.Xml.XmlNode
    End Class

    '<remarks/>
    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-04-03T13:21:09"), _
    System.Xml.Serialization.XmlRootAttribute([Namespace]:="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-04-03T13:21:09", IsNullable:=false)> _
    Public Class signatures2

    '<remarks/>
    <System.Xml.Serialization.XmlAnyElementAttribute()> _
    Public Any() As System.Xml.XmlElement
    End Class
    End Namespace


    i then have a webmethod that looks like this

    <WebMethod()> Public Function SubmitForm(ByVal myFields As InfopathFormService.New_User) As String
    'I defined Variables here but my message was too long so I excluded them.

    ''New, Change or Delete User
    new_user = myFields.[New]
    edit_user = myFields.Change
    del_user = myFields.Deletion
    requestdate = myFields.DateofRequest


    ''New User information
    l_name = myFields.LastName
    f_name = myFields.FirstName
    initial = myFields.MiddleInitial
    suffix = myFields.Suffix
    address = myFields.StreetAddress
    state = myFields.State
    zip = myFields.Zip
    h_phone = myFields.HomePhone
    c_phone = myFields.CellPhone
    email = myFields.AlternateEMailAddress

    Dim strsql As String
    strsql = " INSERT INTO Blah Blah Blah"

    Try
    conn.Open()
    Dim cmd As SqlCommand = New SqlCommand(strsql, conn)
    cmd.CommandText = strsql
    cmd.ExecuteNonQuery()

    Catch ex As Exception

    End Try
    End Function
    End Class

    Unfortunately every variable ends up being nothing. I am not sure what I did wrong or if there is a better way to accomplish my goal. All thoughts are welcome

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    You may find this article helpful: http://office.microsoft.com/en-us/in...CH100598301033
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. .Net Web Services and Infopath 2003
    By athomas42 in forum .NET
    Replies: 1
    Last Post: 06-06-2007, 03:27 AM
  2. .NET Web Service Issue
    By salsup1s in forum .NET
    Replies: 1
    Last Post: 04-26-2007, 08:48 AM
  3. Using Java 6SE to query a web service
    By (MC3)RaVeN in forum Java
    Replies: 0
    Last Post: 03-02-2007, 09:30 AM
  4. Replies: 5
    Last Post: 01-28-2003, 10:48 AM
  5. web service authentication mechanisms
    By Dan Davis in forum .NET
    Replies: 0
    Last Post: 05-16-2001, 03:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center