Post

1 follower Follow
0
Avatar

Xml query erroring out with the correct xsl

Hi All,

 

Do you know why the xml is erroring out on query when it has the correct xsl tg?

this is erroring out:

<Query xmlns=" [http://clarizen.com/api](http://clarizen.com/api)" xmlns:xsi=" [http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)">

<queryExpression xmlns:q1=" [http://clarizen.com/api/queries](http://clarizen.com/api/queries)" xsi:type="q1:EntityQuery">

<q1:Paging xsi:nil="true" />

q1:Fields<string>Phase</string>

<string>Project</string><string>LastUpdatedOn</string>/q1:Fields

<q1:Orders xsi:nil="true" />

q1:TypeNameProject/q1:TypeName

<q1:Where xsi:type="q1:Compare">

<q1:LeftExpression xsi:type="q1:FieldExpression">q1:FieldNameLastUpdatedOn/q1:FieldName/q1:LeftExpression

q1:OperatorGreaterThan/q1:Operator<q1:RightExpression xsi:type="q1:ConstantExpression">

<q1:Value xsi:type="xsd:dateTime">2015-01-01T00:00:00.000000/q1:Value/q1:RightExpression/q1:Where

</queryExpression>

</Query>

 

With the error message:

<s:Fault xmlns:s=" [http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)">

<faultcode xmlns:a=" [http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode](http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher%22%3Ea:DeserializationFailed%3C/faultcode)>

<faultstring xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter  http://clarizen.com/api:queryExpression. The InnerException message was 'Error in line 1 position 870. Element ' http://clarizen.com/api/queries:Value&apos; contains data from a type that maps to the name ':dateTime'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'dateTime' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.</faultstring>

<detail>

<ExceptionDetail xmlns=" [http://schemas.datacontract.org/2004/07/System.ServiceModel](http://schemas.datacontract.org/2004/07/System.ServiceModel)" xmlns:i=" [http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)">

<HelpLink i:nil="true"/>

<InnerException>

<HelpLink i:nil="true"/>

<InnerException i:nil="true"/>

<Message>Error in line 1 position 870. Element ' http://clarizen.com/api/queries:Value&apos; contains data from a type that maps to the name ':dateTime'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'dateTime' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.</Message>

<StackTrace> at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

at ReadConstantExpressionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )

at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

at ReadCompareFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )

at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

at ReadEntityQueryFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )

at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeser 

------------------- 

If I take out the xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" it is fine (but my xml parser accept only correctly specified xmls) 

so whith this the query is ok: <Query xmlns=" [http://clarizen.com/api](http://clarizen.com/api)"> 

but in this case the xsi is not specified! 

Regards

Gergo

 

Gergo Bacskai Answered

Please sign in to leave a comment.

2 comments

0
Avatar

Hi Gergo,

I wonder what platform/development environment you are using if you need to directly control construction of SOAP messages. Usually it's done by some kind of SOAP library. You may find  Clarizen Rest API V2.0 useful if you are not too deep into SOAP.

Check this link to get started: https://success.clarizen.com/entries/89516637-Clarizen-REST-API-Version-2-0

The little I've seen with working SOAP messages is that  xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" appears in the soap:Envelope, not the Query Tag.

Hope this helps,

Ophir 

Ophir Kenig 0 votes
Comment actions Permalink