» WCF xs:date using Groovy
WCF xs:date using Groovy
|September 12, 2014
Posted by forumadmin
I have a WSDL I need to write a WCF client against (in C#). In the WSDL one of the elements is:
<xs:element name="TransactionDateTime" type="xs:date" />
For the moment I’m using a mock service created through SoapUI with that wsdl, so I can get mock responses where I’m trying to populate that TransactionDateTime using a groovy script.
My problem is whatever I use it seems to raise an exception in the client when trying to deserialize the reply body
String was not recognized as a valid DateTime
These are examples of what I’ve tried to return in the groovy script
new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())
If I try to hardcode it in the xml that I use as a response as
which is by the way the format specified in the docs that came along with the WSDL it raises the same exception
Further more if I just hard code in the response a date like this ‘2014-09-12′ instead of raising an exception it populates it as 01/01/0001 00:00:00 in the DateTime property of the C# class the response is populating
Can anyone give me any hint on which path should I follow?
Wasn’t 100% sure but I reckon the reason is the same as for this question or explained in other webs, WCF doesn’t support xs:date. So I would ask the third party to change the WSDL and send the date as a string that I will parse. Can’t thinkg of a better option
More Related Questions
- XML to JSON with Groovy XmlSlurper and JsonBuilder I am trying to take an XML file and convert it into a JSON document using Groovy, specifically with XmlSlurper and JsonBuilder. I can do this fairly easily if I hard code everything, but […]
- Groovy MetaClass change to Service Under Test is not used by Spock Within a Spock unit test, I am trying to test the behaviour of a method findRepositoriesByUsername independent of getGithubUrlForPath, both belonging to the same service.
- Mocking extended java classes in groovy How can I mock java classes extended by groovy (Input/Output Stream) in groovy test? I tried mockito and groovy mocks but with no luck. Is there any way it can work? Any java/groovy […]
- Data Driven Testing in Grails with Spock and a Service class I'm trying to write an integration test for my Grails service class using Spock.
To get some data to drive the test, I have a query like this:
"select column1, column2, column3 from table […]
- Groovy XmlSlurper method to create GPath I'm trying to parse a large XML file to covert into a JSON document and I'd like to create a method to construct the XmlSlurper find expression, but I'm having trouble with it.
Here is a […]
- @Builder in Groovy 2.3.0 I'm trying to run the simple @Builder example shown on the Groovy 2.3 release page, using IntelliJ Idea 13.1.1.
Having created a vanilla groovy project and pasted the code, I get the […]
- WCFTestClient The HTTP request is unauthorized with client authentication scheme Anonymous I've created one WCF service and deployed it on Server. When I browse this service it gives me positive response with ?wsdl URL. Now I'm trying to test the service through WCF Test client. […]
- WCF Windows form client object reference error I've done a wcflibrary and hosted this in a windows service. For the client I did a windows form. But now when I try to run the windows form it says:
Object reference not set to an […]
- Changing JVM version used by Groovy builds in Drone.io I am working on a Java test project using Cassandra for persistence and Achilles as my client API for Cassandra. Also, for testing purposes I am running Gradle builds on this project in […]
- Connector error when connecting to websphere jmx using groovy I need to connect to websphere jmx with groovy: host is input argument
def urlRuntime = '/jndi/JMXConnector'
def urlBase = 'service:jmx:iiop://' + host
def serviceURL = new […]