0

I'm mocking out a soap webservice and I can only get the default first response to return regardless of the request body.

I'm basing my attempts off the docs Multiple Transaction Examples and I'm confused as to what I'm doing wrong.

As an example:

+ Request

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="">
         <SOAP-ENV:Body>
            <m:transaction-identity-verification xmlns:m="">
            </m:transaction-identity-verification>
         </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

+ Response

      <?xml version="1.0" encoding="UTF-8"?>
      <env:Envelope xmlns:env="">
         <env:Header />
         <env:Body>
            <java:transaction-response xmlns:java="j">
               <transaction-status>
                  <transaction-id>third_8020750179321</transaction-id>
                  <transaction-request-id>george_8020860578800</transaction-request-id>
                  <accounts-transaction-id>13</accounts-transaction-id>
                  <reference-id>13</reference-id>
                  <transaction-result>questions</transaction-result>
               </transaction-status>
            </java:transaction-response>
         </env:Body>
      </env:Envelope>

+ Request

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="">
         <SOAP-ENV:Body>
            <m:transaction-continue xmlns:m="">
            </m:transaction-continue>
         </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

+ Response

      <?xml version="1.0" encoding="UTF-8"?>
      <env:Envelope xmlns:env="">
         <env:Header/>
         <env:Body>
            <java:transaction-response xmlns:java="">
               <transaction-status>
                  <transaction-id>cont_1_11020785803682</transaction-id>
                  <transaction-request-id>11020943348626</transaction-request-id>
                  <accounts-transaction-id>0</accounts-transaction-id>
                  <transaction-result>passed</transaction-result>
               </transaction-status>
            </java:transaction-response>
         </env:Body>
      </env:Envelope>

In the example above, I will only receive the first response even when I post two different requests. Based on the linked documentation this should be possible.

1 Answers1

0

The Apiary mock-server does not have the capability to determine which response to return from multiple transaction examples based on the body of your request.

API Blueprint does allow you to provide multiple responses, Apiary mock server will only use response-code, headers or content-type to differentiate these examples.

For example, given two responses with different content-types:

+ Response 200 (plain/text)

    Text Response

+ Response 200 (application/json)

    { "text": "JSON Response" }

Now, when we make a request to the mock server for the above responses. We can supply an Accept header to get the JSON response:

$ curl -H 'Accept: application/json' URL
{ "text": "JSON Response" }

Or ask for the text response:

$ curl -H 'Accept: plain/text' URL
Text Response

You can find more information regarding this at http://support.apiary.io/knowledgebase/articles/117119-handling-multiple-actions-on-a-single-resource

kylef
  • 1,066
  • 1
  • 8
  • 11