سؤال

I have a C# ASP.NET that site I am trying to add UPS quoting to. I used the code from the sample and have imported the included WSDL, all of the objects map out properly to the wsdl except the RateService class.

This is the code sample and WSDL that I am working from.

This is the code snippet that has an error:

RateService rate = new RateService();
RateRequest rateRequest = new RateRequest();
UPSSecurity upss = new UPSSecurity();

The compile error is that RateService is not found.

I am pretty sure the WSDL is importing because the rest of the classes compile just fine. Did UPS change their API since the sample? Anyone have any ideas?

هل كانت مفيدة؟

المحلول

Your WSDL file has this block:

<wsdl:service name="RateService">
    <wsdl:port name="RatePort" binding="tns:RateBinding">
        <!-- Production URL -->
            <!-- <soap:address location="https://onlinetools.ups.com/webservices/Rate"/> -->
            <!-- CIE (Customer Integration Environment) URL -->
            <soap:address location="https://wwwcie.ups.com/webservices/Rate"/>
    </wsdl:port>
</wsdl:service>

It looks like the RateService serice is defined. Are you sure it imported correctly?

The sample code (in your zip) also shows the generated web reference - it has a RateService class.

To add this reference to your project, go to Add Service Reference, select Advanced on the botton of the dialog and then select Add Web Reference on the bottom of the second dialog. Enter the URL to the WSDL file and then add the reference.

Make sure you add the correct using statements to your code files to use the types from the WSDL.

(This is both for VS 2008 and VS 2010.)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top