Sha*_*Wyk 5 c# mono web-services namespaces servicestack
小问题,当我在 Windows 计算机上运行 ServiceStack API 应用程序时,命名空间按照我的说明正确显示。但是当我在 Linux 机器上运行 mod_mono 服务时。然后这些命名空间就会被其他东西覆盖。请参阅下面我的代码:
数据传输组织
namespace API_ESERVICES_NOTIFICATION
{
[DataContract(Namespace = "urn:com.example:service:20130308")]
public class GetAccountNotification
{
[DataMember]
public GetAccountResponseTO getAccountResponse {
get;
set;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Windows 生成的 SOAP11 xml
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetAccountNotification xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:com.example:service:20130308">
<getAccountResponse xmlns:d2p1="urn:com.example:service:entity:20130308">
Run Code Online (Sandbox Code Playgroud)
Linux Mod_Mono
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetAccountNotification xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/API_ESERVICES_NOTIFICATION">
<getAccountResponse xmlns:d2p1="http://schemas.datacontract.org/2004/07/API_ESERVICES_NOTIFICATION.Model">
Run Code Online (Sandbox Code Playgroud)
现在我如何将 Linux 命名空间设置为 urn:com.example:service:entity:20130308 和 urn:com.example:service:20130308,而不是http://schemas.datacontract.org/2004/07/API_ESERVICES_NOTIFICATION。模型。任何帮助将不胜感激。
这看起来像是 Mono 中的一个错误,没有获取 DataContract 的名称空间或没有考虑为urn:有效的 xml 名称空间添加前缀。我建议在 Mono 中提交错误。
您可以尝试的另一种选择是将命名空间留空并在项目中指定程序集属性Assembly.cs,例如:
[assembly: ContractNamespace("urn:com.example:service:20130308",
ClrNamespace = "API_ESERVICES_NOTIFICATION")]
Run Code Online (Sandbox Code Playgroud)