As the example used in the “Placing an Order” section showed, many products that you order are not completed immediately. This fact requires that you check back with Lenders Advantage to determine what products have been completed.
Here are some useful suggestions for implementing your order checking routine:
· Your order queue will have entries whenever the status of one of your order’s products changes. For example, when a product gets completed, it will be placed in the queue. However, if a product is cancelled, put on hold, etc. it will also be placed in the queue so that you know what is happening at all times.
· While you can check your queue as often as you like, we recommend 30- or 60-minute intervals. Anything less than 30 minutes needlessly eats bandwidth.
To get a list of what is currently in your order queue, all you have to do is make a single SOAP function call: GetOrderQueue. Upon successful completion of this function call, you will receive a list of all documents currently available in your queue.
A Visual Basic® sample for checking your order queue would be as follows:
‘ Function will return the contents of you queue
Function CheckQueue() As String
Dim oSOAP As New MSSOAPLib.SoapClient
Dim sResponse As String
oSOAP.ClientProperty(“ServerHTTPRequest”) = True
oSOAP.mssoapinit
“http://soap.elsonline.net/webservice/ElsWebOrder.asmx?WSDL”
sResponse = oSOAP.GetOrderQueue(“yourusername”,
“yourpassword”)
‘ Check for SOAP error
If oSOAP.faultstring <> “” Then
MsgBox “ERROR: “ & oSOAP.faultstring
CheckQueue = “”
Exit Function
End If
CheckQueue = sResponse
End Function
For example purposes, let’s now assume that the Property Report from the sample above has now been completed. The response given by GetOrderQueue would look like this:
<?xml version="1.0" encoding="utf-8"?>
<ElsResponse version="ELS_1.0">
<ElsOrderList>
<ElsOrder serviceCode=”06”
sequenceNum=”0”>
<ConfirmationNumber>11110000</ConfirmationNumber>
<ChangeType>S</ChangeType>
<ChangeTime>7/15/2002 9:03:53 PM</ChangeTime>
</ElsOrder>
</ElsOrderList>
<ElsStatus>
<Message>OK</Message>
<Number>0</Number>
</ElsStatus>
</ElsResponse>
Now that you have a list of orders that are in your queue, you need to decide what to do with each order. Generally, it is best to loop through the entire list an make decisions based on the change type, which will be one of the following three values:
S – Status changed. The product’s (denoted in the “serviceCode” attribute) status has changed.
N – Note added. A note was added to the order.
O – Order placed. The only time you will see this status is if there was a communication failure while you were placing an order and you did not receive an ElsResponse.
IMPORTANT: make sure you check the SOAP error as well as the ElsStatus element (using the IsError function, as outlined under “Placing an Order”) to determine whether or not an error occurred.
To view an individual order whose confirmation number is listed in your order queue, you use the GetOrder SOAP function.
IMPORTANT: an order is not removed from your order queue until you call GetOrder. Therefore, you can call GetOrderQueue as often as you like, but you will keep getting the same orders over and over unless you call GetOrder to view them.
Here is a Visual Basic® sample for using GetOrder to view each order in the queue shown in the example above:
‘ OrderQueue is XML string retrieved from call to GetOrderQueue
Sub GetOrders(OrderQueue As String)
Dim xmlDoc As New MSXML.DOMDocument
Dim orderList As IXMLDomNodeList
Dim order As IXMLDOMNode
Dim confNo As Long
Dim orderXML As String
xmlDoc.Load OrderQueue
Set orderList = xmlDoc.selectNodes(“//ElsOrder”)
If orderList Is Nothing Then
MsgBox “No orders in queue”
Exit Sub
End If
Dim oSOAP As New MSSOAPLib.SoapClient
oSOAP.ClientProperty(“ServerHTTPRequest”) = True
oSOAP.mssoapinit
“http://soap.elsonline.net/webservice/ElsWebOrder.asmx?WSDL”
For Each order In orderList
confNo =
CLng(order.selectSingleNode(“ConfirmationNumber”))
orderXML = oSOAP.GetOrder(“yourusername”,
“yourpassword”, confNo)
‘ orderXML NOW CONTAINS ElsResponse for the
order identified by ConfNo
‘ parse it as you require (making to sure to
check status)
‘ all references to this order have now been
removed from your queue
Next
End Sub
You can "modify" an order by adding product(s) to it and specifying additional information. For instance, assume that when you first placed the order, you ordered an online valuation product and only supplied the street address and zip code. Suppose you now want to add a Property Report to the order. Since the Property Report requires a complete address as well as the name of at least one borrower, you can supply this information in the ElsRequest.
The process for modifying an existing order is identical to placing a new order (see “Placing an Order”). The only difference is that the ConfirmationNumber element MUST be included in the ElsRequest document so that the system knows which order you intend to modify.
This document modifies order # 11110000 by including a phone number for the primary contact and adding a Freddie Mac HVE product.
<ElsRequest version="ELS_1.0">
<ConfirmationNumber>11110000</ConfirmationNumber> <-- include
this to identify existing order -->
<Account>
<UserName>websvc</UserName>
<Contact>testing</Contact>
<ReferenceNumber><![CDATA[PR for 123
Main]]>
</ReferenceNumber>
<Branch>2</Branch>
</Account>
<Address>
<Street>123 Main</Street>
<City>Cleveland</City>
<State>OH</State>
<Zip>44111</Zip>
</Address>
<Borrower type="primary">
<FirstName>John</FirstName>
<LastName>Smith</LastName>
</Borrower>
<ElsProduct serviceCode="AH"/> <!-- Add a Freddie
Mac HVE -->
</ElsRequest>
The AddOrderNote SOAP function provides a mechanism for sending a message to the Client Serviceorder service center.
The following example shows how you can add a note to an order using Visual Basic®:
Public Function AddOrderNote(UserName As String, Password As
String, _
ConfirmationNumber As Long, Message As String) As String
Dim oSoapClient As New MSSOAPLib.SoapClient
oSoapClient.mssoapinit(“http://soap.elsonline.net/ElsWebOrder.asmx?WSDL”)
oSoapClient.ClientProperty(“ServerHTTPRequest”) = True ‘use
“robust” communication
AddOrderNote = oSoapClient.AddOrderNote(Username, Password,
ConfirmationNo, Message, “W”)
Set oSoapClient = Nothing
End Function
You will receive an XML document conforming to the Response DTD that simply indicates whether the function was successful.
The ListProducts SOAP function allows you to retrieve a list of the products that you are set up to order through the Advantage XML Web Service. This list is maintained by Lenders Advantage and may be changed by contacting your sales representative.
The following example shows how you can retrieve the list of products using Visual Basic®:
Public Function ListProducts(UserName As String, Password As
String) As String
Dim oSoapClient As New MSSOAPLib.SoapClient
oSoapClient.mssoapinit(“http://soap.elsonline.net/ElsWebOrder.asmx?WSDL”)
oSoapClient.ClientProperty(“ServerHTTPRequest”) = True ‘use
“robust” communication
ListProducts = oSoapClient.ListProducts(sUsername, sPassword,
ConfirmationNo)
Set oSoapClient = Nothing
End Function
The XML you will receive from conforms to the
Response Data DTD. Here is an example of XML returned by ListProducts:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://soap.elsonleine.net">
<?xml version="1.0" encoding="utf-8"?>
<ElsResponse version="ELS_1.0">
<ElsProductData>
<ElsProductDescription>
<serviceCode>ZD </serviceCode>
<description>Fact III-demo</description>
<helpString>Includes Online Flood, Valuation
&Title</helpString>
<category>Combination Products</category>
<requiresAll>Y</requiresAll>
</ElsProductDescription>
<ElsProductDescription>
<serviceCode>AH </serviceCode>
<description>Freddie Mac HVE</description>
<helpString>Online Valuation from Freddie Mac</helpString>
<category>Appraisal Products</category>
<requiresAll>N</requiresAll>
</ElsProductDescription>
</ElsProductData>
<ElsStatus>
<Message>OK</Message>
</ElsStatus>
</ElsResponse>