[Requests] CR: SOAP GetTile response example with CDATA (07-057r6)

Joan Maso joan.maso at uab.es
Thu Mar 12 06:13:57 EDT 2009


PART A

1. Evaluator:
        Joan Masó

2. Submission: [OpenGIS Project Document Number, Name]
        07-057r6 Candidate OpenGIS Web Map Tiling Service Implementation 
Standard


PART B


1. Requirement: [General, #]
    Encoding

2. Implementation Specification Section number: [General, #]
       9.2.2  GetTile request SOAP encoding response
       SOAP example response file.

3. Criticality: [Major, Minor, Editorial, etc.]
Minor

4. Comments/justifications for changes: [Comments]
I require to use a CDATA for base64 encapsulation image.

<wmts:BinaryPayload>
<wmts:Format>image/png</wmts:Format>
<wmts:BinaryContent>
  <![CDATA[
    Base 64 encoded data...
  ]]>
      </wmts:BinaryContent>
</wmts:BinaryPayload>

Sinse "a CDATA section is used to escape a block of text that
would otherwise be parsed as markup" I'm suggesting to change the current
encoding of a SOAP GetTile response. Advantages:

-         Better support in javascript.
-         Fast parsing since XML parsers will know that all this data hasn't
to be parsed. Do not forget that XML part of the message is minimum compared
to the base 64 huge data (even for a small 256x256 png image it could be
50k)

Reasons:
I have tested support to SOAP encoding on our JavaScript WMTS-WMS client.

I discovered that a recent addition to HTML allows support for embedded
base64 data on ad image in a very simple way:

<img
src="data:image/gif;base64,R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw==" 
alt="Base64 encoded image" width="150" height="150"/>

(http://dean.edwards.name/weblog/2005/06/base64-ie/)

This method is supported for all browsers except the current version of
Internet Explorer (but is expected to be supported in the new version 8).

We have just implemented the following method

- Write a SOAP GetTile request and send an AJAX POST.
- Receive the response and parse it with XML DOM
- Change and image "src" than previously exists with the new data received.
Fortunately we include the MIME type on the response so I have all the
elements to build a long string to do that.

BUT I find out that the image is only shown partially!!. I have just found a
XML DOC implementation limitation:

"The DOM does not define a size limit for the DOMString type, however some
implementations do:

Firefox: 4K (4096 bytes)
Opera 9.0: 32K (32768 bytes)
Safari 3 64K (65536 bytes)"

(http://reference.sitepoint.com/javascript/domcore)

And for tha reason, XML DOM only gives to me the first part of the image.

Some solutions are discussed here:

http://www.webdesignforums.net/javascript_6/xml_data_being_truncated_26185.html
http://bytes.com/groups/xml/482760-problem-reading-large-amount-data-xml-tag

But I found a simpler solution:

To use:

  <![CDATA[
    Base 64 encoded data...
  ]]>

And it work! Now we have a SOAP client implementation in JavaScript!. Tested
in FireFox, Opera, Safari and Chrome.

Joan Masó
UAB-CREAF-MiraMon



More information about the Requests mailing list