-
Notifications
You must be signed in to change notification settings - Fork 4
feat: adds SOAP support to proxy recorder #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: adds SOAP support to proxy recorder #82
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main outofcoffee/imposter Docker images include the CLI already.
You can extend from them and run imposter <some command> within your container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that, i should remove the self Dockerfile included in project due to is in main outofcoffe/imposter project.
Was not so clear for me how the different projects are joined between them, u usually works in maven projects multimodule or angular "monorepo" solutions, but it is my first experience mergering go parts and kotlin parts.
| if options.Soap11Mode { | ||
| // In SOAP mode, use SOAPAction + path for uniqueness | ||
| soapAction := extractSoapAction(exchange.Request) | ||
| requestHash = getRequestHash(exchange.Request) + "_" + soapAction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to extend the getRequestHash function to be a variadic function and take one or more strings to include in the hash computation. In SOAP mode, we can pass the SOAPAction, and nothing in the normal case.
| } | ||
| } | ||
| resource.RequestHeaders = &headers | ||
| } else if options.Soap11Mode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we rework this if..else if block to be:
if len(req.Header) > 0 {
if options.CaptureRequestHeaders {
// existing logic
} else if options.Soap11Mode {
// new logic
}
}
| ignoreDuplicateRequests bool | ||
| recordOnlyResponseHeaders []string | ||
| flatResponseFileStructure bool | ||
| soap11Mode bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's name this soapMode with the flag --soap since it supports both SOAP 1.1 and 1.2.
| recordOnlyResponseHeaders []string | ||
| flatResponseFileStructure bool | ||
| soap11Mode bool | ||
| insecure bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's name this insecureHttps with flag --insecure-https to clarify what we mean by insecure.
| "strings" | ||
| ) | ||
|
|
||
| // extractSoapAction extracts the SOAPAction header from the request or Content-Type action parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could we have a unit test just for extractSoapAction in a files_test.go for this?
|
Hi @clx-jlmoreno, thank you for raising this PR. |
Add SOAP 1.1/1.2 Proxy Enhancement with Action-Based Differentiation
Summary
This PR adds SOAP-aware proxy capabilities to the Imposter CLI, enabling proper capture and differentiation of SOAP 1.1 and 1.2 requests based on their SOAPAction header or action attribute.
Changes
the same endpoint
Usage Examples
shell
SOAP 1.1/1.2 proxy
imposter proxy --soap1.1 http://soap-service.example.com/service
Skip TLS verification for HTTPS endpoints
imposter proxy --insecure https://soap-service.example.com/service
This will capture SOAP requests and generate separate response files for each SOAP action, rather than overwriting the same endpoint file.
Note on Dockerfile
A Dockerfile has been included in this PR as we weren't certain about the official image publishing process for Imposter. If this conflicts with your existing build pipeline or is unnecessary,
please feel free to remove it or provide guidance on the preferred approach.
Testing
All existing tests pass, and new tests have been added to verify SOAP action extraction and proxy recording behavior.