:: Web Services :: XWeb1003 :: Implementation Guides ::
|
How-To Display a Mortgage Loan Application
|
|
The procedures in this implementation guide require that you have some knowledge of XML and
ASP.NET web development with the Microsoft Visual Basic.NET development tool.
***Note: This implementation guide applies to Version 1 of the Web Service.
The steps in this "how-to" implementation guide are:
To download the source code for this "how-to" implementation guide, as well as for additional
hints and tips, please read our Final Notes.
|
 |
Add a "Web Reference" to the XWeb1003 Web Service
-
In your web project, add a Web Reference to the XWeb1003 Web Service. Here are 2 ways you can
accomplish this:
- Browse the Solution Explorer, right click on References and select
Add Web Reference... from the drop down menu.
- From the File Menu, select Project - Add Web Reference....
The Add Web Reference pop-up window will open. In the URL textbox, enter the following URI:
https://ws.xwebservices.com/XWeb1003/XWeb1003.asmx?wsdl
- Hit the Enter key or click the Go button located to the right of the URL textbox.
- Change the Web reference name to XWeb1003 for easier reference.
- Click the Add Reference button to complete this step.
|
 |
Add a "Web Form" to the Web Application
|
 |
Write code in the "Codebehind" of the web form to retrieve the Mortgage Loan Application record by consuming the XWeb1003 Web Service
Based on the documentation for the XWeb1003 Web Service, in order to successfully consume the Web Service, we will
need to authenticate first using SOAP Headers. Here's how:
- Open the "Codebehind" of the application.aspx web form we added to the web project in the
previous step.
Since the Web Service requires SOAP Headers for authentication purposes, we must first create a new
instance of the class representing the SOAP Header and then populate the SOAP Header values:
Dim objAuth As New XWeb1003.AuthHeader
objAuth.LoginName = "<my_login_name>"
objAuth.Password = "<my_password>"
NOTE***: Instead of hard-coding the LoginName and Password values, you may want to
dynamically read them from the web.config file (LOGIN_NAME and PASSWORD must be added to the
<AppSettings>
section of the web.config file):
objAuth.LoginName = System.Configuration.ConfigurationSettings.AppSettings("LOGIN_NAME")
objAuth.Password = System.Configuration.ConfigurationSettings.AppSettings("PASSWORD")
Next, we need to create a new instance of the proxy class and assign the SOAP Header object to the member
variable of the proxy class representing the SOAP Header:
Dim objApplication As New XWeb1003.XWeb1003
objApplication.AuthHeaderValue = objAuth
We are now ready to call the method on the proxy class that communicates with the Web Service method and returns the
Mortgage Loan Application record we want displayed on the web page.
Dim strApplicationXML As String = objApplication.LoadApplication(Request.QueryString("aid"))
|
 |
Implement ASP.NET Labels to display the Mortgage Loan Application's details
In the Codebehind:
Declare as many labels as you need to display the Mortgage Loan Application's details (for this "how-to" guide, we will be
only display 3):
Protected lblPurpose, lblAmount, lblDateCreated As System.Web.UI.WebControls.Label
Load the XML string we previously stored in the strApplicationXML variable into an
XMLDocument:
Dim objDOM As New System.Xml.XmlDocument
objDOM.LoadXml(strApplicationXML)
Set the labels' Text property to the corresponding Element or Attribute value:
lblPurpose.Text = objDOM.DocumentElement.SelectSingleNode("Purpose/Type_Description").InnerText
lblAmount.Text = objDOM.DocumentElement.SelectSingleNode("Amount").InnerText
lblDateCreated.Text = objDOM.DocumentElement.Attributes.ItemOf("Date_Created").Value
In the HTML Editor, we simply define the 3 ASP.NET labels. Here is the code:
<asp:Label ID="lblPurpose" Runat="server" />
<asp:Label ID="lblAmount" Runat="server" />
<asp:Label ID="lblDateCreated" Runat="server" />
|
 |
Final Notes
The source code for this "how-to" implementation guide can be downloaded by clicking the link
below (zip file, contains the source code for all "how-to" implementation guides for the
XWeb1003 Web Service)
XWeb1003Client.zip
If you do not want to display all the details in individual labels, you can write a recursive function that
will display the mortgage loan application's details in a "tree" format.
It's always good practice to implement a Try...Catch... error handling technique to handle some or all
possible errors that may occur while the code is executing. We strongly recommend that you implement such
a technique.
|