A
Andy
Make the story short, I have a VB.NET client interface calling .NET
webservice, written in VB.NET as well.
I am trying to make the client as thin as possible so I let the
webservice part to handle most of the things.
Currently I have a class called "Product" sitting my webserivce like
the following:
Code:
Imports System.Xml.Serialization
<XmlInclude(GetType(Properties)), XmlInclude(GetType(Product))> Public
Class Product
' Product properties
Public masterQty As Int32
Public cost As Double ' temperary cost, will use config costs to
replace
Public PropertyList As New ArrayList
' ArrayList stores it's component product
Public optionCondition As Int16 ' 1 = OR, 2 = AND
Public componentProduct As New ArrayList
Public Function ProductCost() As Double
Dim myCost As Double
myCost = Me.cost
' Get cost in the product ArrayList
Dim i As Int32
For i = 0 To componentProduct.Count - 1
myCost = myCost + componentProduct.Item(i).ProductCost
Next
Return myCost
End Function
Public Sub AddProduct(ByVal inputProduct As Product)
If inputProduct.GetType Is GetType(Product) Then
componentProduct.Add(inputProduct)
Else
Throw New ArgumentException("inputProduct must be of type
Product.", "inputProduct")
End If
End Sub
Public Sub AddProperty(ByVal inputProperty As Properties)
PropertyList.Add(inputProperty)
End Sub
End Class
As you can see I have 2 methods in the class let me add something call
"Product Property" and "Component Product" into the "Product" object.
And having ArrayList "PropertyList" and "componentProduct" to store
those objects
In my VB.NET Client interface, after I add the webreference, I just
realised I can declare an instance of the WebService's classes object
in my client interface like the following:
Assuming my Web Ref named "ProjectInit"
Code:
Dim myProduct As New ProjectInit.Product
Now here we go the PROBLEM!! When I try to declare a few more
webservice's Product object in my client side interface and try to
call the AddProduct methods in the Product class, it doesn't show in
the Intellsense menu I can't even call the ArrayList's Add method to
add my product object into it.
My original thought is to create and initialize an instance of the
webservice class object, with all it's component properties and
products, then I can just throw this product object to my webservice
and let the webservice to do whatever it wants with it.
Is it that you cannot call a WebService's method in a Class/Type (if
my Client side interface just Web Referenced it)? I wish I just doing
something wrong so it cause the problem. But If it's not the case,
what is the work around?
Thanks in advance.
webservice, written in VB.NET as well.
I am trying to make the client as thin as possible so I let the
webservice part to handle most of the things.
Currently I have a class called "Product" sitting my webserivce like
the following:
Code:
Imports System.Xml.Serialization
<XmlInclude(GetType(Properties)), XmlInclude(GetType(Product))> Public
Class Product
' Product properties
Public masterQty As Int32
Public cost As Double ' temperary cost, will use config costs to
replace
Public PropertyList As New ArrayList
' ArrayList stores it's component product
Public optionCondition As Int16 ' 1 = OR, 2 = AND
Public componentProduct As New ArrayList
Public Function ProductCost() As Double
Dim myCost As Double
myCost = Me.cost
' Get cost in the product ArrayList
Dim i As Int32
For i = 0 To componentProduct.Count - 1
myCost = myCost + componentProduct.Item(i).ProductCost
Next
Return myCost
End Function
Public Sub AddProduct(ByVal inputProduct As Product)
If inputProduct.GetType Is GetType(Product) Then
componentProduct.Add(inputProduct)
Else
Throw New ArgumentException("inputProduct must be of type
Product.", "inputProduct")
End If
End Sub
Public Sub AddProperty(ByVal inputProperty As Properties)
PropertyList.Add(inputProperty)
End Sub
End Class
As you can see I have 2 methods in the class let me add something call
"Product Property" and "Component Product" into the "Product" object.
And having ArrayList "PropertyList" and "componentProduct" to store
those objects
In my VB.NET Client interface, after I add the webreference, I just
realised I can declare an instance of the WebService's classes object
in my client interface like the following:
Assuming my Web Ref named "ProjectInit"
Code:
Dim myProduct As New ProjectInit.Product
Now here we go the PROBLEM!! When I try to declare a few more
webservice's Product object in my client side interface and try to
call the AddProduct methods in the Product class, it doesn't show in
the Intellsense menu I can't even call the ArrayList's Add method to
add my product object into it.
My original thought is to create and initialize an instance of the
webservice class object, with all it's component properties and
products, then I can just throw this product object to my webservice
and let the webservice to do whatever it wants with it.
Is it that you cannot call a WebService's method in a Class/Type (if
my Client side interface just Web Referenced it)? I wish I just doing
something wrong so it cause the problem. But If it's not the case,
what is the work around?
Thanks in advance.