You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/08/10 14:57:41 UTC
(axis-axis2-c-core) 07/13: Document how to test SOAP, and correct the JSON-centric framing
This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git
commit a0cfe72c27fa724d06b7b917d90b037624c36181
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Sun Aug 9 12:33:15 2026 -1000
Document how to test SOAP, and correct the JSON-centric framing
Most recent work here targets JSON over HTTP/2 and the guidance had followed
it, which is misleading: Axis2/C is twenty years old, most installations run
SOAP, and most security findings land on SOAP paths.
Adds docs/userguide/soap-testing-guide.md and points AGENTS.md at it. The guide
is organised around the setup traps rather than the happy path, because each
one produces a symptom that reads as "SOAP is broken" while being a
configuration mistake:
- samples/server/axis2.xml ships its transportReceiver commented out, since
it is written for the Apache module. Handing it to the standalone server
NULL-derefs at transport_in_desc.c:197.
- A service directory copied into services/ is not necessarily registered.
Requests to an unregistered service are answered by the JSON error handler,
which looks like SOAP being rejected and is not.
- build_for_tests.sh begins with make distclean and will destroy an existing
configuration.
- The build-tree axis2_http_server is a libtool wrapper; debuggers need the
ELF binary in .libs/.
Also records that both front ends handle SOAP, and that the JSON processor in
apache2_worker.c is selected at runtime by is_json_http2_request() rather than
compiled in unconditionally -- the absence of an AXIS2_JSON_ENABLED guard
around it says nothing about whether SOAP is available.
Co-Authored-By: Claude Fable 5 <no...@anthropic.com>
---
AGENTS.md | 20 ++++
docs/userguide/soap-testing-guide.md | 178 +++++++++++++++++++++++++++++++++++
2 files changed, 198 insertions(+)
diff --git a/AGENTS.md b/AGENTS.md
index 42ce8a74c..566f40260 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -15,6 +15,26 @@ See [SECURITY.md](SECURITY.md) for the full threat model, including:
For detailed deployment hardening, see [docs/SECURITY.md](docs/SECURITY.md).
+## SOAP is the majority deployment
+
+Recent work here targets JSON over HTTP/2, and the scan areas below reflect
+that. It is not the whole picture: Axis2/C is twenty years old and most
+installations run SOAP, so most security findings land on SOAP paths. Weight
+them accordingly rather than treating HTTP/2 JSON as the only live surface.
+
+Both front ends handle SOAP. The JSON processor in `apache2_worker.c` is chosen
+at runtime by `is_json_http2_request()`, not compiled in unconditionally — the
+absence of `#ifdef AXIS2_JSON_ENABLED` around it does not mean SOAP was compiled
+out.
+
+Before testing anything SOAP, read
+[`docs/userguide/soap-testing-guide.md`](docs/userguide/soap-testing-guide.md).
+It records the setup traps that each produce a symptom reading as "SOAP is
+broken" while actually being a configuration mistake — a commented-out
+`transportReceiver` that segfaults the standalone server, an unregistered
+service whose 404 is answered by the JSON error handler, and
+`build_for_tests.sh` running `make distclean` over an existing configuration.
+
## High-Priority Scan Areas
Modern Axis2/C deployments use **HTTP/2 with pure JSON** — not HTTP/1.1
diff --git a/docs/userguide/soap-testing-guide.md b/docs/userguide/soap-testing-guide.md
new file mode 100644
index 000000000..df8ab954d
--- /dev/null
+++ b/docs/userguide/soap-testing-guide.md
@@ -0,0 +1,178 @@
+# Testing SOAP in Axis2/C
+
+Most recent development here targets JSON over HTTP/2, and the documentation
+reflects that. SOAP is still what the majority of deployments run, and most
+security work lands on the SOAP paths, so this describes how to exercise them
+without walking into the traps that make SOAP *look* broken when it is not.
+
+Everything below was learned by getting it wrong first. The failure modes are
+recorded alongside the fixes because each one produces a symptom that reads as
+"SOAP is broken" while actually being a setup mistake.
+
+## SOAP works on both transports
+
+Both HTTP front ends handle SOAP. This is worth stating because the JSON
+processor is prominent enough in `apache2_worker.c` to look like it has taken
+over:
+
+| Front end | Worker | SOAP handling |
+|---|---|---|
+| Apache httpd (`mod_axis2`) | `apache2_worker.c` | yes |
+| Standalone `axis2_http_server` | `http_worker.c` | yes |
+
+The JSON processor in the Apache worker is selected **at runtime**, not at
+compile time:
+
+```c
+request_processor = axis2_apache2_request_processor_factory_create(env, request);
+if (request_processor)
+{
+ if (axis2_apache2_request_processor_is_json_http2_request(request) ||
+ strstr(request_processor->get_protocol_id(request_processor, env), "JSON"))
+```
+
+A SOAP request matches neither branch and falls through to the SOAP path. The
+absence of `#ifdef AXIS2_JSON_ENABLED` around that call means the factory is
+always *compiled in*, not that it always *runs*. Do not conclude from a grep for
+`AXIS2_JSON_ENABLED` that SOAP has been compiled out.
+
+## Trap 1: the sample axis2.xml has no HTTP receiver
+
+`samples/server/axis2.xml` ships with the transport receiver commented out,
+because that file is written for the Apache module where Apache *is* the
+receiver:
+
+```xml
+<!--transportReceiver name="http" class="axis2_http_receiver">
+ <parameter name="port" locked="false">6060</parameter>
+</transportReceiver-->
+```
+
+Hand that config to the standalone server and it looks up its receiver, gets
+NULL, and dereferences it:
+
+```
+#0 axis2_transport_in_desc_get_recv (transport_in=0x0, ...) at transport_in_desc.c:197
+#1 axis2_http_server_create (...) at http_receiver.c:174
+```
+
+That crash is a missing `<transportReceiver>`, not a broken server. Uncomment
+the block before using this config standalone. (`http_receiver.c:174` could
+usefully check for NULL and report the real problem; until it does, recognise
+the backtrace.)
+
+## Trap 2: a service directory is not a deployed service
+
+Copying a service directory into `services/` and reloading does not necessarily
+register it. **Always confirm registration before drawing any conclusion about
+SOAP**, by fetching the listing:
+
+```bash
+curl -s http://<host>/services | grep -i '<service'
+```
+
+An empty "Deployed Services" list means nothing is deployed, whatever is on
+disk. A request to an unregistered service is answered by the JSON error
+handler:
+
+```json
+{"error":{"code":400,"message":"Invalid JSON format","type":"HTTP2_JSON_ERROR"}}
+```
+
+That response says the service was not found. It does **not** say SOAP was
+rejected, and mistaking the two is the easiest way to conclude the stack is
+JSON-only when it is not.
+
+## Trap 3: `build_for_tests.sh` destroys an existing configuration
+
+It begins with `make distclean`. Never run it in a tree configured for
+something you care about — a cross-compile setup, for instance. Build from a
+clean copy instead:
+
+```bash
+git archive HEAD | tar -x -C /tmp/a2c-soap && cd /tmp/a2c-soap
+```
+
+## Trap 4: the installed binary is a libtool wrapper
+
+`axis2_http_server` in the build tree is a shell script. Debuggers reject it:
+
+```
+"axis2_http_server": not in executable format: file format not recognized
+```
+
+The real ELF binary is in the adjacent `.libs/` directory. Use that under gdb.
+
+## A working SOAP setup
+
+The supported route produces a correct runtime layout; prefer it over
+assembling a repository by hand.
+
+```bash
+# 1. Clean copy, plain build - no --enable-json, no --enable-http2 needed for SOAP
+git archive HEAD | tar -x -C /tmp/a2c-soap
+cd /tmp/a2c-soap
+./autogen.sh
+./configure --prefix=/tmp/a2c-soap/inst
+make -j$(nproc) && make install
+
+# 2. Uncomment the HTTP transportReceiver in the installed axis2.xml (Trap 1)
+
+# 3. Engage addressing only if testing WS-Addressing
+# <module ref="addressing"/>
+
+# 4. Run, and confirm it is actually listening before testing anything
+AXIS2C_HOME=/tmp/a2c-soap/inst LD_LIBRARY_PATH=/tmp/a2c-soap/inst/lib \
+ /tmp/a2c-soap/inst/bin/axis2_http_server -r /tmp/a2c-soap/inst
+ss -ltn | grep 6060
+```
+
+A SOAP request carrying WS-Addressing headers, which is the shape needed for
+anything touching `wsa:ReplyTo` or `wsa:FaultTo`:
+
+```bash
+curl -s -H 'Content-Type: text/xml; charset=UTF-8' \
+ -H 'SOAPAction: "http://ws.apache.org/axis2/c/samples/echoString"' \
+ --data-binary @request.xml http://127.0.0.1:6060/axis2/services/echo
+```
+
+```xml
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <soap:Header>
+ <wsa:To>http://127.0.0.1:6060/axis2/services/echo</wsa:To>
+ <wsa:Action>http://ws.apache.org/axis2/c/samples/echoString</wsa:Action>
+ <wsa:MessageID>urn:uuid:test-1</wsa:MessageID>
+ <wsa:ReplyTo><wsa:Address>http://127.0.0.1:9099/sink</wsa:Address></wsa:ReplyTo>
+ </soap:Header>
+ <soap:Body>
+ <ns:echoString xmlns:ns="http://ws.apache.org/axis2/c/samples"><text>hi</text></ns:echoString>
+ </soap:Body>
+</soap:Envelope>
+```
+
+## Which host to test on
+
+A deployment configured for JSON over HTTP/2 is a poor place to test SOAP: its
+services are JSON, and a SOAP request to a service it does not have produces the
+misleading error above. Build a throwaway standalone server for SOAP work rather
+than reaching for whichever instance happens to be running.
+
+## Unit tests
+
+`test/core/addr/test_addr.cc` covers the addressing data structures and the
+WS-Addressing response endpoint policy. Add cases there rather than building an
+ad-hoc harness — `make check` then runs them for everyone.
+
+```bash
+sh build_for_tests.sh # in a clean copy - see Trap 3
+sh run_tests.sh
+```
+
+## Checklist before reporting "SOAP is broken"
+
+1. Is the service registered? Check the `/services` listing is non-empty.
+2. Is a `<transportReceiver>` configured, for the standalone server?
+3. Is the server actually listening? `ss -ltn`.
+4. Is the failure from the SOAP path, or from the JSON error handler answering
+ for a service that was never found?