SOAP header Action was not understood
Asked Answered
K

4

5

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);
Kamila answered 18/5, 2011 at 21:1 Comment(1)
How are wsHttpBinding and webHttpBinding related to your question? Web reference uses older ASMX API and it doesn't support services exposed on these bindings. Actually webHttpBinding is not supported by Add service reference as well.Sher
E
5

Remove the Web Reference and add a Service Reference instead.

Emden answered 6/6, 2012 at 14:25 Comment(2)
yes this fixed the same error message for me. thank you.Poach
This didn't fix for me. WsBinding doesn't understand these headersWaring
C
4

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

Csc answered 5/6, 2013 at 13:5 Comment(1)
Thanks a lot, it really helped me.Swec
A
0

Can you check with your webservice provider? Seems they need some customized header information to process your request. Adding such headers by the service providers are very much common to increase the security.

Aporia answered 19/3, 2012 at 12:5 Comment(0)
P
0

SoapAction errors only went away when I went into the "Configure Service Reference..." properties and updated the Service Reference with these options ticked.

and ticked these two boxes:

TICK Generate asynchronous operations TICK Always generate message contracts

Poach answered 6/5, 2014 at 3:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.