InfoPath Error when submitting to a Web Service - InfoPath Dev
in

InfoPath Dev

InfoPath Error when submitting to a Web Service

Last post 03-20-2007 03:52 PM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-13-2007 12:33 PM

    InfoPath Error when submitting to a Web Service

    Hello All,

    I keep getting an error when I try to submit an InfoPath form to a web service that I created. The Web Service parses the fields from the form and submits data to the database.

    Here's the error I keep getting:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at TestParking.SubmitNewForm(myFields newForm)
    --- End of inner exception stack trace ---

    And here's some of the code for the webservice

    [WebMethod(Description = "Submit a new Vehicle Registration form to the database")]
    public void SubmitNewForm(myFields newForm)
    {
    //Registration Fields
    //User information
    string userFirstName;
    string userLastName;
    string userEmailAddress;
    string userPhone;
    string userAlternatePhone;
    string userJobTitle;
    string userCompany;
    string userType;
    string userBuilding;
    string userFloor;
    string userStartTime;
    string userBadgeNumber;

    //vehicle information
    string carPrimary;
    string carYear;
    string carMake;
    string carModel;
    string carColor;
    string carState;
    string carPlateNumber;
    string carPermitNumber;

    //Parking information
    string internalID; //UserID
    string active; //status - active||inactive
    string assignedParkingLocation; //parking_id
    int assignedParkingSpace; //parking_reserve

    //Assign values to fields
    //user
    userFirstName = Convert.ToString(newForm.employee.firstName);
    userLastName = Convert.ToString(newForm.employee.lastName);
    userEmailAddress = Convert.ToString(newForm.employee.emailAddress);
    userPhone = Convert.ToString(newForm.employee.workPhone);
    userAlternatePhone = Convert.ToString(newForm.employee.alternatePhone);
    userJobTitle = Convert.ToString(newForm.employee.jobTitle);
    userCompany = Convert.ToString(newForm.employee.company);
    userType = Convert.ToString(newForm.employee.type);
    userBuilding = Convert.ToString(newForm.employee.building);
    userFloor = Convert.ToString(newForm.employee.floor);
    userStartTime = Convert.ToString(newForm.employee.startTime);
    userBadgeNumber = Convert.ToString(newForm.employee.badgeNumber);


    //Parking information
    internalID = Convert.ToString(newForm.employee.userID);
    active = Convert.ToString(newForm.employee.status.Value);
    assignedParkingLocation = Convert.ToString(newForm.assignedParking.location);
    assignedParkingSpace = Convert.ToInt32(newForm.assignedParking.space);
  • 03-20-2007 03:52 PM In reply to

    Re: InfoPath Error when submitting to a Web Service

    Hi chowyunli,

    You know we have a webservice that does exactly what you are trying to do generically that is available for free download: http://www.qdabra.com/proddetail.asp?prod=QDBXL1

    If you still want to go with yours though, why don't you just hook up the debugger to the web service and step through the call? To do this, open the project in Visual Studio, and then select Debug -> Attach to Process. The process is different on different operating systems, but on Windows Server 2003 it is w3wp.exe, on XP it is ASP_NET.exe I think.

    Good luck!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
    Filed under:
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.