What generates a WebServiceRef Reference.cs file?

15,058

This is an example the Command Line Utility used by visual studio to generate the web service manually IF you have the WSDL (or XSD) file in a local folder. (WSDL is the Web Service Definition File)

This is in a batch file in my case... and also generates a VB file, but is easy to switch to C# I'm assuming with the last command line argument.

cd C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
 wsdl.exe "c:\development\WebServiceClients\CORE_Webservice_Interface_WS.wsdl" /fields /n:Telus /out:"c:\Development\output\WebServiceClients\referencefile.vb" /l:VB

WSDL.EXE is the core of this... below are the options...

c:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin>wsdl /? Microsoft (R) Web Services Description Language Utility [Microsoft (R) .NET Framework, Version 2.0.50727.42] Copyright (C) Microsoft Corporation. All rights reserved.

wsdl.exe - Utility to generate code for xml web service clients and xml web services using ASP.NET from WSDL contract files, XSD schemas and .discomap discovery documents. This tool can be used in conjunction with disco.exe.

wsdl.exe ...

  • OPTIONS -

- A url or path to a WSDL contract, an XSD schema or .discomap document.

/nologo Suppresses the banner.

/language: The language to use for the generated proxy class. Choose from 'CS', 'VB', 'JS', 'VJS', 'CPP' or provide a fully-qualified name for a class implementing System.CodeDom.Compiler.CodeDomProvider. The default language is 'CS' (CSharp). Short form is '/l:'.

/sharetypes Turns on type sharing feature. This feature creates one code file with a single type definition for identical types shared between different services (namespace, name and wire signature must be identical). Reference the services with http:// URLs as command-line parameters or create a discomap document for local files.

/verbose Displays extra information when the /sharetypes switch is specified. Short form is '/v'.

/fields Generate fields instead of properties. Short form is '/f'.

/order Generate explicit order identifiers on particle members.

/enableDataBinding Implement INotifyPropertyChanged interface on all generated types to enable data binding. Short form is '/edb'.

/namespace: The namespace for the generated proxy or template. The default namespace is the global namespace. Short form is '/n:'.

/out: The filename or directory path for the generated proxy code. The default filename is derived from the service name. Short form is '/o:'.

/protocol: Override the default protocol to implement. Choose from 'SOAP', 'SOAP12', 'HttpGet', 'HttpPost'.

/username: /password: /domain: The credentials to use when connecting to a server that requires authentication. Short forms are '/u:', '/p:' and '/d:'.

/proxy: The url of the proxy server to use for http requests. The default is to use the system proxy setting.

/proxyusername: /proxypassword: /proxydomain: The credentials to use when the connecting to a proxy server that requires authentication. Short forms are '/pu:', '/pp:' and '/pd:'.

/appsettingurlkey: The configuration key to use in the code generation to read the default value for the Url property. The default is to not read from the config file. Short form is '/urlkey:'.

/appsettingbaseurl: The base url to use when calculating the url fragment. The appsettingurlkey option must also be specified. The url fragment is the result of calculating the relative url from the appsettingbaseurl to the url in the WSDL document. Short form is '/baseurl:'.

/parsableerrors Print errors in a format similar to those reported by compilers.

  • ADVANCED -

/server Server switch has been deprecated. Please use /serverInterface instead. Generate an abstract class for an xml web service implementation using ASP.NET based on the contracts. The default is to generate client proxy classes.

/serverInterface Generates interfaces for server-side implementation of an ASP.Net Web Service. An interface is generated for each binding in the wsdl document(s). The wsdl alone implements the wsdl contract (classes that implement the interface should not include either of the following on the class methods: Web Service attributes or Serialization attributes that change the wsdl contract). Short form is '/si'.

/parameters: Read command-line options from the specified xml file. This allows you to specify options not available from command line such as choosing which type of asynchronous programming model is generated. For details, please see the tool documentation. Short form is '/par:'.

Share:
15,058

Related videos on Youtube

starr749
Author by

starr749

Updated on September 20, 2022

Comments

  • starr749
    starr749 over 1 year

    Working with inherited code that reads data from one database (Visual Fox Pro) and stores it in SQL server. These are separate systems and use a WebService to send XML containing data from VFP.

    A field has been added to both databases, and data has been seeded in the VFP database, but we are having problems with the WebService that is meant to sync the data. The WebService seems to be correctly generating and sending XML (with the new field and data) however it appears that the models that are meant to handle it on the .NET application are not being generated correctly and do nothing with this new field.

    While viewing the object browser there is an 'OnlineAudienceWebServiceRef' within that, there is an OnlineAudienceDAL.OnlineAudienceFoxProRow which appears to contain a description of columns of the model. We are trying to add a new column to this Object (to receive the new data) but it appears auto-generated.

    My question is, fundamentally, what is happening when Visual Studio is linked to a WebService? What files are generated, and how are they generated?

    Given the web service correctly sends the new data, I was expecting Refs to be updated upon clicking 'Update Web Reference' from the solution explorer, but apparently that is not the case, and I would like know know what is going on.

    There is an 'OnlineAudienceDAL.xsd' where we have added the new column, but we do not see that impacting the Object that is used to read the data.

    According to App.config the app is using .NET v4, we are using Visual Studio 2010.

    I am not familiar with .NET and the many things that are going on here, and would like to be pointed in a good direction. Sorry if this is confusing, please let me know what information I might be omitting and if anything is unclear.

    Thank you for any help.