Reputation: 31
I have an asmx web service. On the client side, I don't want to use app config. So I am trying to read the configuration of my application using a ChannelFactory service.:
BasicHttpBinding myBinding = new BasicHttpBinding();
And set all the attributes from my app.config. Then I have defined my endpoint and channel factory:
EndpointAddress myendpoint = new EndpointAddress("http://localhost:<portNumber>/<serviceName>.asmx");
ChannelFactory<IServiceInterface> myCh = new ChannelFactory<IServiceInterface>(myBinding, myendpoint);
IServiceInterface service = myCh.CreateChannel();
This is the error I get when calling a method from my channel:
System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://localhost/<serviceName.asmx/IServiceInterface/<MethodName>.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest
Upvotes: 1
Views: 4940
Reputation: 21
One of the things you can do is to change Action property in OperationContract attribute in your service's interface.
[ServiceContract]
interface IService
{
[OperationContract(Action = "http://tempuri.org/GetString")]
string GetString();
}
I am not sure this is the best solution, searching for another one and will prompt if find anything. But this one works for me.
Upvotes: 2