2

I am trying to re-create the Rate code sample from the current UPS Developer's Kit on .Net 5. The code sample is based on .NET Framework 4.5.

I imported the Rates_Pkg_Gnd\RatingPACKAGE\PACKAGEWebServices\SCHEMA-WSDLs\RateWS.wsdl into a completely new .NET 5 Console project as a WCF Web Service (Visual Studio 2019).

I then copied the code from the code sample exactly line-by-line. Visual Studio added a reference to the imported Web Service. However, the very first line of code is not found in the new Web Service:

RateService rate = new RateService();

I contacted UPS Developer Support but "they do not help with coding". Has RateService been renamed or Is there a replacement in the new schema?

Randy
  • 1,137
  • 16
  • 49
  • Please, check this one: https://stackoverflow.com/questions/38363503/ups-api-net-add-web-reference. Probably, it is your case. – PIoneer_2 Nov 29 '21 at 09:38

1 Answers1

1

If you are using WCF then it is called RatePortTypeClient. Or if you choose to use a Web Reference it is called RateService. You should also add a using [your reference name] to your code. Picture below shows ServiceReference1 - as a WCF. And RateWebReference as a Web Reference.

Visual Studio Solution

Peter Csala
  • 17,736
  • 16
  • 35
  • 75
duerzd696
  • 304
  • 1
  • 8
  • Thank you for your answer. I have the latest Rates_Pkg_Gnd (10/11/2021) from UPS. I have a using statement for my reference name. RateService still is not found. I am using a Web Reference. – Randy Dec 30 '21 at 15:20
  • 1
    is the reference listed under connected services or a folder called web reference? – duerzd696 Dec 30 '21 at 16:24
  • This whole time I had thought I was adding a Web Reference, but I now know I was adding WCF. So, in VS2019 how do I add a Web Reference? – Randy Dec 30 '21 at 17:10
  • Hover mouse over references - click add service reference- a window will appear, then click advanced, bottom of new window you'll see add web reference. Put your wsdl in c:\ root to make it easy to find. You'll need the path to it. – duerzd696 Dec 30 '21 at 17:38
  • I cannot see any advanced button – Randy Dec 30 '21 at 19:10
  • 1
    If you are using net core console app - im afraid you will have to use wcf. Right-click project then add - service reference. At bottom you will see wcf - click it and provide your path to wsdl. I don't think you can add a web reference in net core. This will add a connected service to your project. Or you can use .net 4.5. – duerzd696 Dec 30 '21 at 19:53