Forum Discussion

BenX's avatar
BenX
Contributor
16 years ago

Unexpected element

[SOAP Response] error: Unexpected element: XML_DOC_OR_TEXT_DECL


I'm using event handler (SubmitListener.afterSubmit):

if( submit.response == null )
  return

def content = submit.response.responseContent

content = content.replaceAll( "<", "<" )
content = content.replaceAll( ">", ">" )
content = content.replaceAll( "<\\?xml version='1.0' \\?>", "" )
content = content.replaceAll( "

3 Replies

  • BenX's avatar
    BenX
    Contributor
    ok...

    If i use this:

    if( submit.response == null )
      return

    def content = submit.response.responseContent

    content = content.replaceAll( "<!\\[CDATA\\[<\\?xml version=\"1.0\"\\?>", "" )
    content = content.replaceAll( "]]>", "" )

    submit.response.responseContent =  content


    it goes throught the test case, but it doesn't remove anything from response as it should.
    (it still works ok if i send request manualy)


    Should i use anything else than SubmitListener.afterSubmit?
  • BenX's avatar
    BenX
    Contributor
    I think I found a solution! 

    For test case i have to use: TestRunListener.afterStep

    and this code for example:
    if( testStepResult.response == null )
      return

    def content = testStepResult.response.responseContent
    content = content.replaceAll( "<", "<" )
    content = content.replaceAll( ">", ">" )
    content = content.replaceAll( "<\\?xml version=\"1.0\" encoding=\"ISO-8859-1\"\\?", "" )
    content = content.replaceAll( "<!\\[CDATA\\[<\\?xml version=\"1.0\"\\?>", "" )
    content = content.replaceAll( "<\\?xml version='1.0' \\?>", "" )
    content = content.replaceAll( "<!\\[CDATA\\[", "" )
    content = content.replaceAll( "]]>", "" )
    content = content.replaceAll( """, "\"" )

    //log.info( content )
    testStepResult.response.responseContent =  content


    Ole, you can update your blog. 

    BUT! 

    SubmitListener.afterSubmit must be disabled. That's not a big problem but it sucks in case if we would just like to run one request from test case, just to see certain results. 

    bug?

    Can someone help me with this?
    It would be great if we could use both functunalitys at the same time, without enabling and disabling them. I didn't try loadtesting yet.

    I'm using SoapUI pro 3.0.1

    Beno
  • Hi Beno,

    I'll check into this, you shouldn't be able to have different handlers for different "levels" of execution.. I'll let you know..

    regards!

    /Ole
    eviware.com