Bug 16256 - Missing element in WSDL in response of ServiceContract
Summary: Missing element in WSDL in response of ServiceContract
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-11-15 06:12 UTC by pete
Modified: 2017-09-06 16:55 UTC (History)
1 user (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 16256 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description pete 2013-11-15 06:12:54 UTC
WSDL produced from ServiceContracts appears to omit the data element descriptions. This causes problems for anything that uses the WSDL to parse messages later on.

This was seen on Mono 3.2.3 on Linux but it has been on all recent versions we have tried.

A simple example with the following code to produce the service description:

[ServiceContract(Namespace = "urn:Test", Name = "Calculator")]
public interface ICalculator
{
	[OperationContract]
	AddResponse Add(Add ar);
}

[MessageContract(IsWrapped = true, WrapperName = "Add", WrapperNamespace = "urn:Test")]
public class Add
{
	[MessageBodyMember]
	public double n1;

	[MessageBodyMember]
	public double n2;
}


[MessageContract]
public class AddResponse
{
	[MessageBodyMember]
	public double Result;

	public AddResponse()
	{
		Result = 0;
        }

	public AddResponse(double res)
	{
		this.Result = res;
	}
}


produces this WSDL (in the ?xsd=xsd1 file)

- <xs:schema xmlns:tns="urn:Shout" elementFormDefault="qualified" targetNamespace="urn:Shout" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="Add">
- <xs:complexType>
- <xs:sequence>
  <xs:element minOccurs="0" name="n1" type="xs:double" /> 
  <xs:element minOccurs="0" name="n2" type="xs:double" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
- <xs:element name="AddResponse">
- <xs:complexType>
  <xs:sequence /> 
  </xs:complexType>
  </xs:element>
  </xs:schema>

I.e. the data in the request (n1 and n2) is in there, but not the response (Result). Running exactly the same code with .Net, it is there.
Comment 1 pete 2014-08-22 10:17:14 UTC
I have discovered this is easy to fix in:

mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs

Function: ExportParameters

Add parameters also if msgbody.ReturnValue != null and  (msgbody.ReturnValue.Type == typeof (void) (both else clauses)




i.e:


if (msgbody.ReturnValue == null) {
  foreach (MessagePartDescription part in msgbody.Parts)
  ...

} else {
   if (msgbody.ReturnValue.Type != typeof (void)) {
   ....
   } 
   **ADD** else {
    foreach (MessagePartDescription part in msgbody.Parts)... (same as above)
  }   
}