|
Listing 2. Here is the .Net code submitting an order to the WebLogic Web service. 'create order data structure and set priority to
medium
Dim order As New OrderInfo order.Priority =
"Medium"
'count number of products with a positive order
quantity
Dim count As Integer
Dim result As String
Dim row As OrderEntryDataset.OrderLineRow
count = 0
For Each row In m_OrderEntryDataset.OrderLine.Rows
If row.Quantity > 0 Then
count += 1
End If
Next
If count > 0 Then
'create order line items based on count and
fill each line
'for C# programmers: in VB.NET
specify the upper
boundary, not the number of elements
order.OrderItems = New OrderLineItems(
count - 1) {}
count = 0
For Each row In
m_OrderEntryDataset.OrderLine.Rows
If row.Quantity > 0 Then
Dim item As New OrderLineItems
item.ProductID = row.ProductID
item.Quantity = row.Quantity
order.OrderItems(count) = item
count += 1
End If
Next
'create web service proxy
Dim orderWS As OrderEntryWebService2
orderWS = New OrderEntryWebService2
'set real URL here
'orderWS.Url = ""
'submit the order and reset the dataset
result = orderWS.createOrder(order)
'reset the UI
m_OrderEntryDataset.RejectChanges()
Else
result = "You must order at least one item!"
End If
MessageBox.Show(result, "Submit Order Result")
|