Forum Discussion

Armageddonsoft's avatar
Armageddonsoft
Contributor
15 years ago

Use SoapUI to test broken XML

I'm trying to test parsing validation error using SoapUI but it seems you can't test broken tags because SoapUI automatically fixes them before sending the request, e.g if I try to send

<soapenv:Bo
...some data...
<soapenv:Body/>

SoapUI will fix the first tag before sending it. Is there any way around this? To force SoapUI to send broken tags?
  • Jasper175's avatar
    Jasper175
    Frequent Contributor
    I just tried to recreate what you did and SoapUI didn't fix it for me.

    In the TestCase Editor I took out the 'dy'

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://abc.123.com/services/sl">
    <soapenv:Header/>
    <soapenv:Bo>
    <ser:GetCustomerFullInfoRequest>
    <ser:customerId>2075</ser:customerId>
    </ser:GetCustomerFullInfoRequest>
    </soapenv:Body>
    </soapenv:Envelope>


    The error I got:
    <faultcode>soap:Client</faultcode>
    <faultstring>An exception occurred processing the request
    : ServletInputStream read failed at byte 0 of 366</faultstring>

    When I fix the "Body" - it the API runs fine.

    So when you send the broken tag and run it successfully the Raw tab shows <soapenv:Body> intact?
  • Thanks for your reply. I'll have to check on monday but I can say as much: When I reload the request file, the tag (<Body>, in this case) is repaired and in the server logs the tag is also corrected.

    But again, I'll have to check the raw on monday.
  • Jasper175's avatar
    Jasper175
    Frequent Contributor
    OH - I'm sorry, I didn't try to close and reload the API.
    Yes - that does happen.

    I'll look to see if there is an easier way - but here is one way you can do it, but you'll have to maintain a separate negative test project.

    Go to Project Properties > Events tab
    > new RequestFilter.filterRequest
    > paste this in: context.requestContent = context.requestContent.replaceAll( "<soapenv:Body>", "<soapenv:Bo>" )

    That will change EVERY API

    I'm sure in time if I play around there is a way to do this at the TestSuite or TestCase level. I'll let you know.

    Rob
  • Hi guys,

    this actually sounds like a bug in soapUI to me, I'll try to reproduce to see what's going on.

    regards,

    /Ole
    eviware.com
  • Hi again,

    I couldn't reproduce with just the XML source editor; the form editor in Pro messes things up here but not like you describe.

    Maybe I'm doing something wrong; can you give me a step-by-step instruction on how to reproduce this?

    Thanks in advance!

    regards,

    /Ole
    eviware.com
  • Hi

    I'll do some work on this later today as I've been assigned on solving this issue. I'll run some requests on our server and study the logs for detailed information on what is actually sent in the request.
    What I did initially was break a tag, e.g <Body> to <Bod and then send the request. I got an XMLStreamException, closed and re-opened the request at which point the tag is restored to <Body>

    I'll check back later today with more information
  • Hi!

    I was able to reproduce (and fix) this when using the Form editor in soapUI Pro; is that what you are using also or are you using the open-source version?

    regards!

    /Ole
    eviware.com
  • Jasper175's avatar
    Jasper175
    Frequent Contributor
    I am using Pro, but I opened the API itself, go to the XML tab and change
    <soapenv:Body>
    to
    <soapenv:Bo>

    It will work running the test while open during the change... but when closing then reopening the test API it's fixed back to <soapenv:Body>