2

I am trying to use node-soap to communicate with Amazon Mechanical Turk. I initialize the soap client with this wsdl but when I try calling client.<SomeOperation>(...) for any of the operations listed in the Mechanical turk API, I found that the responses I was getting did not contain results from the API call. The API documentation says that the response should contain a "Result element", but instead I found that I was getting useless results that looked like this:

<HelpResponse xmlns="http://requester.mturk.amazonaws.com/doc/2014-08-15">
    <OperationRequest>
        <RequestId>(something)</RequestId>
    </OperationRequest>
    <Information>
        <Request>
            <IsValid>True</IsValid>
        </Request>
        <OperationInformation>
            <Name>Please see our online documentation at http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=28</Name>
        </OperationInformation>
    </Information>
</HelpResponse>

Upon further investigation, I found that the problem is in what node-soap sends when I try to use it to make API requests. When I try to call, say, RegisterHITType, rather than sending a <RegisterHITType> element, it seems to send some sort of <Help> element instead, which looks like this:

<Help xmlns="http://requester.mturk.amazonaws.com/doc/2014-08-15">
    <Title>(something)</Title>
    <Description>(something)</Description>
    <Reward>(something)</Reward>
    <AssignmentDurationInSeconds>(something)</AssignmentDurationInSeconds>
    <AWSAccessKeyId>(something)</AWSAccessKeyId>
    <Timestamp>(something)</Timestamp>
    <Service>AWSMechanicalTurkRequester</Service>
    <Signature>(something)</Signature>
</Help>

Why does it send this instead of the expected API request? Is this a result of a glitch, or am I misunderstanding how to use node-soap? Is there a way to work around this, or do I need to look into using the Mechanical Turk API through some other means?

vijrox
  • 1,063
  • 1
  • 13
  • 33

1 Answers1

0

I found that node-soap may have bug.

Please try to use 'soap ui' to call web services by yourself to make sure that this web services works fine. (download soap-ui here https://www.soapui.org)

If web services works well, the problem is node-soap lib. You can work around by generating soap request message and call the service directly.

Alongkorn
  • 3,968
  • 1
  • 24
  • 41
  • Thanks for the response. I have since switched to using the rest api for this particular service (and it's working great), so to be honest I don't think I will take the time to try out soap-ui to test this out -- but thanks for the help – vijrox Jun 06 '16 at 03:41