Subject: | namespace prefix for soap Envelope |
Hi,
Current Catalyst::Controller::SOAP generated SOAP Envelope tag has no
prefix. It's causing me troubles with SOAP payload that uses empty
prefix, as it gets the default one from the paren Envelope -
"http://schemas.xmlsoap.org/soap/envelope/". XSDs with
elementFormDefault="unqualified" attribute needs to have elements with
empty prefixes. XML::Compile::WSDL11 generates soap Header with
"SOAP-ENV" namespace prefix so I've attached a patch that does the same
for Catalyst::Controller::SOAP.
Before the patch XML looked like this:
[debug] Outgoing XML: <Envelope
xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body><x0:notifyResponse...
After like this:
[debug] Outgoing XML: <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><x0:notifyResponse...
Cheers,
Jozef
Subject: | envelope-ns-prefix.patch |
From dd437bb82ec9105983f1aeff1c7389b7e1450c24 Mon Sep 17 00:00:00 2001
From: Jozef Kutej <jozef@kutej.net>
Date: Fri, 6 Feb 2009 17:27:01 +0100
Subject: [PATCH] evelope namespace prefix
---
lib/Catalyst/Controller/SOAP.pm | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/Catalyst/Controller/SOAP.pm b/lib/Catalyst/Controller/SOAP.pm
index 21923a6..e0b2426 100644
--- a/lib/Catalyst/Controller/SOAP.pm
+++ b/lib/Catalyst/Controller/SOAP.pm
@@ -281,24 +281,24 @@
my $response = XML::LibXML->createDocument('1.0','UTF8');
my $envelope = $response->createElementNS
- ($namespace,"Envelope");
+ ($namespace,"SOAP-ENV:Envelope");
$response->setDocumentElement($envelope);
# TODO: we don't support header generation in response yet.
my $body = $response->createElementNS
- ($namespace,"Body");
+ ($namespace,"SOAP-ENV:Body");
$envelope->appendChild($body);
if ($soap->fault) {
my $fault = $response->createElementNS
- ($namespace, "Fault");
+ ($namespace, "SOAP-ENV:Fault");
$body->appendChild($fault);
my $code = $response->createElementNS
- ($namespace, "faultcode");
+ ($namespace, "SOAP-ENV:faultcode");
$fault->appendChild($code);
my $codestr = $soap->fault->{code};
if (my ($ns, $val) = $codestr =~ m/^\{(.+)\}(.+)$/) {
@@ -313,18 +313,18 @@
}
my $faultstring = $response->createElementNS
- ($namespace, "faultstring");
+ ($namespace, "SOAP-ENV:faultstring");
$fault->appendChild($faultstring);
$faultstring->appendText($soap->fault->{reason});
if (UNIVERSAL::isa($soap->fault->{detail}, 'XML::LibXML::Node')) {
my $detail = $response->createElementNS
- ($namespace, "detail");
+ ($namespace, "SOAP-ENV:detail");
$detail->appendChild($soap->fault->{detail});
$fault->appendChild($detail);
} elsif ($soap->fault->{detail}) {
my $detail = $response->createElementNS
- ($namespace, "detail");
+ ($namespace, "SOAP-ENV:detail");
$fault->appendChild($detail);
# TODO: we don't support the xml:lang attribute yet.
my $text = $response->createElementNS
--
1.5.6.5