Strange proxy code in wrapped requests messages

Topics: Service Factory Modeling Edition Forum
Sep 18, 2008 at 9:55 AM
Hello,

When I generate the proxy for my project I get 2 request objects for a single operation. The request objects are called request message name and request message name1. Let me give you an example: lets say I have an operation called GetArticleByKey with a request message called GetArticleByKeyRequest containing 2 int32:s parts called ArticleId and ArticleFamily. The response message GetArticleByKeyResponse returns a DataContractCollection of type ArticleDataList called Articles which can be found in the DataContract togetgher with a DataContract called ArticleData. When I generate the proxy the following code is generated:

(To make it easier to read I have replaced the namespace with the word namespace.)


namespace.GetArticleByKeyResponse namespace.GetArticleByKey(namespace.GetArticleByKeyRequest1 request)
{
    return base.Channel.GetArticleByKey(request);
}

public namespace.ArticleDataList GetArticleByKey(namespace.GetArticleByKeyRequest GetArticleByKeyRequest )
{
    namespace.GetArticleByKeyRequest1 inValue = new namespace.GetArticleByKeyRequest1();
    inValue.GetArticleByKeyRequest = GetArticleByKeyRequest;
    namespace.GetArticleByKeyResponse retVal = ((namespace.ServiceContract)(this)).GetArticleByKey(inValue);
    return retVal.Articles;
}


If you look at an old operation that I generated before this problem occured the generated code should have looked like this:

namespace.GetArticleByKeyResponse namespace.GetArticleByKey(namespace.GetArticleByKeyRequest request)
{
    return base.Channel.GetArticleByKey(request);
}

public namespace.ArticleDataList GetArticleByKey(int ArticleId, int ArticleFamily)
{
    namespace.GetArticleByKeyRequest inValue = new GetArticleByKeyRequest();
    inValue.ArticleId = ArticleId;
    inValue.ArticleFamily = ArticleFamily;
    namespace.GetArticleByKeyResponse retVal = ((namespace.ServiceContract)(this)).GetArticleByKey(inValue);
    return retVal.Articles;
}


If you look at the generated code in the  ServiceContract, the MessageContract and in the service xml file there are no mention of GetArticleByKeyRequest only GetArticleByKeyRequest. I have also made sure to delete the old proxy and cleanded out app.config before I regenerated the proxy. 

 

This only seems to apply to wrapped request messages, can you somehow configure how wrapped request messages should be generated?

//Kind regards
Martin Gredin

Jul 23, 2009 at 6:55 PM

We recently ran into a similar issue and the solution was to set isWrapped to true on the response message if isWrapped is set to true on the request regardless of the number of parts in the response message.  I haven't dug into why.

 

Christopher C. Bernholt

Developer
Jul 23, 2009 at 8:13 PM

Hi Martin,

Here are some additional background info about IsWrapped usage and "side effects".

http://msdn.microsoft.com/en-us/library/ms730255.aspx

Serialization issues: http://servicefactory.codeplex.com/Thread/View.aspx?ThreadId=31162

Other issues: http://www.codeplex.com/servicefactory/Thread/View.aspx?ThreadId=21981