September 2014

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        








« Project Freewheel: Losing Control! | Main | Advanced Visual Studio debugging: automatic expansion of watched variables »

July 21, 2006

Calling the DWFRender Web Service from HTML

I decided to go ahead and put a test page together for the DWFRender Web Service. It still wasn't feasible to make it part of the blog itself, given the issues with scripting, particularly, but I've included the files here for you to download and run locally:

Download freewheel_web_service_test.zip

There are three web methods called by this code:

  • pdkVersion - gets the version of the PDK on the server (a string value)
  • pageCount - gets the number of pages for a particular DWF file (an integer value)
  • load - gets more detailed information about each page in a DWF (a more complex data structure is used for this)

Web Services are generally called asynchronously from HTML, which means the call is made and the page then sits back until either a callback is invoked or an event is fired (the Web Service Behavior used in the attached sample - and linked to in my previous post - can be made to work with both approaches... I've chosen to use callbacks in my code, as it allows more flexibility when handling different result types: you can have different callback functions invoked depending on the datatype you expect to receive).

The first two methods will return basic dataypes - here are typical results without the SOAP header:

<pdkVersionResult>1.4.1976.5fw</pdkVersionResult>

<pageCountResult>5</pageCountResult>

Inside the attached code it is simple to access these datatypes by using result.value in the callback receiving the results.

For the load method, however, things are more complicated. As a complex datatype is used to return the information about the various pages, you will need to use result.raw.xml to access the underlying XML content:

<
loadResponse xmlns="http://autodesk.com/DWFRender">
  <
loadResult>
    <
pageCount>5</pageCount>
    <
sectionInfo>
      <
SectionInformation>
        <
name>Assembly Exploded:1</name>
        <
paperSize>
          <
units>kMillimeters</units>
          <
width>431.8</width>
          <
height>279.40000000000003</height>
        </
paperSize>
      </
SectionInformation>
      <
SectionInformation>
        <
name>Assembly:2</name>
        <
paperSize>
          <
units>kMillimeters</units>
          <
width>431.8</width>
          <
height>279.40000000000003</height>
        </
paperSize>
      </
SectionInformation>
      <
SectionInformation>
        <
name>Sony PSP Body:3</name>
        <
paperSize>
          <
units>kMillimeters</units>
          <
width>431.8</width>
          <
height>279.40000000000003</height>
        </
paperSize>
      </
SectionInformation>
      <
SectionInformation>
        <
name>UMD COVER:4</name>
        <
paperSize>
          <
units>kMillimeters</units>
          <
width>279.40000000000003</width>
          <
height>215.9</height>
        </
paperSize>
      </
SectionInformation>
      <
SectionInformation>
        <
name>MAGIC GATE COVER:5</name>
        <
paperSize>
          <
units>kMillimeters</units>
          <
width>279.40000000000003</width>
          <
height>215.9</height>
        </
paperSize>
      </
SectionInformation>
    </
sectionInfo>
  </
loadResult>
</
loadResponse>

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83452464869e200d834a2e24853ef

Listed below are links to weblogs that reference Calling the DWFRender Web Service from HTML:

blog comments powered by Disqus

Feed/Share

10 Random Posts