Giter Site home page Giter Site logo

simplesoapclient's Introduction

Hi there 👋

simplesoapclient's People

Contributors

gravity00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplesoapclient's Issues

SoapEnvelopeDeserializationException - If response content is empty no exception is thrown

When the server returns a response with an empty content, shouldn't a SoapEnvelopeDeserializationException be raised?

Example:

public static async Task MainAsync(string[] args, CancellationToken ct)
{
    using (var client = new SoapClient()
        .UsingResponseRawHandler((c, d) =>
        {
            //  simulates and empty content response
            return Handling.ProceedResponseRawHandlerFlowWith(d.Response, string.Empty);
        }))
    {
        var requestEnvelope =
            SoapEnvelope.Prepare().Body(new ExampleRequest());

        SoapEnvelope responseEnvelope;
        try
        {
            responseEnvelope =
                await client.SendAsync(
                    "http://localhost:5656/ExampleService.svc",
                    "http://example.namespace.com/ExampleService/ExampleAction",
                    requestEnvelope, ct);
        }
        catch (SoapEnvelopeDeserializationException)
        {
            //  no exception of this type is thrown
            throw;
        }

        var response = responseEnvelope.Body<ExampleResponse>();
    }
}

Why Does SoapEnveloper.Header<T> Require The element name?

Why not just use the attributes attached to the class? It seems redundant.

[XmlRoot("MeowHeader", Namespace= "http://meow.com/")]
public class MeowResponseHeader : SimpleSOAPClient.Models.SoapHeader
{
  public string Status { get; set; }
  public string Message { get; set; }
}

var header = responseEnvelope
  .Header<MeowResponseHeader >("{http://meow.com/}MeowHeader");

I kept looking for:

var header = responseEnvelope.Header<MeowResponseHeader >();

but had to write it myself...

Thread safety

Hello,

Is the SimpleSoapClient thread safe or do I need to implement that myself when using a soapClient?

Kind regards,
Martijn Kruijer

SOAP 1.2 support doesn't appear to be working

There doesn't appear to be any way of specifying the SOAP version (though the client can automatically determine this AFAIK)

When receiving a 1.2 response this exception is thrown:

InvalidOperationException: <Envelope xmlns='http://www.w3.org/2003/05/soap-envelope'> was not expected.

There is a closed issue for this but the comments trail seems to suggest other people aren't seeing this support either

Create a client from WSDL

Make it easier to generate SOAP entities and clients from a given WSDL using a tool, T4 template or any other option. Ideally, the tool should be as cross platform as possible.

Global options

Provide a way to set global configurations to SoapClient that will be used as default. This options can be overridden for a given instance.

Support async handlers

Executing async operations in handlers may be a requirement, the framework could support async handler methods.

UsernameTokenAndPasswordTextSoapHeader - Invalid namespaces

When using the header UsernameTokenAndPasswordTextSoapHeader some namespaces not correct after serialization (at least Timestamp and contained elements).

Example:

<q1:Envelope xmlns:q1="http://schemas.xmlsoap.org/soap/envelope/">
  <q1:Header>
    <q1:Security d1p1:mustUnderstand="1" xmlns:d1p1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:d2p1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <q1:Timestamp d2p1:Id="_TS2865e12ee8a84c848e8324a1ff002591">
        <Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-05-27T14:19:57.2224185Z</Created>
        <Expires xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-05-27T14:34:57.2224185Z</Expires>
      </q1:Timestamp>
      <q1:UsernameToken d2p1:Id="_UT2865e12ee8a84c848e8324a1ff002591" xmlns:d2p1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <q1:Username>some-user</q1:Username>
        <q1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">some-password</q1:Password>
      </q1:UsernameToken>
    </q1:Security>
  </q1:Header>
  <q1:Body>
    <q1:IsAlive xmlns:q1="http://service.company.com" />
  </q1:Body>
</q1:Envelope>

ConfigureAwait(false)

Since this isn't a library with requirements to be used in specific threads from the pool, the method ConfigureAwait(false) should be used.

Unable to run even the sample

Hi everyone
I would like to understand if I'm the only one experiencing this issue, preventing me from using the library at all. At some point I even copied the sample code, and it still doesn't work

SoapEnvelope responseEnvelope;
try
{
	string clearTextCredentials = string.Format("{0}:{1}", SAP_USERNAME, SAP_PASSWORD);
	client.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes(clearTextCredentials)));
	responseEnvelope =
		await client.SendAsync(
			BASE_URL + ENDPOINT_ZUB_LETTURAEVE_BND,
			"testing",
			new SoapEnvelope()
				.WithHeaders(new TrackingHeader())
				.Body(new CreateUserRequest() { Username = "Prova", Password = "prova" }));
}
catch (SoapEnvelopeSerializationException e)
{
	Debug.WriteLine("Failed to serialize the SOAP Envelope"+e.Message);
}
catch (SoapEnvelopeDeserializationException e)
{
	Debug.WriteLine("Failed to deserialize the response into a SOAP Envelope" + e.Message);
}
catch (Exception e)
{
	Debug.WriteLine("General exception: " + e.Message);
}

Below the stacktrace

  at SimpleSOAPClient.SoapEnvelopeSerializationProvider.ToXmlString (SimpleSOAPClient.Models.SoapEnvelope envelope) [0x0005a] in <42f699401f4c42a2bbfcc53c5849d324>:0 
  at SimpleSOAPClient.SoapClient+<SendAsync>d__20.MoveNext () [0x00136] in <42f699401f4c42a2bbfcc53c5849d324>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <3fd174ff54b146228c505f23cf75ce71>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <3fd174ff54b146228c505f23cf75ce71>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <3fd174ff54b146228c505f23cf75ce71>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <3fd174ff54b146228c505f23cf75ce71>:0 
  at BocconiNetworkServices.Networking.SAPService+<prova2>d__12.MoveNext () [0x000f2] in C:\BocconiDeskApp\BocconiNetworkServices\Networking\SAPService.cs:54 

Please note I'm using SimpleSoapClient in a PCL project.
image 4

thanks
nicola

SOAP Security - Timestamps not in UTC

The SOAP Security Timestamp dates are not being passed in UTC using the method KnownHeader.Oasis.Security.UsernameTokenAndPasswordText(username, password, mustUnderstand)

XML snippet:

<?xml version="1.0" encoding="utf-16"?>
<q1:Envelope xmlns:q1="http://schemas.xmlsoap.org/soap/envelope/">
  <q1:Header>
    <q1:Security d1p1:mustUnderstand="1" xmlns:d1p1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <q1:Timestamp Id="_TSc6f62dcfa7a6428a8db194856947260a">
        <Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-05-18T12:35:14.598977+01:00</Timestamp>
        <Expires xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-05-18T12:50:14.598977+01:00</Expires>
      </q1:Timestamp>
      <q1:UsernameToken d2p1:Id="_UTc6f62dcfa7a6428a8db194856947260a" xmlns:d2p1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <q1:Username>...</q1:Username>
        <q1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">...</q1:Password>
      </q1:UsernameToken>
    </q1:Security>
  </q1:Header>
  <q1:Body>
    ...
  </q1:Body>
</q1:Envelope>

Soap message response with bytes

Hi there,

I'm trying to use this amazing library for a project that I'm converting from .NET Framework to .NET6.
I'm able to communicate with the original WebService, but the current client (I mean the one done in .NET Framework) returns a byte[] instead of an XmlNode[].

Could you help me to handle this, please?

Usage in a Xamarin.Forms projects

Hi everyone
I'm trying to use this library in a Xamarin.Forms project.
Specifically, I tried:

PCL project, referenced from Xamarin.Android + Xamarin.UWP project => strange invocation issues arises
image 4

Xamarin.Android project only (unable to install nuget)
image 3

Is this supposed to happen or am I doing something wrong?

thanks
nicola

System.NullReferenceException

Hi,

I keep getting a NullReferenceException exception when I use the DelegatingSoapHandler.

System.NullReferenceException: Object reference not set to an instance of an object.
at SimpleSOAPClient.Handlers.DelegatingSoapHandler.d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at SimpleSOAPClient.SoapClient.d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at SimpleSOAPClient.SoapClient.<SendAsync>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()

.WithHandler(new DelegatingSoapHandler { Order = int.MaxValue, // Will be the last handler before the request and the first after the response OnHttpRequestAsyncAction = async (c, args, cnt) => { Logger.Trace( "SOAP Outbound Request [{0}] -> {1} {2}({3})\n{4}", args.TrackingId, args.Request.Method, args.Url, args.Action, await args.Request.Content.ReadAsStringAsync()); }, OnHttpResponseAsyncAction = async (c, args, cnt) => { Logger.Trace( "SOAP Outbound Response [{0}] -> {1}({2}) {3} {4}\n{5}", args.TrackingId, args.Url, args.Action, (int)args.Response.StatusCode, args.Response.StatusCode, await args.Response.Content.ReadAsStringAsync()); } })

Without it, everything runs fine.

XML Serialization providers

To be able to use custom XML serializers, the framework should provide a way to swap the current (de)serialization logic.

Soap message structure

I am porting an old .net framework app to .net core. This old app uses fedex web services (soap interface) to retrieve tracking information.

Fedex expects a message with the following structure:

<TrackRequest xmlns="http://fedex.com/ws/track/v10">
<WebAuthenticationDetail>
<ParentCredential>
<Key>MY KEY </Key>
[...]
<ProcessingOptions>INCLUDE_DETAILED_SCANS</ProcessingOptions>
</TrackRequest>

Your library generates the following code from a SoapEnvelope.Prepare().Body() call:

<q1:TrackRequest xmlns:q1="http://fedex.com/ws/track/v10">
<q1:WebAuthenticationDetail>
<q1:ParentCredential>
[...]
<q1:ProcessingOptions>INCLUDE_DETAILED_SCANS</q1:ProcessingOptions>
</q1:TrackRequest>

When I attempt to send it to get a reply (via soapclient.send()) Fedex returns the following error:

validation failure for TrackRequest Error:cvc-elt.1: Cannot find the declaration of element 'q1:TrackRequest'.

The message structure appears to be identical with the exception of the q1: prefix...

I can send the upper portion (w/o the q1: prefix) to fedex via a HttpWebRequest and then parse the reply I get, but its a bit of a hack and your library is cleaner.

Is there a way to prevent the SoapEnvelope methods from inserting this q1 prefix so the Body mimicks what fedex expects?

Thanks.

SoapEnvelopeDeserializationException: The response content is empty

Hi,

I keep getting a
{SimpleSOAPClient.Exceptions.SoapEnvelopeDeserializationException: The response content is empty.
at SimpleSOAPClient.SoapClient.SendAsync(String url, String action, SoapEnvelope requestEnvelope, CancellationToken ct)
at TestWCFBinding.Controllers.ValuesController.Get()}

image

and this is my simple wcf operation

    [OperationContract]
    bool IsAlive();

please advise,
thanks

Cannot publish Console app as executable if it depends on SimpleSoapClient

If I try to run
dotnet publish --configuration Release --self-contained --runtime win-x64
Lot of errors similar to:
Mine.Internal.Library.csproj : error NU1605: Mine.Internal.Library -> ProfilZaufany 1.0.3-alpha -> SimpleSOAPClient.BinarySecurityToken 1.0.2-alpha -> SimpleSOAPClient 2.0.0-rc04 -> System.Xml.XmlSerializer 4.0.11 -> System.Xml.ReaderWriter 4.0.11 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.IO.FileSystem.Primitives (>= 4.3.0)
appears.
I'm trying to build .net standard 2.0 app.

Issue with using multiple Namespaces

Good Afternoon, Hopefully you can help.

I have the below XML, as you can see it has 2 namespaces, I need to get Heartbeat and doCallBackend to include the ns name space, But I cannot figure out how to do so , I cannot just set the name space of HeartBeat as the service I am consuming does not support it.

My XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.brightstar.com/services/2017">
   <soapenv:Header>
      <Username>system</Username>
      <Password>XXXXXXX</Password>
      <ApplicationID>XXXXXXX</ApplicationID>
   </soapenv:Header>
   <soapenv:Body>
      <Heartbeat>
         <doCallBackend>false<doCallBackend>
      <Heartbeat>
   </soapenv:Body>
</soapenv:Envelope>

required valid XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.brightstar.com/services/2017">
   <soapenv:Header>
    <Username>system</Username>
    <Password>XXXXXXX</Password>
    <ApplicationID>XXXXXXX</ApplicationID>
  </soapenv:Header>
   <soapenv:Body>
      <ns:HeartBeat>
         <ns:doCallBackend>false</ns:doCallBackend>
      </ns:HeartBeat>
   </soapenv:Body>
</soapenv:Envelope>

Any help would be greatly appreciated!

Support for .net core 2.2

Hi,

Are there anyways to use this module for .net core 2.2? Can I just download the source code and compile it to 2.2 myself?

How to use SimpleSOAPClient to consume Web Service (asmx) from .NET Core Web API?

We are currently working over WEBAPI in ASP.NET core. Our requirement is to consume .NET based Webservice (asmx) from Web API.

I have web service method which has two input parameters.

GetEmployees(string name,string department)

How should I move ahead ?

I tried your example code but its giving me some issues.

Please help.

Cannot Debug Code with sample Usage

Hello ,

When i try to Debug with sample Usage on main page it gives an error:
" SoapClient' does not contain a definition for 'OnSerializeRemoveXmlDeclaration' and no extension method 'OnSerializeRemoveXmlDeclaration' accepting a first argument of type 'SoapClient' could be found"

What did i miss? The project is .Net Core 2.0 based

Can't install nuget on .net fx 4.5

Hi graty00
When I install from nuget, it throw this error:
PM> Install-Package SimpleSOAPClient -Pre
Attempting to gather dependencies information for package 'SimpleSOAPClient.2.0.0-rc03' with respect to project 'TranzwareAPI', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for package 'SimpleSOAPClient.2.0.0-rc03' with DependencyBehavior 'Lowest'
Resolving actions to install package 'SimpleSOAPClient.2.0.0-rc03'
Resolved actions to install package 'SimpleSOAPClient.2.0.0-rc03'
Adding package 'SimpleSOAPClient.2.0.0-rc03' to folder 'D:\Windows7\TranzwareAPI\packages'
Added package 'SimpleSOAPClient.2.0.0-rc03' to folder 'D:\Windows7\TranzwareAPI\packages'
Install failed. Rolling back...
Package 'SimpleSOAPClient 2.0.0-rc03' does not exist in project 'TranzwareAPI'
Removing package 'SimpleSOAPClient 2.0.0-rc03' from folder 'D:\Windows7\TranzwareAPI\packages'
Removed package 'SimpleSOAPClient 2.0.0-rc03' from folder 'D:\Windows7\TranzwareAPI\packages'
Install-Package : Failed to add reference to 'System.Runtime'. Please make sure that it is in the Global Assembly Cache.
At line:1 char:1

  • Install-Package SimpleSOAPClient -Pre
  • - CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    - FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
    

Support SOAP 1.2 requests

The handler "UsingRequestRawHandler" should support requests on SOAP 1.2 as the following example:

"
.UsingRequestRawHandler((c, d) =>
{
d.Request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/soap+xml;charset=UTF-8;action="http://domain.com/Service/Request\"");
})
"

Regards,
Filipe Dias

Factory interfaces for Soap Clients

Add a factory interface (and a possible implementation) for Soap Client instances. This is specially useful when using Inversion of Control libraries, to control client life-cycle.

Install-Package SimpleSOAPClient in old Projects - Error

image

The package 'SimpleSOAPClient' tried to add a framework reference to 'System.Runtime' which was not found in the GAC.

This bug can be solved with following code in project.json:
"
.....
".NETPortable,Version=v4.5,Profile=Profile111": {
"buildOptions": {
"define": [ "PORTABLE45" ]
},
"frameworkAssemblies": {
"mscorlib": "",
"System": { "type": "build" },
"System.Collections": { "type": "build" },
"System.Core": { "type": "build" },
"System.IO": { "type": "build" },
"System.Linq": { "type": "build" },
"System.Net.Http": { "type": "build" },
"System.Runtime": { "type": "build" },
"System.Text.Encoding": { "type": "build" },
"System.Threading": { "type": "build" },
"System.Threading.Tasks": { "type": "build" },
"System.Xml": { "type": "build" },
"System.Xml.Linq": { "type": "build" },
"System.Xml.ReaderWriter": { "type": "build" },
"System.Xml.XDocument": { "type": "build" },
"System.Xml.XmlSerializer": { "type": "build" }
}
},
"net4.5": {
"frameworkAssemblies": {
"System.IO": { "type": "build" },
"System.Linq": { "type": "build" },
"System.Net.Http": { "type": "build" },
"System.Runtime": { "type": "build" },
"System.Xml": { "type": "build" },
"System.Xml.Linq": { "type": "build" },
"System.Xml.XDocument": { "type": "build" },
"System.Xml.XmlSerializer": { "type": "build" }
}
},
....
"

References:
NuGet/Home#3103
dotnet/aspnetcore#1157

OASIS WS Header

Hello, I would like to contribute by adding support for WS Security with UserNameToken, Password Digest and NONCE. Which branch should i choose as a base?

SOAP Security - Timestamp - Property Created serialized as an element named Timestamp

The property Timestamp.Created is being serialized as an element named Timestamp instead of Created.

Example:

<?xml version="1.0" encoding="utf-16"?>
<q1:Envelope xmlns:q1="http://schemas.xmlsoap.org/soap/envelope/">
  <q1:Header>
    <q1:Security d1p1:mustUnderstand="1" xmlns:d1p1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <q1:Timestamp Id="_TSc6f62dcfa7a6428a8db194856947260a">
        <Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-05-18T12:35:14.598977+01:00</Timestamp>
        <Expires xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-05-18T12:50:14.598977+01:00</Expires>
      </q1:Timestamp>
      <q1:UsernameToken d2p1:Id="_UTc6f62dcfa7a6428a8db194856947260a" xmlns:d2p1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <q1:Username>...</q1:Username>
        <q1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">...</q1:Password>
      </q1:UsernameToken>
    </q1:Security>
  </q1:Header>
  <q1:Body>
    ...
  </q1:Body>
</q1:Envelope>

Support MTOM attachments

I need support to receiving MTOM attachments from a service I'm calling; I'm going to look at submitting a PR for this.

Any advice on where to start implementing this? My current thinking is to add an Attachments property to the SoapEnvelope and to intercept multipart responses in SoapClient.SendAsync; extract the attachments and add them to the envelop and then continue processing the SOAP content as happens now.

Cheers,
JB

Pre-emptive basic HTTP authentication

Hi everyone
does anyone know how to get pre-emptive Basic HTTP authentication working with SimpleSOAPClient?
If it's not supported explicitly, it should be enough to wrangle the HTTP headers, adding "Authorization: base64encode(user:password)".

Having access to the underlying HttpClient, it should be a matter of

HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password1234");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

thanks
nicola

Unable to call services defined with soapAction=""

Hi,

A (poorly designed) service i need to integrate defines it's soapAction to "".

It seems valid wsdl, but SoapHandlerArguments constructor throws an argumenNullException if action is string.IsNullOrWhiteSpace().

Replacing check with if (action == null) seems to work fine ...

Update readme

This sample code not work with RC3, please update.

Thanks

When using async handlers the sync method is not invoked

When extending an ISoapHandler or one of the extending helper classes (DelegatingSoapHandler or SoapHandler), when creating code for both async and sync methods, only the asyncs are invoked.

Example:

new DelegatingSoapHandler
{
    OnHttpRequestAction = (c, args) =>
    {
        // will not be invoked
    },
    OnHttpRequestAsyncAction = async (c, args, ct) =>
    {
        // will be invoked
        await Task.Sleep(0, ct);
    }
}

The methods used in the sample are absent

Hello,
I can’t run the sample in any way. The methods used in it are not found in the source code.

I work around these problems but I still haven’t been able to assign my header for the envelope.

What am I doing wrong?

I'm trying to use the SimpleSoapClient in a .NETCoreApp 1.1 project

Bind a client to a SOAP address

The client is currently stateless since the Send method receives the URL, action and envelope. Since the client is usually used to communicate with a single SOAP server, always sending the URL is redundant.

Possible solution: create a wrapper that always uses the same URL

using(var client = SoapClient.Connect("<server url>"){
    client.Send("<action>", envelope);
} 

New version

Hi, in nuget currently is 2.0.0 RC3 version in DEBUG Mode?
I use your solution in my uwp application and i need Release mode. When you plan to sent new version of SimpleSOAPClient (Release Mode) to nuget repository?

Improve handler logic

Using functions as handlers have limitations. As examples, deciding the order or paring raw request handler with a raw response handler.

Suggestion: create a ISoapClientHandler exposing all the possible operations and a base interface where only specific methods can be overridden.

EnvelopeHelpers.Body skips Namespace information

If I there is a class

[XmlRoot("SomeMessage", Namespace= "http://foo.com")]
public class Message
{
     [XmlElement("field")]
    public string Property { get;set; }
}

and then I I will execute

var envelope = SoapEnvelope
    .Prepare()
    .Body(new Message { Property = "bar" });
await client.SendAsync("someUrl", "someAction", envelope);

sent message would look like this

<q1:Envelope xmlns:q1="http://schemas.xmlsoap.org/soap/envelope/">
    <q1:Header/>
    <q1:Body>
        <q1:SomeMessage>
             <q1:field>bar</q1:field>
        </q1:SomeMessage>
    </q1:Body>
<q1:Envelope>

but it should look like this

<q1:Envelope xmlns:q1="http://schemas.xmlsoap.org/soap/envelope/">
    <q1:Header/>
    <q1:Body>
        <q2:SomeMessage xmlns:q2="http://foo.com">
             <q2:field>bar</q2:field>
        </q2:SomeMessage>
    </q1:Body>
<q1:Envelope>

It is caused by using EmptyXmlSerializerNamespaces in XmlHelpers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.