none
SoapException: Server did not recognize the value of HTTP Header SOAPAction:

    Question

  • hi i had simple .net 2.0 webservice as follows:

    Code Block

    [WebService(Namespace = "http://MyService1/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Service : System.Web.Services.WebService
    {
        
            [WebMethod]
        public double Add(double a, double b)
        {
            return a + b;
        }
       
    }

     

     

    I generated proxy and interface for above webservice using wsdl.exe (i dont want to use svcutil) which is as follows and I included this proxy in wcf client.

     

     

    Code Block


    //------------------------------------------------------------------------------
    //
    //     This code was generated by a tool.
    //     Runtime Version:2.0.50727.312
    //------------------------------------------------------------------------------


    using System.ServiceModel;


     


    namespace AddClient1
    {
            [System.Web.Services.WebServiceBindingAttribute(Name = "ServiceSoap", Namespace = "http://MyService1/")]
        public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol
        {

               }

        [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
        [System.Web.Services.WebServiceBindingAttribute(Name = "ServiceSoap", Namespace = "http://MyService1/")]
       
    [ServiceContract]
        public interface IServiceSoap
        {

            [System.Web.Services.WebMethodAttribute()]
            [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://MyService1/Add", RequestNamespace = "http://MyService1/", ResponseNamespace = "http://MyService1/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
           
    [OperationContract]
            double Add(double a, double b);
       
    }
    }

      

    and i am developing WCF client for above webservice using channels, so my client looks like

     

    Code Block

    static void Main(string[] args)
            {
               
               
                string EndPoint = "http://localhost:50910/AddWebService/Service.asmx";
                BasicHttpBinding binding = new BasicHttpBinding();

                ChannelFactory factory = new ChannelFactory(binding, EndPoint);
                AddClient1.IServiceSoap channel = factory.CreateChannel();
                ((IChannel)channel).Open();
                double d = channel.Add(4, 5);
                Console.WriteLine(d.ToString());
                Console.ReadLine();

    }

     

     

    and when i run the client app. I am getting the following error

     

    System.ServiceModel.FaultException was unhandled
      Message="System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://tempuri.org/IServiceSoap/Add.\n   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()\n   at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)\n   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()\n   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)"
      Source="mscorlib"

     

     


    any suggestions how to solve this

     

    Thanks,

     

     

     

    Monday, October 08, 2007 12:23 PM

Answers

All replies

  • It appears that we have a misunderstanding about how System.ServiceModel interacts with attributes from System.Web.Services. In short-- it doesn't interact, look at, respect these attributes. I don't understand your desire to not create the client side using svcutil-- SvcUtil would generate an appropriate contract for you that used attributes that the System.ServiceModel.ChannelFactory (and associated System.ServiceModel.Description.* classes) knew to look for.

     

    Your OperationContract currently specifies no namespace or action name, which is why you are getting the failure you are seeing. The attribution you gave said 'Use WCF Defaults' which was read by the underlying classes.

     

    Again-- WCF does not read System.Web.Services.* attributes. That's why this is happening. Please use SvcUtil instead, or explain why you won't/can't so that we can better understand your limitations and give you an appropriate answer.

    Tuesday, October 09, 2007 2:40 AM
  • Thanks Scott,

    I understand what you said , basically i want to know that is there any possible way to create a WCF client which uses the proxy generated by WSDL.exe

    Tuesday, October 09, 2007 5:32 AM
  • WSDL.exe does not create WCF clients. WSDL.exe creates ASMX clients.

     

    Wednesday, October 10, 2007 12:40 PM