This project is read-only.
1
Vote

Begin/End pattern async methods break soap header export

description

Hi. I believe this interface definition
[OperationContract(AsyncPattern = true)]
IAsyncResult BeginWaitForStatusUpdate(long timestamp, AsyncCallback callback, object state);
MyDTO EndWaitForStatusUpdate(IAsyncResult result);
breaks the WSDL export of SoapHeadersAttribute.

I think this
  internal static void Export(WsdlExporter exporter, WsdlContractConversionContext context)
        {
            foreach (OperationDescription op in context.Contract.Operations)
            {
                SoapHeaderAttribute[] soapHeaders = (SoapHeaderAttribute[])op.SyncMethod.GetCustomAttributes(typeof(SoapHeaderAttribute), false);
                if (soapHeaders.Length > 0)
                {
                    foreach (SoapHeaderAttribute soapHeader in soapHeaders)
                    {
                        AddSoapHeader(op, soapHeader);
                    }
                }
            }
        }
should be changed to
  internal static void Export(WsdlExporter exporter, WsdlContractConversionContext context)
        {
            foreach (OperationDescription op in context.Contract.Operations)
            {
                if (op.SyncMethod == null)
                    continue;
                SoapHeaderAttribute[] soapHeaders = (SoapHeaderAttribute[])op.SyncMethod.GetCustomAttributes(typeof(SoapHeaderAttribute), false);
                if (soapHeaders.Length > 0)
                {
                    foreach (SoapHeaderAttribute soapHeader in soapHeaders)
                    {
                        AddSoapHeader(op, soapHeader);
                    }
                }
            }
        }
as long as you don't need begin/end methods to work with SOAP headers. The change is here
if (op.SyncMethod == null)
                    continue;

comments