2012-08-15 88 views
2

我与以下请求和响应一类服务栈服务在相同的命名空间服务参考产生一个不正确的代理为ServiceStack

public class GetContactMasterData 
{ 

} 

public class GetContactMasterDataResponse 
{ 
    public IdDescription[] EntityTypes { get; set; } 
    public IdDescription[] NameTypes { get; set; } 
    public IdDescription[] AddressTypes { get; set; } 
    public ResponseStatus MyResponseStatus { get; set; } 
} 

我测试的服务成功使用的soapUI。这是响应

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">  
    <s:Body> 
     <GetContactMasterDataResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> 
     <AddressTypes> 
      <IdDescription> 
       <Description>Home</Description> 
       <Id>1</Id> 
      </IdDescription> 
      ... 
     </AddressTypes> 
     <EntityTypes> 
      <IdDescription> 
       <Description>Corporation</Description> 
       <Id>1</Id> 
      </IdDescription> 
      ... 
     </EntityTypes> 
     <MyResponseStatus i:nil="true" /> 
     <NameTypes> 
      <IdDescription> 
       <Id>4</Id> 
       <Description>Other</Description> 
      </IdDescription> 
      ... 
     </NameTypes> 
     </GetContactMasterDataResponse> 
    </s:Body> 
</s:Envelope> 

当我创建一个控制台应用程序中测试该服务的服务参考生成代理对象。这是智能感知如何引导你调用GetContactMasterData方法

GetContactMasterData(出IdDescription [],出ResponseStatus myResponseStatus,出IdDescription [] NameTypes):IdDescription [] addressTypes

我的问题是: 为什么EntityTypes和NameTypes变成输出参数vs addressTypes成为方法的返回类型?

回答

3

包括在ServiceStack的SOAP Support wiki局限性要留神与SOAP:

由于VS.NET的添加服务引用是为消费的.asmx 或WCF RPC方法调用不正确地支持多个返回优化 值(例如,当你也想要一个ResponseStatus属性),其中 将生成一个丑陋的代理API和out参数。

如果你想确保一个漂亮的代理生成,你应该只有一个第一级属性,其中包含所有你想要返回的数据。