Bug 27251 - Web Service: XmlSerialization ignores XmlIgnoreAttribute and Specified
Summary: Web Service: XmlSerialization ignores XmlIgnoreAttribute and Specified
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 4.0.0
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-20 08:57 UTC by Stefan K
Modified: 2015-05-07 12:36 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
WebserviceTest sample (66.91 KB, application/x-zip)
2015-02-20 08:58 UTC, Stefan K
Details

Description Stefan K 2015-02-20 08:57:53 UTC
Android code:
=========================================
Service1 service = new Service1();
service.Url = @"http://10.0.1.127:8080/Service1.svc";
string s = service.GetData(50, false);
textView.Text = s;
=========================================
Desktop code:
=========================================
Service1 service = new Service1();
service.Url = @"http://10.0.1.127:8080/Service1.svc";
string s = service.GetData(50, false);
label1.Text = s;
=========================================
Android request:
=========================================
<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>
    <GetData xmlns="http://tempuri.org/">
      <valueSpecified>false</valueSpecified>
    </GetData>
  </soap:Body>
</soap:Envelope>
=========================================
Desktop request.
=========================================
<?xml version = "1.0" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <GetData xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>
=========================================

The problem seems to be, that the Android implementation generates "specified" fields for each primitive type. And the specified fields are passed in the request, where they should not exist at all. 

If pass complex objects to the webservice, the implementation works fine.

A WCF Service ignores the specified fields, so there is no problem with it on that side, but if you use it with Java EE SOAP Webservice it results in an error (UnmarshallingError).

I attached sample source code for you. I used Membrane SOAP Monitor to trace the client/server communication.

My guess is the problem is with the xml serializer, because the "specified" fields are marked with an XmlIgnoreAttribute in the generated code.

It seem to be related to this problem:
https://bugzilla.xamarin.com/show_bug.cgi?id=1852
Comment 1 Stefan K 2015-02-20 08:58:46 UTC
Created attachment 9942 [details]
WebserviceTest sample

Note You need to log in before you can comment on or make changes to this bug.