[xsd-users] Inconsistency in Qname serialization/parsing
brice salva
salva.brice at gmail.com
Mon Dec 17 12:11:58 EST 2012
Hi Boris,
First of all, thank you for providing such tool as xsd-cs, this is really
helpful for C++ developpers.
Now, unfortunately, I face an issue I am not able to solve without
consulting you.
I am trying to serialize and then parse a Soap Fault with xsd-cs.
Here is the output:
--------------------------------
SERIALIZING fault
--------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
<Header/>
<Body>
<Fault>
<Code>
<Value>Server</Value>
</Code>
<Reason>
<Text xml:lang="en">Error : invalid message</Text>
</Reason>
</Fault>
</Body>
</Envelope>
--------------------------------
PARSING fault
--------------------------------
parsing : error during validation: message 01:17:30:value 'Server' not in
enumeration
Indeed, the element "Value" element must respect :
(see http://www.w3.org/2003/05/soap-envelope)
<complexType name="faultcode">
<sequence>
<element name="Value" type="env:faultcodeEnum" />
<element name="Subcode" type="env:subcode" minOccurs="0" />
</sequence>
</complexType>
<simpleType name="faultcodeEnum">
<restriction base="xs:QName">
<enumeration value="env:DataEncodingUnknown" />
<enumeration value="env:MustUnderstand" />
<enumeration value="env:Receiver" />
<enumeration value="env:Sender" />
<enumeration value="env:VersionMismatch" />
</restriction>
</simpleType>
Here, when serializing, xsd-cs builds and xml message without prefixing the
namespace of the root element ; hence the "Value" text is not qualified by
any prefix, which is fair.
But then, the parsing should be in line with this logic, and this is not
the case : the error message shows that a prefix is expected.
Note that I cannot use the namespace infomap to force a prefix because I am
parsing and serializing the xml data with the generic
element_map/element_type logic.
Here is an extract that shows how I build the body of the fault:
aBody.fault(
soapEnv::Fault
(
soapEnv::Faultcode
(
soapEnv::FaultcodeEnum
(
xml_schema::Qname(soapEnv::EnvelopeElement::namespace_(),"Server")
)
),
aFaultReason
)
);
Could you tell me how to deal with qname elements and more generally how to
parse/serialize them in a soap fault context with xsd-cs ?
Many thanks,
Brice
More information about the xsd-users
mailing list