Include out parameters in wsdl
Hi,
out parameters are missing in created wsdl. See sample SampleService.VoidMethod(out var stringValue). For testing, I created a .NET Framework 4.6.1 client project using ServiceReference to create a client from wsdl. There, the out parameter is missing, see
Client461.zip.
Best regards, Markus
Does SOAP support .NET out parameters at all? I was under the impression that everything you want to return from a SOAP call must be in the returned object.
@MFinkBK Yes it does! At least the non-wcf SOAP client/server. The following snippet should help generating wsdl. Note that TService must not be an interface.
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Services.Description;
/// <summary>Writes a WSDL for the XML Web service at the specified URL.</summary>
/// <typeparam name="TService">A concrete implementation of the XML Web service</typeparam>
/// <param name="output">The stream to which you want to write.</param>
/// <param name="url">The address (URL) of the XML Web service.</param>
public static void Write<TService>(Stream output, string url) where TService : class
{
var reflector = new ServiceDescriptionReflector();
reflector.Reflect(typeof(TService), url);
var serviceDescription = reflector.ServiceDescriptions.Cast<ServiceDescription>().Single();
serviceDescription.Write(output);
}
/// <summary>Creates a WSDL for the XML Web service at the specified URL.</summary>
/// <typeparam name="TService">A concrete implementation of the XML Web service</typeparam>
/// <param name="url">The address (URL) of the XML Web service.</param>
public async static Task<byte[]> CreateAsync<TService>(string url) where TService : class
{
using (var output = new MemoryStream())
{
await Task.Run(() => Write<TService>(output, url));
return output.ToArray();
}
}
Where is the place for this code?
What the result of this issue? Does smbd. have an example for this?
@abalykov Sry for my late answer: The code snippet is a workaround for .wsdl generation and mimics the non-wcf SOAP clients' behaviour. For example, generating .wsdl for the sample:
public async Task<string> GetWsdl()
{
const string url = string.Format("http://{0}:5050/Service.asmx", Environment.MachineName);
var wsdl = await CreateAsync<SampleService.SampleServiceClient>(url);
return System.Text.Encoding.Default.GetString(wsdl);
}
See also samples/Client461/Programcs:29 where this makes problems.
try it now and see extended samples under serialization tests
Thanks, works as expected :+1:
I updates samples regarding this change #121