I am currently trying to connect my ASP-NET Core 2 application to Magento’s API (WSDL v2), but keep receiving the following errors:
*Doesn’t matter which method I call, even the new PortTypeClient().loginAsync(username, password);
throws that, with this random endpoint name salesOrderShipmentAddComment
.
InvalidOperationException: The operation
‘salesOrderShipmentAddComment’ could not be loaded because it
specifies “rpc-style” in “literal” mode, but uses message contract
types or the System.ServiceModel.Channels.Message. This combination is
disallowed — specify a different value for style or use parameters
other than message contract types or
System.ServiceModel.Channels.Message.
However, using SoapUI, postman or importing with framework 4.6, it works perfectly.
Using the Magento v1 API it works too, but I don’t want to use this version.
During the import in asp-net core, I also recieve those warnings (importing v1 doesn’t shows any warning):
I’m almost creating a new 4.6 application, hosting it separately to work as a bridge between my application and Magento, even if it hurts my performance and architeture.
This is how I’m doing the import:
*Obs: In Data Type Options
, I also tried checking different options, and selecting other data types.
Anything would help…
Thanks in advance
4
Answers
I had the same problem. Make sure you update your Nuget Packages to 4.5.3. After, works correctly for me.
Indeed updating the following packages to version 4.5.3 seems to resolve the issue:
System.ServiceModel.Duplex
System.ServiceModel.Http
System.ServiceModel.NetTcp
System.ServiceModel.Security
Seems like 4.4.4 version of those packages are installed by default, while adding WCF service reference via VS 2017 15.9.4 UI
Just update System.ServiceModel.Http to 4.5.3
According to
https://ozguradem.net/english/coding/2018/11/06/soap-services-with-dotnet-core/
Open .csproj file and edit following packages minimum version like these