We want to create a NETMF web service that lives on a device.
We have read the MSDN Implementing Web Services on Your Devices. It explains Generating Service Model Code Using MfSvcUtil, which assumes that we already have a WSDL file.
How do we generate the WSDL file in the first place?
Answer
Create a NETMF service in C# and generate the WSDL from it.
Steps
First, install NEFMF with DPWS. We used NETMF 4.3 with DPWS from NETMF on Codeplex. This might also work with NETMF 4.4 or later from GitHub.
Second, add
C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Toolsto your PATH. This is a convenient way to access theMFSvcUtil.Third, create a new NETMF project with a service. Here is a very simple one. You will need to reference
MFWsStack.dllbecause it contains theWs.ServiceModelnamespace.Fourth, build the project.
Fifth, run the following (which is in PowerShell) to create the WSDL file.
In the above script,
libraryis the directory that containsMFWsStack.dll, which is our project's only external reference. The script creates the WSDL file inC:\FooService\temp\FooService.wsdl. Hooray!