locked
Using a WSDL Interface? RRS feed

  • Question

  • User-195907812 posted

    I'm still new to web services but I've had some success and I've mainly been using classes, which is pretty easy as intellisense tells me what classes/properties are availiable.

    Looking through the wsdl file, the next lot of classes/properties seem to be stored within an interface? I've never used these before, so can anyone advise how I would access these classes/properties via my code?

    Previously, I was using the following approach:

    myService.getCustomer rootRequest = new myService.getCustomer();
    myService.getCust myRequest = rootRequest.getCustByName = new myService.getCust();
    
    rootRequest.getCustomer.CustName = "Joe Bloggs";

    Hope this makes sense to someone!

    Thursday, April 25, 2013 5:37 AM

Answers

  • User220959680 posted

    From the description it is evident that it is a 'SOAP'(Simple Object Access Protocol) service.

    when the service refefence is added to the application (client), visual studio generates proxy class. That is intermediate class between the service and the client.

    //this is the service proxy
    myServiceClient client = new myServiceClient();
    

    proxy class exposes all service methods and properties. It is an interface where as the service implementation class inherits and implements the interface. 

    //Create an instance of service client class
    ServiceContractClient client = new ServiceContractClient();
    
    client.Open();
    
    //Create an instance of Log class and set properties
    //Log instance is from the service
    Log log = new Log();
    log.Title = "OData service exist?";
    log.Message = "Unit testing with Logger services";
    log.MachineName = "DAPC113";
    




    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 25, 2013 10:31 AM