[Catalyst-commits] r7609 - Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller

drew at dev.catalyst.perl.org drew at dev.catalyst.perl.org
Thu Apr 10 11:09:42 BST 2008


Author: drew
Date: 2008-04-10 11:09:42 +0100 (Thu, 10 Apr 2008)
New Revision: 7609

Modified:
   Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm
Log:
Added documentation about using Catalyst::Test and WSDL files.


Modified: Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm	2008-04-10 02:52:10 UTC (rev 7608)
+++ Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm	2008-04-10 10:09:42 UTC (rev 7609)
@@ -524,7 +524,41 @@
       reader => {sloppy_integers => 1}, writer => {sloppy_integers => 1},
   };
 
+=head1 USING WSDL AND Catalyst::Test
 
+If you'd like to use the built-in server from Catalyst::Test with your
+WSDL file (which likely defines an <address location="..."> that differs
+from the standard test server) you'll need to use the transport_hook
+option available with $wsdl->compileClient() in your test file.
+
+
+    # t/soap_message.t
+    use XML::Compile::WSDL11;
+    use XML::Compile::Transport::SOAPHTTP;
+    use Test::More qw(no_plan);
+
+    BEGIN {
+        use_ok 'Catalyst::Test', 'MyServer';
+    }
+
+    sub proxy_to_test_app
+    {
+        my ($request, $trace) = @_;
+        # request() is a function inserted by Catalyst::Test which
+        # sends HTTP requests to the just-started test server.
+        return request($request);
+    }
+
+    my $xml       = '/path/to/wsdl/file';
+    my $message   = 'YourMessage';
+    my $port_name = 'YourPort';
+    my $wsdl      = XML::Compile::WSDL11->new($xml);
+    my $client    = $wsdl->compileClient($message, 
+        port => $port_name, transport_hook => \&proxy_to_test_app,
+    );
+    $client->(...);
+
+
 =head1 TODO
 
 No header features are implemented yet.
@@ -549,6 +583,7 @@
 =head1 AUTHORS
 
 Daniel Ruoso C<daniel.ruoso at verticalone.pt>
+
 Drew Taylor C<drew at drewtaylor.com>
 
 =head1 BUG REPORTS




More information about the Catalyst-commits mailing list