[Xml-compile] Fault question
Mark Overmeer
mark at overmeer.net
Fri Apr 9 07:07:35 GMT 2010
* Paul Mooney (paul at phymatics.co.uk) [100408 10:01]:
> I get a faultcode & faultstring which is fine but the detail field is
> a pure string, like this:
> <faultcode>SOAP-ENV:Server</faultcode>
> <faultstring>TransErr</faultstring>
> <detail>48 - Post-Auth references invalid Pre-Auth</detail>
IMO, the fault structure should have been something like:
<faultcode>my-error-ns:Server.TransErr.48</faultcode>
<faultstring>Post-Auth references invalid Pre-Auth</faultstring>
<detail />
Because "detail" is used to provided unusual details about the fault.
The SOAP schema says:
<xs:complexType name="detail">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
which means: it should contain elements. SOAP (gladly) doesn't allow
mixed content.
There probably is a "simple" workaround using hooks. See
XML::Compile::Translate::Reader
sub details_as_string
{ my ($xml, $args, $path, $type, $r) = @_;
(detail => $xml->textContent);
}
my $wsdl = XML::Compile::WSDL->new('my.wsdl'
, opts_readers =>
{ hook => [ type => 'SOAP-ENV:detail'
, replace => \&detail_as_string ]
} )
(I hope I did not make too many mistakes, because I still have to
have my first coffee this morning)
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark at Overmeer.net solutions at overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net
More information about the Xml-compile
mailing list