W3C home > Mailing lists > Public > xml-dist-app@w3.org > September 2007

Re: XML declaration in SOAP?

From: <noah_mendelsohn@us.ibm.com>
Date: Wed, 12 Sep 2007 07:48:48 -0400
To: "Vinogradov, Roman" <rvinogr@mera.ru>
Cc: xml-dist-app@w3.org
Message-ID: <OFE2073D37.556C8975-ON85257354.002CD8E7-85257354.004101E6@lotus.com>

Roman Vinogradov writes:

> I have a question regarding xml declaration in soap message:
> - is xml declaration mandatory for soap message?
> 
> The SOAP 1.1 spec states that SOAP message is encoded using XML. 
> The XML 1.0 spec defines that XML document SHOULD begin with an XML 
> declaration.

SHOULD is not MUST.  It's not required, just encouraged.

> This is also approved in EBNF grammatics:
> document    ::=         prolog  element  Misc*
> prolog      ::=         XMLDecl? Misc* (doctypedecl  Misc*)?

This doesn't require it either.

> On the other hand, the xml declaration line is absent in all 
> examples of soap message in the specification.

 It would be better form if it were there, but it probably would just make 
the specification that bit longer.  It's not required.
 
> In our case it can be a compatibility issue. Can you please help me 
> to interpret the specification right way?

Yes.  A conforming XML 1.0 parser MUST accept documents with or without 
the declaration.  Accordingly, a conforming SOAP implementation MUST 
accept SOAP messages with or without the declaration.  A conforming SOAP 
implementation may generate the prolog or may skip it.  There is no 
requirement that a given endpoint be consistent from one message to 
another.  All that's required is that each message be XML, and that means 
you can do it either way.

Noah

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------
Received on Wednesday, 12 September 2007 11:49:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:24 GMT