Forum Discussion

Perchishka's avatar
Perchishka
Occasional Contributor
8 years ago

How to trim white space after XMLParser

Hello!   I have an xml.file  and I need to generate random UUID and Date for every request. So I decided to write a groovy script: TimeZone.setDefault(TimeZone.getTimeZone("Europe/Moscow")); def...
  • nmrao's avatar
    8 years ago

    I believe that this question was earlier posted and not visible somehow. Now visible again, it seems.

     

    Any ways, if your object is just to add UUID and date only as shown in the request there, then you do not even require the current Groovy Script step there before Soap Request Test step.

     

    You can directly achieve that within request step itself by the use of in-line script as shown the below request. You can disable groovy step and update the request as below:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <SmsSubscriptionsTarifficationNotifies xmlns="https://moipodpiski.ssl.mts.ru/xsd/SmsSubscriptionsTarifficationNotifies.xsd">
       <TarifficationNotify>
          <TransactionId>${= UUID.randomUUID()}</TransactionId>
          <SubscriptionId>${= UUID.randomUUID()}</SubscriptionId>
          <ContentId>${= UUID.randomUUID()}</ContentId>
          <MSISDN>79855575412</MSISDN>
          <AttemptDate>${= new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ")}</AttemptDate>
          <Result>false</Result>
          <FaultCode>102</FaultCode>
       </TarifficationNotify>
    </SmsSubscriptionsTarifficationNotifies>

    Hope this helps.