В C++ CLR WCF клиенте на выходе получается формат отличный от аналогичного C# WCF клиента. Вот собственно дампы что они шлют:
C++ CLR WCF:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:Email xmlns:h="http://tempuri.org/"/>
<h:Id xmlns:h="http://tempuri.org/"/>
<h:PCName xmlns:h="http://tempuri.org/">DESKTOP-62MUR5B</h:PCName>
</s:Header>
<s:Body>
<DataReportRequest xmlns="http://tempuri.org/">
<FileName>Program1.cs</FileName>
<InnerException xmlns:a="http://schemas.datacontract.org/2004/07/GameReport" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:_x003C_backing_store_x003E_Data i:nil="true"/>
<a:_x003C_backing_store_x003E_Errno>111999</a:_x003C_backing_store_x003E_Errno>
<a:_x003C_backing_store_x003E_IsException>false</a:_x003C_backing_store_x003E_IsException>
<a:_x003C_backing_store_x003E_Message>c++ test error 1 with errno</a:_x003C_backing_store_x003E_Message>
<a:_x003C_backing_store_x003E_Trace i:nil="true"/>
</InnerException>
<Line>52</Line>
<Method>Main</Method>
</DataReportRequest>
</s:Body>
</s:Envelope>
C# WCF
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soaap/envelope/">
<s:Header>
<h:Email xmlns:h="http://tempuri.org/">cs@mail.ru</h:Email>
<h:Id xmlns:h="http://tempuri.org/">222222222222</h:Id>
<h:PCName xmlns:h="http://tempuri.org/">DESKTOP-62MUR5B</h:PCName>
</s:Header>
<s:Body>
<DataReportRequest xmlns="http://tempuri.org/">
<FileName>Program2.cs</FileName>
<InnerException xmlns:a="http://schemas.datacontract.org/2004/07/GameReport" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:_x003C_Data_x003E_k__BackingField i:nil="true"/>
<a:_x003C_Errno_x003E_k__BackingField>111999</a:_x003C_Errno_x003E_k__BackingField>
<a:_x003C_IsException_x003E_k__BackingField>false</a:_x003C_IsException_x003E_k__BackingField>
<a:_x003C_Message_x003E_k__BackingField>cs test error 1 with errno</a:_x003C_Message_x003E_k__BackingField>
<a:_x003C_Trace_x003E_k__BackingField i:nil="true"/>
</InnerException>
<Line>18</Line>
<Method>Main</Method>
</DataReportRequest>
</s:Body>
</s:Envelope>
Собственно сервер понимает C# клиента, и не понимает C++ CLR клиента.
Там получаются пустые значения.
Чем собственно этот формат регулируется ? и как бы его привести к "рабочему" виду?
P.S.
В процессе эксперементов выяснилось до кучи, что если использовать в C++ CLR классы данных с сеттерами/гетерами, то в выходной xml он пихает имя приватной переменной :) тихий ужас..
вот пример на тех-же данных:
<s:Body>
<DataReportRequest xmlns="http://tempuri.org/">
<FileName>Program.cs</FileName>
<InnerException xmlns:a="http://schemas.datacontract.org/2004/07/GameReport" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:__data/>
<a:__err>111999</a:__err>
<a:__isexept>false</a:__isexept>
<a:__msg>test error 1 with errno</a:__msg>
<a:__trace/>
</InnerException>
<Line>52</Line>
<Method>Main</Method>
</DataReportRequest>
</s:Body>
C++ Class
[Serializable]
[MessageContract]
public ref class DataReportException
{
public:
[MessageBodyMember]
property bool IsException;
[MessageBodyMember]
property int Errno;
[MessageBodyMember]
property String ^Message;
[MessageBodyMember]
property String ^Data;
[MessageBodyMember]
property String ^Trace;
}
[Serializable]
[MessageContract]
public ref class DataReportRequest
{
public:
[MessageHeader]
property String ^Id;
[MessageHeader]
property String ^Email;
[MessageHeader]
property String ^PCName;
[MessageBodyMember]
property int Line;
[MessageBodyMember]
property String ^FileName;
[MessageBodyMember]
property String ^Method;
[MessageBodyMember]
property DataReportException ^InnerException;
}
Проблема оказалась в несовместимости выходных данных сериализации между C++ CLR и C#. Атрибут [Serializable] в такой схеме применять не стоит.
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости