Re: XML declaration in SOAP?

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 UTC