Forum Discussion

MOTOROLA_Suppor_1's avatar
15 years ago

EventHanlder: Request log dereference ...

I want to find a generic way to log request/response soapenv into a log file per testcase base. I was told by Ole that I should use Eventhandler: afterRequest to log the request.

I tried out following script It does have soapenv printed out. but It still has property name. How do log the property value?
(the following example: ${Project#UserID}, How do I see the value for this property?? )

thanks
sheena
=== Reference info===========
import com.eviware.soapui.support.xml.XmlUtils
def req_str = request.getRequestContent();
log.info(XmlUtils.prettyPrintXml(req_str));

the log4j output is:
Mon Dec 06 16:28:42 EST 2010:INFO:<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://asp.motorola.com/nbs/admin/v1-0">
<soapenv:Header>
<v1:nbsHeader>
<authToken>
<userId/>
<sessionId/>
</authToken>
</v1:nbsHeader>
</soapenv:Header>
<soapenv:Body>
<v1:login>
<!--Optional:-->
<!--Optional:-->
<user>${#Project#UserID}</user>
<pwd>${#Project#UserPassword}</pwd>
<!--Optional:-->
<!--Optional:-->
</v1:login>
</soapenv:Body>
</soapenv:Envelope>

2 Replies

  • Hi Sheena,

    use the following instead to get the actual request that was sent:

    def req_str = context.getProperty( "requestContent" )
    ...

    Does that work better?

    regards!

    /Ole
    eviware.com