WCF in .net core (TransportWithMessageCredential)

前端 未结 2 1750
没有蜡笔的小新
没有蜡笔的小新 2020-12-17 01:37

When I try to create a connection to a WCF client in dotnet core 2.0, I receive an platform unsupported error:

System.PlatformNotSupportedException: \'The v         


        
2条回答
  •  执念已碎
    2020-12-17 02:02

    Actually found a valid workaround, there is a package you can use for this: https://github.com/gravity00/SimpleSOAPClient

    using SimpleSOAPClient;
    using SimpleSOAPClient.Handlers;
    using SimpleSOAPClient.Helpers;
    using SimpleSOAPClient.Models;
    using SimpleSOAPClient.Models.Headers;
    
    ...
    
    _client = SoapClient.Prepare().WithHandler(new DelegatingSoapHandler());
    _client.HttpClient.DefaultRequestHeaders.Clear();
    _client.HttpClient.DefaultRequestHeaders.Add("SOAPAction", "Action...");
    
     var requestEnvelope = SoapEnvelope
         .Prepare()
         .Body(request)
         .WithHeaders(KnownHeader.Oasis.Security.UsernameTokenAndPasswordText(Username, Password));
    
    var responseEnvelope = _client.Send(Url, "CanNotBeEmpty", requestEnvelope);
    

    Got it to work like this, as a charm...

提交回复
热议问题