soapmock/README.md
2021-04-08 20:55:32 +01:00

1.3 KiB

SOAPMOCK

This is a demo springboot project, that shows how you can emulate the behavior of a soap web service as a black box. I have written it to be compatible with Java 1.8. So, it should work well with older systems.

Build:

mvn clean install

Run:

mvn spring-boot:run

The server will start on http://localhost:8080

Configure your client (Postman, Insomnia, or whatever) to send this body in a POST to url /call1:

<?xml version = "1.0"?>
<SOAP-ENV:Envelope
        xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
        SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">

    <SOAP-ENV:Body xmlns:m = "http://www.xyz.org/quotations">
        <m:GetQuotation>
            <m:QuotationsName>MicroSoft</m:QuotationsName>
        </m:GetQuotation>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

You should get this in response:

<?xml version = "1.0"?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
        SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">
  <SOAP-ENV:Body
    xmlns:m = "http://www.xyz.org/quotations">
    <m:GetQuotationResponse>
      <m:Quotation>Here is the quotation</m:Quotation>
    </m:GetQuotationResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>