
|

|
:: Web Services :: XWeb1003 :: Implementation Guides ::
|
How-To Display a List of Mortgage Loan Applications
|
|
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 list of Mortgage Loan Applications 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 applications.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 objApplications As New XWeb1003.XWeb1003
objApplications.AuthHeaderValue = objAuth
We are now ready to call the method on the proxy class that communicates with the Web Service method and returns the
list of Mortgage Loan Application records we want displayed on the web page.
Dim strApplicationsXML As String = objApplications.LoadApplications()
|
 |
Implement a Repeater to display the list of Mortgage Loan Applications
In the Codebehind, we need to declare a Repeater and then bind the XML string we retrieved from the SOAP
method, in the form of an XMLNodeList, to the Repeater's DataSource. Here's how:
Declare the Repeater in the Codebehind:
Protected rptApplications As System.Web.UI.WebControls.Repeater
Load the XML string from the previous step into an XMLDocument:
Dim objDOM As New System.Xml.XmlDocument
objDOM.LoadXml(strApplicationsXML)
Bind the XMLDocument's DocumentElement to the Repeater's DataSource and call the DataBind method:
rptApplications.DataSource = objDOM.DocumentElement
rptApplications.DataBind()
In the HTML Editor, we format the Repeater to our liking to display the list of Mortgage Loan Applications. We will
display the Application ID, Purpose, Amount, Property Street, Rep Identifier and the date the application was started
(Date_Created attribute's value). The Application ID will be hyperlinked so when clicked, the website visitor would navigate
to see the entire Mortgage Loan Application record. Here are the necessary steps:
Add the Repeater inside the body of your HTML page:
<asp:Repeater ID="rptApplications" Runat="server">
<ItemTemplate>
</ItemTemplate>
</asp:Repeater>
Inside the Repeater's ItemTemplate, first we display the Application ID of the Mortgage Loan Application and create
a hyperlink using the same Application ID as the querystring parameter:
<b>Application ID:
<a
href="application.aspx?aid=<%# Container.DataItem.Attributes.ItemOf("Application_ID").Value %>">
<%# Container.DataItem.Attributes.ItemOf("Application_ID").Value %>
</a></b>
Next, we display the Purpose, Amount, Property Street and the Rep Identifier of the Mortgage Loan Application. Since the Repeater is
looping through XML Nodes (<Application>),
we need to bind to the individual elements, then get their value:
Purpose:
<%# Container.DataItem.SelectSingleNode("Purpose/Type_Description").InnerText %>
Amount:
<%# Container.DataItem.SelectSingleNode("Amount").InnerText %>
Property Street:
<%# Container.DataItem.SelectSingleNode("Property/Address_1").InnerText %>
Representative:
<%# Container.DataItem.SelectSingleNode("Rep_Identifier").InnerText %>
Finally, we display the date the Mortgage Loan Application was started.
Date Started:
<%# Container.DataItem.Attributes.ItemOf("Date_Created").Value %>
|
 |
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
The LoadApplicationsPaged SOAP Method allows for pagination of the records - this comes in handy
when dealing with numerous Mortgage Loan Applications.
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.
|
|

|

|
|