none
Cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher RRS feed

  • Question

  • Hi,

    i am sankar

    i am facing issue of 

    The message with Action 'http://samle.org/Sample.WebServices/MyService/getTableZipFileAttache' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

    Scenario:

    I Just constructed a service which will be having method of "getTableZipFileAttache" this will achieves the functionality attaching Zip file content into stream
    using the line of code 


    HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=Tables.zip");
    HttpContext.Current.Response.OutputStream.Write(bytes, 0, bytes.Length);


    this service method will retun as byte[] array as response

    i am making this WCF service call in another Third party web service as shown below code snippet

    ThirdPartyWebService.MethodforUpdate(WCFServiceAddress,
                             DownloadDate,
                            ApplyDate,
                            CStr(ddlApplyEvent.SelectedValue),
                            payloadRetrievalAddress,
                            "Y", "GUID:" & CStr(strGUID),
                            CInt(root.SelectSingleNode("NumberOfRetries").ChildNodes(0).Value),
                            CInt(root.SelectSingleNode("RetryInterval").ChildNodes(0).Value))

    Here i am sending wcf service as a endpoint url as 'http://samle.org/Sample.WebServices/MyService/getTableZipFileAttache'

    a parameter in the method.

    please give me solution for this ...


     

     


    • Edited by kssrao Wednesday, November 13, 2019 3:33 PM Corrections made
    Wednesday, November 13, 2019 2:33 PM

All replies

  • Hi,

    If you want to publish the service as RESTful style, please create the service with webhttpbinding, in order to addressing the method with service URL.

    http://samle.org/Sample.WebServices/MyService/getTableZipFileAttache'

    In WCF, there is no HttpContext during the communication, we usually control the http context by using OperationContext/WebOperationContext.
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/wcf-services-and-aspnet
    WebOperationContext is only a convenience wrapper around OperationContext and we can get everything by using OperationContext.
    I would like to know your configuration on the server-side. Here is a code snippet about downloading. Wish it is useful to you.
    IService.

     [ServiceContract]
        public interface IService1
        {
            [OperationContract]
            [WebGet]
            Stream Download();
    }


    Service.

        public class Service1 : IService1
        {
            public Stream Download()
            {
                string file = @"C:\1.png";
                try
                {
                    FileStream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
                    WebOperationContext.Current.OutgoingResponse.ContentType = "image/png";
                    WebOperationContext.Current.OutgoingResponse.Headers.Add("Content-disposition", "inline; filename=Scan.Tiff");
                    return fs;
                }
                catch (Exception ex)
                {
                    return null;
                }
            }
    }
    

    Configuration.

      <system.serviceModel>
        <bindings>
          <webHttpBinding>
            <binding name="mybinding">
              <security mode="Transport">
                <transport clientCredentialType="None"></transport>
              </security>
            </binding>
          </webHttpBinding>
        </bindings>
        <behaviors>
          <endpointBehaviors>
            <behavior>
              <webHttp />
            </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
          <add binding="webHttpBinding" scheme="http"/>
          <add binding="webHttpBinding" scheme="https" bindingConfiguration="mybinding"/>
        </protocolMapping>    
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
    
    After we deploy the project to IIS, we could download the image by directly calling the service in a browser address bar.

    Feel free to let me know if there is anything I can help with.

    Best Regards

    Abraham

    Friday, November 15, 2019 7:30 AM
    Moderator
  • Hi Abraham,

    Thanks for your reply ...

    I think this is not my requirement, can you please look into my requirement as follows ..... 

    Hi,

    We have a WCF Service and the service method will give response as zip file, the problem what we are facing is when the third party client calling the WCF service end point(URL) as a parameter in the client method, the WCF service method call is not hitting and no error logging in third party client side.

    Constraints: 1.The third party client should not make WCF instance.

               2. And also should not use service reference in client side.

    Please see the below code which is using by third party  service call in aspx.vb file...

    thirdPartyWebService.MethodforUpdate(WCFServiceAddress,
                             DownloadDate,
                            ApplyDate,
                            CStr(ddlApplyEvent.SelectedValue),
                            payloadRetrievalAddress,
                            "Y", "GUID:" & CStr(strGUID),
                            CInt(root.SelectSingleNode("NumberOfRetries").ChildNodes(0).Value),
                            CInt(root.SelectSingleNode("RetryInterval").ChildNodes(0).Value))

    So please kindly guide us to implement best approach and let us know if you need any further clarifications.

    Awaiting for your help.



    • Edited by kssrao Tuesday, November 19, 2019 2:10 PM
    Tuesday, November 19, 2019 2:05 PM
  • Hi,
    How do you create you WCF service? 
    I am confused on these constraints, if the service is SOAP style, we call it by other way, such as Channel factory, it is essentially a client proxy, like service reference.  Therefore, it seems to me these constraints are invalid.
    thirdPartyWebService.MethodforUpdate
    The thirdPartyWebService is a client proxy object. It has violated your constraints.
    About calling the service with Channel Factory.
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-use-the-channelfactory
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/channel-factory

    If the WCF service is Restful style, we should create the service with the above Webhttpbinding, then consume it in the browser.
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-create-a-basic-wcf-web-http-service
    At last, have you created the WCF service? I would like to know how does it create, please share your configuration with me.
    Feel free to let me know if there is anything I can help with.
    Best Regards
    Abraham
    Wednesday, November 20, 2019 5:34 AM
    Moderator