XSD 中缺少响应和 DTO 对象 [英] Response and DTO objects missing from XSD

查看:38
本文介绍了XSD 中缺少响应和 DTO 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 NuGet 的最新版本的 ServiceStack.我有一个基本的服务设置,可以很好地与 JsonServiceClient 配合使用,并且按预期通过了我们所有的单元测试.

I'm using the latest version of ServiceStack with NuGet. I've got a basic service setup that works fine with the JsonServiceClient and is passing all of our unit tests as expected.

不幸的是,我还尝试支持 SOAP 和 Visual Studios添加服务引用"代理生成,以便与希望继续使用此类框架的其他组进行互操作.

Unfortunately I'm also trying to support SOAP and Visual Studios "Add Service Refernece" proxy generation for interop with other groups who want to continue using that sort of framework.

我遇到的是,我们的 DTO 包括 Response 对象没有被填充到 ServiceStack 通过元数据页面生成的 XSD 或 wsdl 中.结合以下事实,当查看各个 SOAP 操作示例时,生成的示例中显示了正确的响应和 DTO,这似乎很奇怪.

What I'm running into is that our DTO's including the Response objects are not being populated into the XSD's or wsdl's that ServiceStack is generating via the metadata page. This seems very odd in conjunction with the fact that when viewing the individual SOAP Operation examples the correct Response and DTO's are shown in the generated example.

响应示例:

Namespace Operations
    <DataContract>
    Public Class GetItemResponse
        Implements IHasResponseStatus

        <DataMember>
        Public Property ResponseStatus As ResponseStatus Implements IHasResponseStatus.ResponseStatus

        <DataMember>
        Public Property Item As Item
    End Class
End Namespace

示例 DTO:

Namespace Types
    <DataContract>
    Public Class Item
        <DataMember>
        Public Property ItemIdentifier As String
        <DataMember>
        Public Property ItemId As Guid?
        <DataMember>
        Public Property ItemName As String
        <DataMember>
        Public Property Description As String
        <DataMember>
        Public Property InstallDate As DateTime?
        <DataMember>
        Public Property FeatureNumber As String
        <DataMember>
        Public Property ModelNumber As String
    End Class
End Namespace

我也在使用 Assembly: ContractNamespace 属性来设置 XML 命名空间.

I'm using the Assembly: ContractNamespace attribute to set the XML namespace as well.

推荐答案

我已经下载了源代码并自己做了一些调查.我不确定这个变化有多近,但似乎为了将您的 DTO 和响应对象包含在 wsdl 中,您需要添加一个查询字符串,如?includeAllTypes=true".

I've downloaded the source code and done some investigation on my own. I'm not sure how recent this change is but it appears that in order for your DTO's and Response objects to be included in the wsdl you need to add a query string like "?includeAllTypes=true".

我还使用了 ServiceStack BasicAuthProvider 设置,这会导致 AssignRoles 和 UnAssignRoles 自动添加到服务中.这些调用的请求和响应对象仍然无法将其放入 wsdl 并导致添加服务引用"失败.幸运的是,我们没有使用它们,所以如果我能找到另一个配置设置来删除它们,它们应该都能正常工作.

I'm also using the ServiceStack BasicAuthProvider setup which is causing AssignRoles and UnAssignRoles to be added to the Service automatically. The request and response objects for those calls are still failing to make it into the wsdl and causing "Add Service Reference" to fail. Fortunately we aren't making use of them so if I can find another configuration setting to remove them all should be working correctly.

这篇关于XSD 中缺少响应和 DTO 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆