【发布时间】:2015-05-04 06:07:03
【问题描述】:
我在向我的 soap 端点添加服务引用时遇到问题。我什至尝试在 SS 网站上添加 hello 示例的地址 http://mono.servicestack.net/soap11,但无法生成 wsdl。我所有的 dto(在我的项目中)都装饰有数据合同/成员。我还更改了程序集以指向目标命名空间。我尝试将其添加为 Web 参考,并将参考程序集中的重用类型标记为关闭,但仍然没有运气。有什么我忘记做的吗?如果需要更多信息,请告诉我。
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WILP_API
{
public class ApplicationHost : AppHostBase
{
public ApplicationHost() : base("GreetingService", typeof(GreetingService).Assembly) { }
public override void Configure(Funq.Container container)
{
//throw new NotImplementedException();
}
}
}
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace WILP_API
{
[Route("/hello/{Name}","GET")]
[DataContract(Namespace="WILP_API")]
public class GreetingRequest
{
[DataMember]
public string Name { get; set; }
}
}
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace WILP_API
{
[Route("/hello/{Name}", "GET")]
[DataContract(Namespace="WILP_API")]
public class GreetingResponse
{
[DataMember]
public string Result { get; set; }
}
}
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WILP_API
{
public class GreetingService : IService
{
public GreetingResponse Any(GreetingRequest request)
{
GreetingResponse response = new GreetingResponse();
response.Result = "Hello, " + request.Name + "!";
return response;
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WILP_API")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WILP_API")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("133bdb3e-442d-45ad-9cc2-02fbcd50c8ac")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ContractNamespace("http://schemas.servicestack.net/types",
ClrNamespace = "WILP_API")]
[assembly: ContractNamespace("http://schemas.servicestack.net/types", ClrNamespace = "ServiceStack")]
[assembly: ContractNamespace("http://schemas.servicestack.net/types", ClrNamespace = "ServiceStack.Client")]
错误:
错误 5 自定义工具错误:无法为服务生成代码 参考“ServiceReference3”。请检查其他错误和警告 消息了解详情。
警告 3 自定义工具警告:无法导入 wsdl:binding 详细信息: 导入 wsdl:binding 所在的 wsdl:portType 时出错 依赖于。 wsdl:portType 的 XPath: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='BasicHttpBinding_ISyncReply']
警告 4 自定义工具警告:无法导入 wsdl:port 详细信息:那里 导入 wsdl:binding 时出错,该 wsdl:port 依赖于该绑定 在。 wsdl 的 XPath:绑定: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='BasicHttpBinding_ISyncReply'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='SyncReply']/wsdl:port[@name='BasicHttpBinding_ISyncReply']
警告 2 自定义工具警告:无法导入 wsdl:portType 详细信息:An 运行 WSDL 导入扩展时引发异常: System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:加载提供的 XSD 文档时出现问题:a 引用名为“GreetingRequest”的架构元素和 命名空间“http://schemas.servicestack.net/types”不能 已解决,因为在 targetNamespace 'http://schemas.servicestack.net/types' 的架构。 请检查提供的 XSD 文档,然后重试。错误的 XPath 资源: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply']
【问题讨论】:
-
请删除所有
code snippet部分,因为这些是 C# 代码,并将您的错误和警告消息显示为文本而不是图像。 -
我很抱歉。我希望这种格式更好。
标签: c# soap servicestack