Path: redb-route/tests/redb.Route.Tests.Soap/SoapWsdlTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Soap/SoapWsdlTests.cs ---- using System.Net; using System.Net.Sockets; using AwesomeAssertions; using redb.Route.Core; using redb.Route.Soap; using SoapDsl = redb.Route.Soap.Fluent.Soap; namespace redb.Route.Tests.Soap; /// /// WSDL publishing (camel-cxf ?wsdl parity): a consumer with a configured WSDL serves it on GET, with /// the soap:address rewritten to the caller's URL; without one, GET is not allowed. /// public class SoapWsdlTests { private static int FreePort() => global::redb.Route.Tests.Shared.TestPorts.Next(); private const string SampleWsdl = "" + "" + "" + "" + "" + ""; [Fact] public void RewriteAddress_ReplacesSoapLocation() { var rewritten = SoapWsdl.RewriteAddress(SampleWsdl, "https://real.example/svc"); rewritten.Should().Contain("https://real.example/svc").And.NotContain("placeholder.invalid"); } [Fact] public async Task Consumer_PublishesWsdl_On_Get_WithRewrittenAddress() { var port = FreePort(); await using var ctx = new RouteContext(); ctx.AddComponent(new SoapComponent()); ctx.AddToRegistry("pub", new SoapConnectionFactory { Wsdl = SampleWsdl }); ctx.AddRoutes(r => r.From(SoapDsl.Listen("/svc").Host("127.0.0.1").Port(port).ConnectionFactory("pub")) .Process(e => e.In.Body = "")); await ctx.Start(); using var http = new HttpClient(); var resp = await http.GetAsync($"http://127.0.0.1:{port}/svc?wsdl"); resp.StatusCode.Should().Be(HttpStatusCode.OK); resp.Content.Headers.ContentType!.MediaType.Should().Be("text/xml"); var body = await resp.Content.ReadAsStringAsync(); body.Should().Contain("EchoService").And.Contain("Echo"); body.Should().Contain($"http://127.0.0.1:{port}/svc").And.NotContain("placeholder.invalid"); } [Fact] public async Task Consumer_WithoutWsdl_RejectsGet() { var port = FreePort(); await using var ctx = new RouteContext(); ctx.AddComponent(new SoapComponent()); ctx.AddRoutes(r => r.From(SoapDsl.Listen("/svc").Host("127.0.0.1").Port(port)) .Process(e => e.In.Body = "")); await ctx.Start(); using var http = new HttpClient(); var resp = await http.GetAsync($"http://127.0.0.1:{port}/svc?wsdl"); // No WSDL configured ⇒ GET is not a registered method on this path. resp.StatusCode.Should().Be(HttpStatusCode.MethodNotAllowed); } }