BAzad
14 years agoNew Contributor
cdata parsing & property tranfer failing from cmd line
cdata data parsing is failing on the command line
Hi,
I am newbie and would want your help on this.
I am trying to parse CDATA and want to transfer the property(like session.id) to different projects.
and i have used the submitListener.afterSubmit listener.
if( submit.response == null )
return
def content = submit.response.responseContent
content = content.replaceAll( "<!\\[CDATA\\[", "" )
content = content.replaceAll( "]]>", "" )
log.info( content )
submit.response.responseContent = content
The above works only when i run at the test step level but not at the test case or the command line. And the response looks like the below
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginResponse xmlns="http://sliderocket.com/webservices/">
<LoginResult><[![CDATA[<results requestID="" uid="" type="Login" status="1" error=""><data><Data SessionID="3d7c4e9e-ed90-4255-8ee8-255d7315144c" UserID="58C51C68-06BF-BB20-6C5C-A7033948D08C"><Company><uid>e63ad7cf-8968-417b-8284-23fbb43d7a22</uid><ID>30732</ID><Name>SlideRocket</Name><MaxUsers>80</MaxUsers><PrimaryUser>18c4a95f-96ec-41f5-8456-f34b816a6bed</PrimaryUser><PlanID>7</PlanID><Status>1</Status><CreationDate>9/3/2008 2:44:03 PM</CreationDate><ExpirationDate>1/30/2012 12:00:00 AM</ExpirationDate><DiskSpacePerUser>1024</DiskSpacePerUser><PermissionByFolder>False</PermissionByFolder><VendorID>GoogleApps </VendorID><PublishID>ABTMA</PublishID><VanityName>sliderocket</VanityName><HadTrial>0</HadTrial><UseGoogleCheckout>False</UseGoogleCheckout><LastModifiedBy>62554</LastModifiedBy><LastModifiedOn>11/30/2011 7:33:22 PM</LastModifiedOn></Company><User><uid>58C51C68-06BF-BB20-6C5C-A7033948D08C</uid><FirstName>Shailaja</FirstName><LastName>Madireddy</LastName><Email>shailaja@sliderocket.com</Email><Password>2f0c0313a6b193d94bbabef9675c3936</Password><CompanyID>e63ad7cf-8968-417b-8284-23fbb43d7a22</CompanyID><Preferences><Preferences>
<getStartedDontShow>1</getStartedDontShow>
<NewPresentationDlgWidth>800</NewPresentationDlgWidth>
<showDefaultThemes>1</showDefaultThemes>
<NewPresentationDlgHeight>600</NewPresentationDlgHeight>
<showNewUIDialog>0</showNewUIDialog>
</Preferences></Preferences><AccountCreated>9/26/2011 1:35:07 PM</AccountCreated><IsSlideRocketDebugUser>False</IsSlideRocketDebugUser><IsDeleted>False</IsDeleted><OptInMarketing>False</OptInMarketing><OptInNewsletter>False</OptInNewsletter><AgreedToTOS>True</AgreedToTOS><IsBillingUser>False</IsBillingUser><ForcePasswordReset>False</ForcePasswordReset><Role>0</Role><id>572966</id><LastModifiedBy>273401</LastModifiedBy><LastModifiedOn>9/26/2011 1:35:07 PM</LastModifiedOn><EmailConfirmationStatus>0</EmailConfirmationStatus></User><Capabilities><CanEditIdentity>false</CanEditIdentity><CanAccessInspirationGallery>true</CanAccessInspirationGallery><CanAskForComments>true</CanAskForComments><CanBuyMarketplaceCredits>true</CanBuyMarketplaceCredits><CanCreateThemes>true</CanCreateThemes><CanEditFolders>true</CanEditFolders><CanEditTags>true</CanEditTags><CanExportPresentations>true</CanExportPresentations><CanImportAssetsFromDesktop>true</CanImportAssetsFromDesktop><CanImportAssetsFromWeb>true</CanImportAssetsFromWeb><CanImportFonts>true</CanImportFonts><CanImportPresentations>true</CanImportPresentations><CanPrintPresentations>true</CanPrintPresentations><CanPublishPresentation>true</CanPublishPresentation><CanShareViaEmail>true</CanShareViaEmail><CanShareWithEveryone>true</CanShareWithEveryone><CanUseColorPicker>true</CanUseColorPicker><CanUseDefaultFonts>true</CanUseDefaultFonts><CanUseDefaultThemes>true</CanUseDefaultThemes></Capabilities></Data></data></results>]]></LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>
what would be the best solution for me to parse the cdata and transfer the properties like sessionid to other projects so that it works when its run at the test suite and the command line
Hi,
I am newbie and would want your help on this.
I am trying to parse CDATA and want to transfer the property(like session.id) to different projects.
and i have used the submitListener.afterSubmit listener.
if( submit.response == null )
return
def content = submit.response.responseContent
content = content.replaceAll( "<!\\[CDATA\\[", "" )
content = content.replaceAll( "]]>", "" )
log.info( content )
submit.response.responseContent = content
The above works only when i run at the test step level but not at the test case or the command line. And the response looks like the below
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginResponse xmlns="http://sliderocket.com/webservices/">
<LoginResult><[![CDATA[<results requestID="" uid="" type="Login" status="1" error=""><data><Data SessionID="3d7c4e9e-ed90-4255-8ee8-255d7315144c" UserID="58C51C68-06BF-BB20-6C5C-A7033948D08C"><Company><uid>e63ad7cf-8968-417b-8284-23fbb43d7a22</uid><ID>30732</ID><Name>SlideRocket</Name><MaxUsers>80</MaxUsers><PrimaryUser>18c4a95f-96ec-41f5-8456-f34b816a6bed</PrimaryUser><PlanID>7</PlanID><Status>1</Status><CreationDate>9/3/2008 2:44:03 PM</CreationDate><ExpirationDate>1/30/2012 12:00:00 AM</ExpirationDate><DiskSpacePerUser>1024</DiskSpacePerUser><PermissionByFolder>False</PermissionByFolder><VendorID>GoogleApps </VendorID><PublishID>ABTMA</PublishID><VanityName>sliderocket</VanityName><HadTrial>0</HadTrial><UseGoogleCheckout>False</UseGoogleCheckout><LastModifiedBy>62554</LastModifiedBy><LastModifiedOn>11/30/2011 7:33:22 PM</LastModifiedOn></Company><User><uid>58C51C68-06BF-BB20-6C5C-A7033948D08C</uid><FirstName>Shailaja</FirstName><LastName>Madireddy</LastName><Email>shailaja@sliderocket.com</Email><Password>2f0c0313a6b193d94bbabef9675c3936</Password><CompanyID>e63ad7cf-8968-417b-8284-23fbb43d7a22</CompanyID><Preferences><Preferences>
<getStartedDontShow>1</getStartedDontShow>
<NewPresentationDlgWidth>800</NewPresentationDlgWidth>
<showDefaultThemes>1</showDefaultThemes>
<NewPresentationDlgHeight>600</NewPresentationDlgHeight>
<showNewUIDialog>0</showNewUIDialog>
</Preferences></Preferences><AccountCreated>9/26/2011 1:35:07 PM</AccountCreated><IsSlideRocketDebugUser>False</IsSlideRocketDebugUser><IsDeleted>False</IsDeleted><OptInMarketing>False</OptInMarketing><OptInNewsletter>False</OptInNewsletter><AgreedToTOS>True</AgreedToTOS><IsBillingUser>False</IsBillingUser><ForcePasswordReset>False</ForcePasswordReset><Role>0</Role><id>572966</id><LastModifiedBy>273401</LastModifiedBy><LastModifiedOn>9/26/2011 1:35:07 PM</LastModifiedOn><EmailConfirmationStatus>0</EmailConfirmationStatus></User><Capabilities><CanEditIdentity>false</CanEditIdentity><CanAccessInspirationGallery>true</CanAccessInspirationGallery><CanAskForComments>true</CanAskForComments><CanBuyMarketplaceCredits>true</CanBuyMarketplaceCredits><CanCreateThemes>true</CanCreateThemes><CanEditFolders>true</CanEditFolders><CanEditTags>true</CanEditTags><CanExportPresentations>true</CanExportPresentations><CanImportAssetsFromDesktop>true</CanImportAssetsFromDesktop><CanImportAssetsFromWeb>true</CanImportAssetsFromWeb><CanImportFonts>true</CanImportFonts><CanImportPresentations>true</CanImportPresentations><CanPrintPresentations>true</CanPrintPresentations><CanPublishPresentation>true</CanPublishPresentation><CanShareViaEmail>true</CanShareViaEmail><CanShareWithEveryone>true</CanShareWithEveryone><CanUseColorPicker>true</CanUseColorPicker><CanUseDefaultFonts>true</CanUseDefaultFonts><CanUseDefaultThemes>true</CanUseDefaultThemes></Capabilities></Data></data></results>]]></LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>
what would be the best solution for me to parse the cdata and transfer the properties like sessionid to other projects so that it works when its run at the test suite and the command line