XML declaration in SOAP?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

XML declaration in SOAP?

Vinogradov, Roman

Hello,

 

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.

This is also approved in EBNF grammatics:

document    ::=         prolog  element  Misc*

prolog      ::=         XMLDecl? Misc* (doctypedecl  Misc*)?

 

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

 

In our case it can be a compatibility issue. Can you please help me to interpret the specification right way?

 

Thank you in advance.

 

Best regards

Roman Vinogradov

MERA, Russia

 

 

Reply | Threaded
Open this post in threaded view
|

Re: XML declaration in SOAP?

noah_mendelsohn

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
--------------------------------------