Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Consuming a WebService in ClassLibrary or Winform
Message
De
26/03/2008 20:19:16
 
 
À
26/03/2008 17:53:39
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01305448
Message ID:
01306041
Vues:
9
This message has been marked as a message which has helped to the initial question of the thread.
Glenn,

I think I am not too fond of the new 3.5 technique for WebService. By using the object explorer I was able to "noodle" out the obtuse object model.

I don't think you *have* to use it, but perhaps since this is a third-party Web Service, maybe you didn't have a choice? Was it not an .asmx web service?

~~Bonnie




>Thanks for your help Bonnie,
>
>I made a working test program which will allow me to go forward. I think I am not too fond of the new 3.5 technique for WebService. By using the object explorer I was able to "noodle" out the obtuse object model.
>
>Thanks
>
>Glenn
>
>>>Yes Bonnie, it does look strange. In VS2005 there was an option to add a Web Reference but now in VS2008 we add a Service Reference in VB.Net. I think my confusion stems from the fact that I am using a third party WebService which is poorly documented outside of the WSDL.
>>
>>I'm just "playing" with VS2008 now in the process of converting our "sample app" that we use for training new developers ... but I still see "Add Web Reference", I don't see anything about adding a "Service Reference". This is the C# IDE though, so at first I thought that maybe the VB IDE is different ...
>>
>>But, in doing a Google, I finally see what's going on. The "Add Service Reference" is for adding WCF references (which is the new type of Web Service). And, it's only shown if your project is targeting 3.0 or 3.5 (that's why I hadn't seen it yet, I hadn't gotten to that point in my "playing").
>>
>>So, then, the next question is: is the web service you're trying to add WCF or ASMX? Clicking on the Advanced button in the "Service Reference Settings" dialog allows you to add the "old style" web references to .asmx.
>>
>>If it's WCF, then I won't be able to help you at all. Michel has added a WCF category here, so maybe it's best to post your question there. I haven't even started looking at WCF yet. =0(
>>
>>
>>~~Bonnie
>>
>>
>>
>>
>>>
>>>Thanks
>>>
>>>]Glenn
>>>
>>>>This stuff looks rather strange Glenn. How did you add the reference? It should have been simply "Add Web Reference" to your project(unless the VB IDE differs significantly from the C# IDE).
>>>>
>>>>In addition to the WSDL that gets generated, there should also be a reference.vb file which is basically the class that you instantiate to use the WS. The class will have the namespace containing the name you used when you added it. So, for example, if I add a web reference in my MainControl project and I call it PersonnelWS. The reference.cs (.vb in your case) that gets generated will have a namespace of MyCompany.MyApp.WinUI.MainControl.PersonnelWS, and the partial class that gets generated will be the same class name as the web service class, Personnel in my case.
>>>>
>>>>In C#, all I would do to instantiate this WS is this:
>>>>
>>>>
>>>>// Declaration
>>>>PersonnelWS.Personnel oWS;
>>>>
>>>>// Instantiation ... usually done in the constructor
>>>>this.oWS = new PersonnelWS.Personnel();  // you would obviously use me.oWS
>>>>
>>>>
>>>>Actually, we also use a Factory class for instantiating our web services, but the concept is the similar.
>>>>
>>>>Then you just call the methods of the class, like any other methods on classes. Intellisense will show you the methods available.
>>>>
>>>>Does this help?
>>>>
>>>>~~Bonnie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>I need to access and execute methods on a web service from a VB.Net class in VS2008. So far I have added a Service Reference to the Project for the WebService (WSDL Reference) and it properly describes the Services and Operations. My problem is now I have no idea as to how to Use it. For instance this WS has a service called ContentCafeHTTPGet with three available operations
  1. Single
  2. XMLPost
  3. XMLString

How would I instanciate this service so that I could execute the Single operation?
>>>>>
>>>>>Thanks
>>>>>
>>>>>Glenn
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform