Hello,
I'm new in the world of web services. I tried to get the example 'Walkthrough: Registering and Consuming a Page Web Service' from the NAV 2009 Help working.
The problem is i'm not so good in the language C. I tried to convert the example to vb but that didn't success.
I want to search for all customer within a filter and get them to vb.
The following lines must do the trick in C:
// Create filter for searching for customers
List<Customer_Filter> filterArray = new List<Customer_Filter>();
Customer_Filter nameFilter = new Customer_Filter();
nameFilter.Field = Customer_Fields.Name;
nameFilter.Criteria = "C*";
filterArray.Add(nameFilter);
Can anyone help me with an example in vb which search for the customers and get them to vb.
Thanks in advance.
0
Answers
I think something is missing in the example of the NAV help.
The following errors occure in Visual Studio 2008:
- Type 'Customer_Filter' is not defined
- Name 'Customer_Fields' is not declared
Which lines are missing in the example so the example of the web service works?
Thanks in advance.
I have almost done the thing with the following example:
Dim ws As New Mywebservice.Customer_Binding
ws.UseDefaultCredentials = True
ws.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS_International_Ltd/Page/Customer"
Dim Cust(100) As Mywebservice.Customer
Dim wsFields As New Mywebservice.Customer_Fields
Dim wsfilter(1) As Mywebservice.Customer_Filter
wsfilter(1).Field = wsFields.Name
wsfilter(1).Criteria = "J*"
Cust = ws.ReadMultiple(wsfilter, "", 0)
For Counter = LBound(Cust) To UBound(Cust)
Me.ListBox1.Items.Add(Counter & ": " + Cust(Counter).No & "-> " & Cust(Counter).Name)
Next Counter
When leaving the 2 lines to set the filter (wsfilter(1).....), all customer appeare in the listbox.
The only thing I want to do next is the set a filter on the field name.
Does anyone know the syntax for that?
Thanks in advance.
Dim ws As New Mywebservice.Customer_Binding
ws.UseDefaultCredentials = True
ws.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS_International_Ltd/Page/Customer"
Dim Cust(100) As Mywebservice.Customer
Dim wsFilterArray As New List(Of Mywebservice.Klantje_Filter)
Dim wsFilter As New Mywebservice.Klantje_Filter()
wsFilter.Field = wsFields.Name
wsFilter.Criteria = "C*"
wsFilterArray.Add(wsFilter)
Cust = ws.ReadMultiple(wsFilterArray.ToArray, "", 0)
For Counter = LBound(Cust) To UBound(Cust)
Me.ListBox1.Items.Add(Counter & ": " + Cust(Counter).No & "-> " & Cust(Counter).Name)
Next Counter
Thanks everyone for thinking with me.