As the subject indicates, I’m trying to implement a DPWS service on my device to serve as a web services host, with a client application running on the PC. I’m afraid I may have bitten off more than I can chew as I have never done any web services development and am learning several different technologies at the same time. I’ve hit a wall and I’m hoping someone can help me out by at least hinting where I can look for help next.
I started with a fairly basic WSDL file. It defines two complex types: one empty for client queries, and one wrapping an integer. They are used by two simple messages: value request and value response, respectively. Then I have portType, binding, and service elements defined. Everything trying to be as simple as possible.
On the device side, I ran the WSDL file through MfSvcUtil.exe to generate my service.cs, clientproxy.cs and hostedservice.cs files. All of these files are wrapped into a separate library. In the application, I followed the SimpleService example pattern by generating service implementation object and an additional simple device host object. This all seems to work sufficiently well. When I start up my device, I can see the web services host show up under my Windows 7 networking display. Properties on it correctly display the values I entered in my application.
For the client side, I took the same WSDL file and ran it through SvcUtil.exe. This generated my client side code in form of a generatedProxy.cs and app.config files. I configured everything as best as I could and upon running my client, I do get a connection, but my host throws an exception. Apparently, my WCF client app does not put a soap header into the request, while the host requires it.
I’ve read up a bunch on contracts and headers and such, but there are two things that stump me. One, it seems that the dpws host requires a specific header that general MessageHeader type does not support through its exposed attributes. And secondly, I would like to do this automatically. From what I can figure out, dpws host expects an auto generated header that it then returns back to the client in its own message.
How would I go about setting up my WSDL file to force WCF to auto-generate the appropriate headers for my DPWS host?
–Edit–
I didn’t want to upload any code, because there is a lot of it. But if it would help for me to upload any specific code segments, please ask.