wcf icon indicating copy to clipboard operation
wcf copied to clipboard

Setting mustunderstand to false in wcf client created with dotnet-svcutil

Open jangaehler opened this issue 5 years ago • 4 comments

I have generated a client with the dotnet-svcutil to be able to use an external WSDL service, the client uses WSHttpBinding. The connection works, but I get the response "One or more mandatory SOAP header blocks not understood". I checked the request in Soap Ui, same result as long as MustUnderstand is true. I have already built several PHP clients for this web service and never had this problem there.

Here it is suggested to set the MessageHeader.MustUnderstand to false. https://github.com/dotnet/wcf/issues/3304 But how and where to do that?

My dotnet-svcutil.params.json:

  "providerId": "Microsoft.Tools.ServiceModel.Svcutil",
  "version": "2.0.2",
  "options": {
    "inputs": [
      "https://webservice1.foobar.example/foobarWSCore/jaxws/UnternehmensInfoService20x0?wsdl"
    ],
    "enableDataBinding": true,
    "messageContract": true,
    "namespaceMappings": [
      "*, MyNamespace.ServiceReference"
    ],
    "outputFile": "Reference.cs",
    "targetFramework": "netcoreapp3.1",
    "typeReuseMode": "All"
  }
}```

jangaehler avatar Jan 18 '21 12:01 jangaehler

Hi there, I'm also interested in answer. We're integrating with external SOAP API and adding following header <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none"></Action> results into error returned from API : Must Understand check failed for header http://schemas.microsoft.com/ws/2005/05/addressing/none : Action

rebrovoleksii avatar Feb 04 '21 15:02 rebrovoleksii

@rebrovoleksii Here is a Workaround: https://stackoverflow.com/questions/53321927/wshttpbinding-in-netstandard-or-net-core

jangaehler avatar Feb 04 '21 15:02 jangaehler

@imcarolwang can you please take a look?

HongGit avatar Aug 03 '21 05:08 HongGit

Hi @jangaehler sorry for the late response, to add a message header in a client request, you can refer to answer of this stackoverflow question link: https://stackoverflow.com/questions/56768566/adding-message-header-to-request. Hope this helps.

imcarolwang avatar Aug 30 '22 03:08 imcarolwang