[SOLVED]import empty datetime from datasource problem
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2009
02:31 AM
10-20-2009
02:31 AM
[SOLVED]import empty datetime from datasource problem
hi,
in our app we have daylight savings where we either import a datetime or just the month, week, day. so when i enter the month,... i need to leave the datetime empty. this works fine as long as i use a soapui teststep. but when i try to import the empty datetime value from excel i am getting an error:
The string '' is not a valid AllXsd value.
i also tried to create a property expansion variable with nothing entered but get the same error.
i cannot use the remove empty content setting in the teststep as this removes other fields which are needed in the wsdl but have no nodes.
is there a way to change the datetime field from this:
3
Third
Sunday
to use nil and not empty:
3
Third
Sunday
thanks
in our app we have daylight savings where we either import a datetime or just the month, week, day. so when i enter the month,... i need to leave the datetime empty. this works fine as long as i use a soapui teststep. but when i try to import the empty datetime value from excel i am getting an error:
The string '' is not a valid AllXsd value.
i also tried to create a property expansion variable with nothing entered but get the same error.
i cannot use the remove empty content setting in the teststep as this removes other fields which are needed in the wsdl but have no nodes.
is there a way to change the datetime field from this:
to use nil and not empty:
thanks
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2009
03:11 AM
10-20-2009
03:11 AM
Hello!
If I understand you correctly, importing the empty value from excel causes an empty value to be sent, instead of a null value, which is what you need it to send?
If so, you can replace the empty element with a null value using an Event Handler.
Go into the "Events" tab in the main Project window and add a new handler for RequestFilter.filterRequest. Either leave the "Target" field empty for this to run on all requests, or specify the name of a TestStep for it to run only on that one TestStep.
Then enter the following script:
which will do a simple string replace on the request content right before it is sent. If this particular element is empty, it will replace it with a null value (you could also strip it out entirely if you wanted). Hope this is what you needed! Good luck!
Regards,
Dain
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
If I understand you correctly, importing the empty value from excel causes an empty value to be sent, instead of a null value, which is what you need it to send?
If so, you can replace the empty element with a null value using an Event Handler.
Go into the "Events" tab in the main Project window and add a new handler for RequestFilter.filterRequest. Either leave the "Target" field empty for this to run on all requests, or specify the name of a TestStep for it to run only on that one TestStep.
Then enter the following script:
context.requestContent = context.requestContent.replace('<het4:Date></het4:Date>', '<het4:Date xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>')
which will do a simple string replace on the request content right before it is sent. If this particular element is empty, it will replace it with a null value (you could also strip it out entirely if you wanted). Hope this is what you needed! Good luck!
Regards,
Dain
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2009
03:47 AM
10-20-2009
03:47 AM
thanks, works fine with that.
that is exactly what i needed
regards,
Chris
that is exactly what i needed
regards,
Chris
