How to use SOAP in Rust?

Hello

I am searching for a SOAP-client in Rust like this one in PHP.

I have stumbled on a few (seemingly) outdated projects:

But they don't really provide what I am searching for... In the PHP example you can format SOAP-requests by calling the constructor like so:

new SoapClient('http://api.example.net/soap/' . $soap_service . '?wsdl', array('trace' => true, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9));

I do not see that possibility in the two Rust-libraries... Is there a Rust-library to use SOAP without those extremely ugly WSDL files?

Thanks.

If someone is searching for the same answer, take a look at this thread: Code for a SOAP-API client

I wrote my own. Basically I do the following:

<?xml version="1.0"?>

                <soap:Envelope
                xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
                soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

                    <soap:Header>
                       // STRING REPLACE SOAP HEADER HERE
                    </soap:Header>

                    <soap:Body>
                      // STRING REPLACE SOAP BODY WITH COMMANDS/PROCEDURES HERE
                    </soap:Body>

                </soap:Envelope>

And send that string as a POST-request to the API using reqwest.

That would be e.g. Reqwest — WebAssembly in Rust // Lib.rs . The point of SOAP is those WSDL files, which describes the actual end points, so you can build a native Rust front-end to the actual API, rather than a generic http client.

That said, the reason that the Rust SOAP projects seems to be going slow is probably that the more modern way of doing that with RESTfull apis and openapi specifications ("swagger files") is taking over and fewer APIs is still using SOAP.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.