Proxy Generation Question & Wrapping

Topics: Service Factory Modeling Edition Forum
May 8, 2008 at 2:19 PM

I am using WSSF ME on VS2008 and I noticed some strange behavior which didn't occur in the previous release. I have an issue creating a WS using DataContractSerializer.
When I specify an operation that has both a Response and Request message, and the Request message contains multiple Message Parts, then the proxy that is generated is not what I would expect.


Operation: CreatePage
Request Message: CreatePageRequest
Request Message Parts:
  • CreatePageRequest.Page (Page Data Contract)
  • CreatePageRequest.PageNumber (System.Int32)
  • CreatePageRequest.InsertAfter (System. Boolean)
Response Message: PageResponse
Response Message Part:
  • PageResponse.Page (Page Data Contract)

After 'Generate Proxy' the client code contains a 'CreatePageRequest' class marked with a DataContractAttribute and a 'CreatePageRequest1' class with a MessageContractAttribute.
The signature of the client-side operation is: Page CreatePage(CreatePageRequest CreatePageRequest) while the signature that I would expect to be generated should look like:
Page CreatePage(Page Page, int PageNumber, bool InsertAfter)

When I remove the PageResponse from the model, then the expected signature is generated and there is no 'CreatePageRequest1' class.
I need the PageResponse, however, so I can't leave it out.
Anybody have an idea what I am doing wrong, or is this a bug of the code generator?


May 8, 2008 at 3:22 PM
Did you try setting the isWrapped property to true for the request/response message contract in the service contract design?
May 13, 2008 at 8:40 AM
Yes, the IsWrapped is set to True. Not setting this flag results in an error when validating the service contract.
May 13, 2008 at 6:59 PM
As I see, you are using the WCF technology implementation and the way to build your Req/Resp message is with IsWrapped so that proxy is the default behavior.
If you need other custom settings that may adjust the proxy gen to your needs, then you may try specifying on the "Advanced Options" in the "Add WCF Service reference..." dialog when you generate the proxy from the host model. There you can specify the type of Req/Resp pattern and some other things as well.
May 14, 2008 at 7:58 AM
Thanks. I tried it, however it yields the same results as when generating the proxy through the Service Factory.

I think I'll have to use the current (flawed) implementation for now, and instantiate the request message on the client before sending it as parameter to the proxy method.
Jul 30, 2008 at 4:35 PM
Edited Jul 30, 2008 at 4:45 PM
To resolve this problem You must set isWrapped property to true for request and response message contract simultaneous. This must be independent of number of parameters in the message contracts.
In this case the wizard generates code for client as expected.

Jul 31, 2008 at 9:50 AM
Cool! That works!

Thanks Myckyc!!