28 November 2010

Quick heads-up, in case anybody else runs into this problem.

Background:

I've been working with passing an ExternalQuestion to MechanicalTurk, and have learned (the hard way) that the 'ExternalURL' component, set up as a "xs:anyURI" in the MTurk AWS schema, does not allow ampersands '&' except if escaped via '&'. 

That was not at all obvious. The AWS exception gives is:

<CreateHITResponse>
  <OperationRequest>
    <RequestId>...</RequestId>
  </OperationRequest>
  <HIT>
    <Request>
      <IsValid>False</IsValid>
      <Errors>
        <Error>
          <Code>AWS.MechanicalTurk.XMLParseError</Code>
          <Message>There was an error parsing the XML question or answer data in your request.  Please make sure the data is well-formed and validates against the appropriate schema. (1291006584155 s)</Message>
        </Error>
      </Errors>
    </Request>
  </HIT>/
</CreateHITResponse>

Solution: 

Replace any instance of & in the ExternalQuestion URI (IE, www.yoursite.com/mturk/a.php?foo=true&bar=false) with &amp; (IE, www.yoursite.com/mturk/a.php?foo=true&amp;bar=false).

That'll fix it.

Reference

ebay developer docs (strangely enough), External Question documentation.

 

Tags: #technical

Subscribe to Engineering Growth

Stay up to date on new essays and updates on Growth Engineering.