Using the API package here: https://www.ups.com/gec/techdocs/pdf/Rates_Pkg_Gnd.zip
Added the reference to RateWS.wsdl by:
-Right click on website project -> Add Service Reference
-In the address field input: file://C:\Users\MyUser\Desktop\UPS API\RatingPACKAGE\PACKAGEWebServices\SCHEMA-WSDLs\RateWS.wsdl
Visual Studio added several reference files:
Using the Sample code provided in the API package, I copied the test code to my project.
The problem: The "RateService" class is not defined. Missing reference?
It appears the web reference was not added properly. The RateService class is unknown. Thanks for your help.
I think the problem is that you are trying to add a Service Reference instead of a Web Reference:
To add a Web reference to a project In Solution Explorer, right-click the name of the project that you want to add > the service to, and then click Add Service Reference. The Add Service Reference dialog box appears. In the Add Service Reference dialog box, click the Advanced button. The Service Reference Settings dialog box appears. In the Service Reference Settings dialog box, click Add Web Reference. The Add Web Reference dialog box appears. I n the URL box, enter the URL of the Web service to use. If you do not know the URL, use the links in the browse pane to locate the Web service you want.
UPS documentation is often out of sync with the code sample. You should modify your code like this:
FreightRatePortTypeClient Client = new FreightRatePortTypeClient();
....
....
FreightRateResponse resp = Client.ProcessFreightRate(upss, <your freight rate request object>);
This worked for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With