Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOAP header Action was not understood

I am trying to consume a webservice in C#. Whenever i try to call the function from the web service class I am getting a "SOAP header Action was not understood".I've added web reference[not service reference] pointing the web service in my project. The following steps were taken to add the web reference

1) right click on the project -> Add WebReference

when i examined the web service in web browser i found this in the header

<wsdl:definitions name="MyService" targetNamespace="http://tempuri.org/">
    <wsp:Policy wsu:Id="WSHttpBinding_ICAIService_policy">
        <wsp:ExactlyOne><wsp:All><sp:TransportBinding>
    <wsp:Policy>

I've done the following code to call the web service functions

WebStruct webS = new WebStruct();
webS.Name = "Peter";
webS.ID = 22;

webS.Find(webS);
like image 384
logeeks Avatar asked May 18 '11 21:05

logeeks


2 Answers

Remove the Web Reference and add a Service Reference instead.

like image 101
Anthony Faull Avatar answered Nov 17 '22 15:11

Anthony Faull


Try to use simple service endpoint binding BasicHttpBinding. This binding is compatible with .NET 2.0.

like image 24
Milan Matějka Avatar answered Nov 17 '22 15:11

Milan Matějka