HodStudio / XitSoap

An alternative way to do SOAP Requests without use the WSDL
MIT License
11 stars 3 forks source link

Create new parameter SoapActionComplement #3

Closed panmona closed 6 years ago

panmona commented 6 years ago

I'm trying to use your library for my case but I get 500 - Internal Server Error when executing the code.

var webService = new WebService("https://webservice.ourcompany.com/QuotaDistributionService/QuotaDistributionService.svc",
"http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0/IQuotaDistributionService");

var result = webService.Invoke("IsAlive");

I inspected the request headers with Fiddler by Telerik.

This is the request header named "SoapAction" that gets added with the code above:

SOAPAction: "http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0/IsAlive"

And this is the request header when I make the call from SoapUI (with the XML body generated by the library):

SOAPAction: "http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0/IQuotaDistributionService/IsAlive"

How can I change the SOAPAction to the one that gets generated from the SoapUI? / How can I get the request to work?

Cussa commented 6 years ago

Hello @maracuja-juice

Can you confirm that the namespace is how you putted here? Because I create the class the way that you sent, and the SOAPAction is correct on debug.

image

Can you confirm please what is the version that you are using too?

panmona commented 6 years ago

Hello @Cussa

Ah you're right. Pasted the wrong namespace. The actual namespace I have is: http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0

Cussa commented 6 years ago

Hello @maracuja-juice

Just to be sure: your problem is fixed or you want some way to have a "generic" Namespace and add more info depending on the method that you are calling?

I'm asking because if you putted the "correct" namespace, it will work.

panmona commented 6 years ago

Hello @Cussa

No the problem isn't solved.

If I put the namespace like in my initial question I still get the error 500. As then the SOAPAction is correct but the Envelope in the body isn't. If I then send the generated Envelope with the SOAPUi I would also get an error 500.

Cussa commented 6 years ago

Hello @maracuja-juice

Can you provide me, please, the info that XitSoap is sending on the Envelope and the comparison with the SOAP Ui?

panmona commented 6 years ago

When I put IQuotaDistributionService into the namespace this is the Envelope of XitSoap:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <IsAlive xmlns="http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0/IQuotaDistributionService">
        </IsAlive>
    </soap:Body>
</soap:Envelope>

And this is the Envelope the SoapUI generates when I add a new request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns="http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:IsAlive/>
   </soapenv:Body>
</soapenv:Envelope>
Cussa commented 6 years ago

Ok. This was some point that I didn't imagine.

What happen is that the Namespace should be http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0, but the SOAPAction should have the interface information.

For one point, makes some sense that I should keep the namespace how it is and implement a new information about the SOAPAction complement.

I'll do that and release a new version.

panmona commented 6 years ago

Sounds good. Will be happy to try it out when you finished that.

Cussa commented 6 years ago

@maracuja-juice

I already pushed a beta version to nuget. Please, test if everything is ok. Use please the following way:

`var webService = new webService("https://webservice.ourcompany.com/QuotaDistributionService/QuotaDistributionService.svc", "http://schemas.ourcompany.com/Ourcompany.Services.QuotaDistributionService/2.0");

webService.Invoke("IsAlive", "IQuotaDistributionService");`

Version 2.1.0-beta is online on nuget and I pushed the code to the repository.

Please, when you test it, give me feedback if it works perfectly to you.

Thanks for the feedback!

panmona commented 6 years ago

That was fast! Thanks. I need to try it out today and will give you feedback.

panmona commented 6 years ago

Works great!

Cussa commented 6 years ago

Perfect! I'll try to put the Authentication on the version 2.1.0 and release it on the weekend as stable, if everything works perfectly!