[QUESTION] Regex with XML in request.file and response.file
See original GitHub issueWe’re using Stubby4J to mock a SOAP API but we’re having issues extracting values from the request and injecting them into the response.
The stub config is similar to the following (removed project specific naming):
- request:
method: POST
url: /path/SomeService
file: ./requests/ExpectedRequestFormat.xml
response:
status: 200
headers:
content-type: application/xml
file: ./data/SomeServiceResponse.xml
In ExpectedRequestFormat.xml
we have multiple instances of the following:
<ns:SomeElement>${xmlunit.matchesRegex(.*)}</ns:SomeElement>
And in SomeServiceResponse.xml
we have:
<ns:SomeOtherElement><% file.1 %></ns:SomeOtherElement>
We have also tried the following:
<ns:SomeOtherElement><% post.1 %></ns:SomeOtherElement>
<ns:SomeOtherElement><% request.file.1 %></ns:SomeOtherElement>
<ns:SomeOtherElement><% request.post.1 %></ns:SomeOtherElement>
However the response is always the raw XML file with no injection of values.
Any ideas what we are doing wrong?
Issue Analytics
- State:
- Created 2 years ago
- Comments:20 (12 by maintainers)
Top Results From Across the Web
Need Regex pattern to extract xml request and responses ...
I have a log file with multiple xml requests and responses. I need to parse each set request/responses. With my limited regex experience, ......
Read more >Define regular expressions in XML files - IBM
You can define regular expressions for input validation in separate XML files. Reference to these regular expressions can be used in multiple data...
Read more >Insert Lines after Multi-Line Regex Match - Unix Stack Exchange
The reason I need to do multiline matching is because the <dict> tag is used frequently within the XML file and I need...
Read more >4. Pattern Matching with Regular Expressions - Java ... - O'Reilly
I used the pattern main(String [a-z] with the grep utility described earlier to find the names of all the files containing old-style main...
Read more >Everything you need to know about Regular Expressions
After reading this article you will have a solid understanding of what regular expressions are, what they can do, and what they can't...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@itsjxck, just FYI:
stubby4j
Docker images that uselog4j2
and that were affected as a result of recent log4j2 vulnerabilities: CVE-2021-44228 and CVE-2021-45046 (i.e.:latest
and <=v7.5.0
) have been re-built as part of the mitigation effort captured by the following ticket https://github.com/azagniotov/stubby4j/issues/416@itsjxck , I pushed
azagniotov/stubby4j:7.5.0-jre11
, in case if you want to be fixed to a specific tag. It has all the behavior we tested, and some more (all of that was in themaster
already anyways): https://github.com/azagniotov/stubby4j/blob/master/docs/CHANGELOG.md#750Cheers