Closed tomskarasha closed 3 years ago
try previous versions of SoapCore, maybe there is something broken with new fixes, still exploring
also you may perform some exploration
in SoapEndpointMiddleware near mstm.Seek(0, SeekOrigin.Begin);
replace it with:
mstm.Seek(0, SeekOrigin.Begin);
Console.WriteLine(Encoding.UTF8.GetString(mstm.ToArray()));
mstm.Seek(0, SeekOrigin.Begin);
so you will be able to view received xml, and try sending from .net client to see what xml it have created, to be sure there no differences
in GetRequestArguments you may experiment with xml order, to rewrite it as commented in my branch
there are serialization tests here, mostly XmlSerialization is working (seems except your case), so you may try to experiment with
Did as you told, and received XML as expected with all its elements and right order.
Ou snaaap, according to documentation when this ReadStartElement()
is called it moves to next element and when it comes to IsStartElement
then this xmlReader
shows incorrect element but in OperationDescription is correct, so when it comes to IsStartElement
its false and class object parameter is empty. :/
hmm... In my opinion there is no need for ReadStartElement()
as it jumps forward to next than its compared in IsStartElement
to operations
some fixes here I implemented handling of [MessageContract] attribute for request/response, so in provided samples (see tests) it is working. also with these tests you can easier explore what is happening.
completed, merged to master. try it now and see extended samples under serialization tests
Yeah, I see, good solution for issue.
Only thing is that I can't change that contract to add that MessageContract
attribute, request contract is generated from XSDs into dll that comes from other system(s) and I cant change that!
Is there a possibility to add/mark it somehow differently?
hmm...
I'm not sure how legit that is but I created some sort of a wrapper with MessageContract
attribute:
[MessageContract(WrapperName = nameof(someRequest))]
public class someRequest : GeneratedAllContractdll.someRequest
{
}
sort of works! :/
Is there a possibility to add/mark it somehow differently?
you may explore and make solution (may be check for XmlRoot attribute together with MessageContract?). idea with inheritance is also good
I added a PR that fixes this issue for me. #239
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Hi! I have an issue on SoapCore reading XML body it's first element! Here is the XML I'm using:
My service interface:
It calls service just fine, but the
someRequest
is null, always null!Then I started to debug and turns out that it reads wrong start element in:
xmlReader.ReadStartElement(operation.Name, operation.Contract.Namespace);
xmlReader
thinks thatSomeObject
is the start element, insomeRequest
xml tag it is, but in the body it's not. I think that it should read/take the first, after body not whats insomeRequest
becausesomeRequest
is first element which needs to be taken.When I comment out this line:
// xmlReader.ReadStartElement(operation.Name, operation.Contract.Namespace);
Works like a charm, read, deserealized, delivered to operation!What do you think guys @kotovaleksandr @DmitryBryluk is it fixable different way or not?