Failed to change ServiceStack namespace

Little problem. When I run the ServiceStack API application on my Windows computer, the namespaces are displayed correctly, as I claim them. But when I start the service on a Linux computer with mod_mono. Then these namespaces are redefined by something else. See my code below:

DTO

namespace API_ESERVICES_NOTIFICATION { [DataContract(Namespace = "urn:com.example:service:20130308")] public class GetAccountNotification { [DataMember] public GetAccountResponseTO getAccountResponse { get; set; } } } 

Created by 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"> 

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"> 

Now, how can I get the Linux namespace as urn: com.example: service: entity: 20130308 and urn: com.example: service: 20130308 and not http://schemas.datacontract.org/2004/07/API_ESERVICES_NOTIFICATION .Model . Any help would be appreciated.

+4
source share
1 answer

It looks like a bug in Mono not occupying the DataContract namespace or not considering urn: prefix of the valid xml namespace. I recommend filing a bug in Mono .

An alternative you can try is the lack of a namespace and specifying the assembly attribute in your Assembly.cs project, for example:

 [assembly: ContractNamespace("urn:com.example:service:20130308", ClrNamespace = "API_ESERVICES_NOTIFICATION")] 
+3
source

Source: https://habr.com/ru/post/1490441/


All Articles