ref parameters serialization wrong
ref parameters are excluded from input parameters on target method Invoke, which leads to parameter mismatch
one issue is here where ref parameters are excluded from invoke input
second issue is here and below, where they concatenated wrong way
i.e. multiple interchanged ref/out/regular params with different types will produce this error
same issue may be when generating wsdl contracts
seems I can fix it
working on this issue here
seems invokation parameters are serialized wrong somewhere deep in .net framework, so on service-side I get xml with some elements missing for PingComplexModelOutAndRef method (data2 is missing):
[OperationContract(Action = ServiceNamespace.Value + nameof(PingComplexModelOutAndRef), ReplyAction = "*")]
[XmlSerializerFormat(SupportFaults = true)]
bool PingComplexModelOutAndRef(
ComplexModelInput inputModel,
ref ComplexModelResponse responseModelRef,
ComplexObject data1,
out ComplexModelResponse responseModelOut,
ComplexObject data2);
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<PingComplexModelOutAndRef xmlns="http://sampleservice.net/webservices/">
<inputModel StringProperty="ComplexModelInput sample one" IntProperty="1" EnumProperty="A">
<ListProperty>one</ListProperty>
<ComplexNestedObjectProperty StringProperty="ComplexObject sample one" IntProperty="1"/>
<ComplexListProperty StringProperty="ComplexObject sample one" IntProperty="1"/>
</inputModel>
<responseModelRef FloatProperty="1.1" StringProperty="ComplexModelResponse sample one" ListProperty="one" EnumProperty="A">
<ComplexNestedObjectProperty StringProperty="ComplexObject sample one" IntProperty="1"/>
<ComplexListProperty StringProperty="ComplexObject sample one" IntProperty="1"/>
</responseModelRef>
<data1 StringProperty="ComplexObject sample one" IntProperty="1"/>
</PingComplexModelOutAndRef>
</s:Body>
</s:Envelope>
is it custom SoapCore serialization or indeed in .net framework?
making out parameter last fixes this issue. is it supposed so? this is working:
[OperationContract(Action = ServiceNamespace.Value + nameof(PingComplexModelOutAndRef), ReplyAction = "*")]
[XmlSerializerFormat(SupportFaults = true)]
bool PingComplexModelOutAndRef(
ComplexModelInput inputModel,
ref ComplexModelResponse responseModelRef,
ComplexObject data1,
ref ComplexModelResponse responseModelRef2,
ComplexObject data2,
out ComplexModelResponse responseModelOut,
out ComplexModelResponse responseModelOut2);
seems ok, at least for XmlSerializer out parameters should be all last in params list to work properly, do not know why