web service example needed in visual basic
elwin68
Member Posts: 153
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.
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
-
this is the VB version of the code you've posted here:
dim filterArray as New List(Of Customer_Filter) dim nameFilter as New Customer_Field() nameFilter.Field = Customer_Fields.Name nameFilter.Criteria = "C*" filterArray.Add(nameFilter)
0 -
Thank you very much for the translation.
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.0 -
Did you add web reference to your web service?3. In Solution Explorer, right-click the References node in the project and select Add Web Reference.
Note
If you are running Visual Studio 2008, select Add Service Reference.
4. In the Add Web Reference window, type the URL that you used when checking the WSDL, for example, http://localhost:7047/DynamicsNAV/WS/Services and then click Go.
Note
In Visual Studio 2008, click the Advanced button, click the Add Web Reference button, and then type the URL, and then click Go.
5. When the Customer service is displayed, click View Service, and then click Add Reference. Rename localhost to WebService.0 -
Yes, In have added the web reference. When entering the link in internet explorer the service is shown.
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.0 -
Finally I found it myself:
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 324 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions