https://github.com/specmatic/specmatic-order-bff-wsdl
Sample project to demonstrate Specmatic WSDL support to Mock and Test services based on WSDL files
https://github.com/specmatic/specmatic-order-bff-wsdl
Last synced: about 1 year ago
JSON representation
Sample project to demonstrate Specmatic WSDL support to Mock and Test services based on WSDL files
- Host: GitHub
- URL: https://github.com/specmatic/specmatic-order-bff-wsdl
- Owner: specmatic
- License: mit
- Created: 2025-01-28T05:55:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-02T05:52:58.000Z (about 1 year ago)
- Last Synced: 2025-06-02T07:34:47.657Z (about 1 year ago)
- Language: Kotlin
- Homepage:
- Size: 1.73 MB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.md
Awesome Lists containing this project
README
# WSDL Java Sample Project
## Architecture
### Production Setup
```
+-------------------+ +--------------------------+ +-------------------+
| | | | | |
| WSDL SOAP Client | | Product BFF Search | | order_api |
| | | Service (BFF) | | (WSDL Service) |
+---------+---------+ +-----------+--------------+ +---------+---------+
| | |
| 1. Request (SOAP) | |
+------------------------------>| |
| | |
| | 2. Request (SOAP) |
| +--------------------------------->|
| | |
| | 3. Response (SOAP)|
| |<---------------------------------+
| 4. Response (SOAP) | |
+<------------------------------+ |
```
### Contract Test Setup
```
+-------------------------+ +--------------------------+ +----------------------+
| | | | | |
| Specmatic Contract Test | | Product BFF Search | | Specmatic Mock |
| (WSDL of BFF) | | Service (BFF) | | (WSDL of order_api) |
+-----------+-------------+ +-----------+--------------+ +----------+-----------+
| | |
| 1. Request (SOAP) | |
+---------------------------------->| |
| | |
| | 2. Request (SOAP) |
| +---------------------------------->|
| | |
| | 3. Response (SOAP) |
| |<----------------------------------+
| 4. Response (SOAP) | |
+<----------------------------------+ |
|
|--------------------+
| 5. Assert response |
| against WSDL spec |
+<-------------------+
```
## Running Contract Test and Mock Programmatically
Please refer to [ContractTest.kt](src/test/kotlin/com/component/orders/ContractTest.kt)
Once you run the test the report should be available at `build/reports/specmatic/html/index.html`.
## Running the Specmatic WSDL Mock Server from Command Line using Docker
```shell
docker run -p "8090:9000" -v "$(pwd):/usr/src/app" znsio/specmatic stub "./wsdls/order_api.wsdl"
```
OR
```shell
java -jar specmatic.jar stub --port 8090 ./wsdls/order_api.wsdl
```
Now we can verify if the stub server is running
1. Open SOAPUI
2. Import the wsdl in `wsdls/order_api.wsdl`
3. Remember to set the endpoint URL to host `localhost` and port `8090`
4. Send the following request using SOAPUI:
```xml
123
1
```
And you should get a response like this:
```xml
10
```
As you can notice, id `10` is returned only when the `productid` is `123` and `count` is `1`. This response is based on example file [`create_order.json`](wsdls/order_api_examples/create_order.json).
Please refer to documentation for format of the [example file](https://docs.specmatic.io/documentation/soap.html#examples-as-mock-data).
You can also run the same WSDL spec as a test against the mock server.
```shell
docker run --net host -v "$(pwd):/usr/src/app" znsio/specmatic test "./wsdls/order_api.wsdl" --port 8090
```
The HTML API Coverage Report will be available at `build/reports/specmatic/html/index.html`.