Service Virtualization

Expand all | Collapse all

text/xml request - Json response

Jump to Best Answer
  • 1.  text/xml request - Json response

    Posted 08-10-2018 09:41 AM

    Hi everyone,

     

    I`m having trouble virtualizing an text/xml request.

    The client only shared the SoapUI Project. The problem is, I`m having some difficulties to virtualize this service.
    I have tried to virtualize in different ways, but none of them is working. I cannot do the recorder because I don't have the SSL certificate.

     

    Any Ideas, on how to virtualize ?
    On the SoapUI project they call the operation like the image below:

    Attachment(s)



  • 2.  Re: text/xml request - Json response

    Posted 08-10-2018 10:59 AM

    Hi,

     

    As long as they have the soapUI project, I recommend sending all of the transactions you want to record through soapUI.  Copy/paste the requests and responses into text files, and then use the "request/response pairs" option to create the service image.

     

    --Mike



  • 3.  Re: text/xml request - Json response

    Posted 08-10-2018 01:49 PM

    Mike,

     

    I already tried this and the service is not working.

    Like in the SoapUI image, the request is only the text/xml: grant_type=password&username=Usuario&password=user123456

     

    This is a string inside an body that the Bus sends to the external real service: 

    <soapenv:Body 

    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">grant_type=password&amp;username=Usuario&amp;password=user123456></soapenv:Body>

     

    With this request we got an JSON response:

    {
    "access_token": "bcn8CZyQSOahgrxtEsJBdal_26Y4sM9Te6ehlNqawu-1DmopvbgTMZnpQq0ZEKhtbjOc71H4UDqRF4TfN3dpMqFN1o7Qm0mg9xgBe8JwS-EeCmm4-Ln6z4JHd3WJieRooPO794oByAcYwqpIOoM2UMSn8UBTl_wJdcE-GMaMKBbQ91IGrzlrfCYgky92NYqCoqX4YqA8tDrTdnV4WDwloyPjysR46h0wjW2c7GLwLyOsvhcim6dhxlBCB-vcKhvRH4-e1ufwPGEDEavcmoJxJv1ZY9LRWe5urpV0wVPhUuPSJQE_u5haw9fXiUXrHG_fMTjmrsBijM24EOIm-icjLWDKbQtQRBzKE45ikmArXL9rG1Z-txrz_9FNx8oSsVmSem3lVFxEyzzkUZgEVoTL7y0olSWQ7XK5d1GR5VFltfgEA37t",
    "token_type": "bearer",
    "expires_in": 899
    }

     

    There is no header, no envelope or something that can indicate an operation.

     

    Regards



  • 4.  Re: text/xml request - Json response
    Best Answer

    Posted 08-10-2018 02:56 PM

    Joao and I worked this out over IM.  For the benefit of others, here's what was happening.

     

    All Joao had access to was the request payload:

     

       grant_type=password&username=Usuario&password=user123456

     

    When attempting to create a VSI through req/rsp pairs, DevTest couldn't determine the operation without the POST line.  So, we added it manually like this:

     

       POST /gateway/oauth/token HTTP/1.1

     

       grant_type=password&username=Usuario&password=user123456

     

    Now, we were getting the operation name, but no arguments.  To get the arguments to be recognized, we had to indicate embedded form parameters were present using a header:

     

       POST /gateway/oauth/token HTTP/1.1
       Content-Type: application/x-www-form-urlencoded

     

       grant_type=password&username=Usuario&password=user123456

     

    From there, everything started to work.

     

    --Mike