Invoking MfSvcUtil from the Command Line

This overview describes how to invoke MfsvcUtil.exe from the command line.

Running MfSvcUtil

Location

The MfSvcUtil tool can be found in the Tools subdirectory of your .NET Micro Framework installation. For example,

C:\Program Files\Microsoft .NET Micro Framework\v2.0.3036\Tools

Usage

To invoke MfSvcUtil from the command prompt, use the following form:

MfSvcUtil <input file> [/V] [/P:[Microframework|Win32]] [/C:[ContractFilename]]

Command-line Arguments

ArgumentDescription
input fileThe path of the WSDL file that specifies the operations the service exposes. This file should have the .wsdl extension.
/VVerbose option, to display extended output.
/P:[Microframework|Win32]Specifies the target platform.
/C:[ContractFilename]Specifies the name of the file that contains the data serialization classes. If this option is not specified, a default filename based on the name of the WSDL input file is assigned. For instance, if the WSDL input file is named SimpleService.wsdl, the serializer file will be named SimpleService.cs if no
/C
option is provided.

Examples

MfSvcUtil.exe SimpleService.wsdl
MfSvcUtil.exe SimpleService.wsdl /V /P:Microframework
MfSvcUtil.exe SimpleService.wsdl /V /C:SimpleServiceContract.cs

Outputs

MfSvcUtil generates three files from the WSDL:

  1. A contract class that defines data types for the client requests and server responses, in which data types are serialized to XML.
  2. A client proxy that derives from DpwsClient
  3. A hosted service that derives from DpwsHostedService

Defining a WSDL

Within your WSDL, elements for each type of message should be defined.

The following example is the WSDL definition of messages for seding a pair of values to a service and receiving a sum in response
        
        
        

        <xs:element name="TwoWayRequest" type="tns:TwoWayType" />
        <xs:complexType name="TwoWayType">
          <xs:sequence>
            <xs:element name="X" type="xs:int" />
            <xs:element name="Y" type="xs:int" />
            <xs:any minOccurs="0" maxOccurs="unbounded"
                namespace="##other" processContents="lax" />
          </xs:sequence>
          <xs:anyAttribute namespace="##other" processContents="lax" />
        </xs:complexType>
        
        <xs:element name="TwoWayResponse" type="tns:TwoWayResponseType" />
        <xs:complexType name="TwoWayResponseType">
          <xs:sequence>
            <xs:element name="Sum" type="xs:int" />
            <xs:any minOccurs="0" maxOccurs="unbounded"
                namespace="##other" processContents="lax" />
          </xs:sequence>
          <xs:anyAttribute namespace="##other" processContents="lax" />
        </xs:complexType>
      
Show: