The 1.1 bindings have the same error. David
On 12/11/2009 5:47 AM, Gabriel Roldan wrote:
> Hi,
>
> >> Configuration c = new org.geotools.wfs.v1_0.WFSConfiguration();
>
> Try with a 1.1 configuration. The bindings for 1.0 were never tried
> out because the 1.0 datastore uses an older technology. That is, the
> whole 1.0 DataStore needs to be ported to the new tech but never had
> the time yet.
>
> Cheers,
> Gabriel
>
> Justin Deoliveira wrote:
>> Hi David,
>>
>> Yup, looks like a bug to me. What makes me wonder is how the wfs
>> datastore functions since i believe it uses this code to make
>> requests. Although it be preferring GET to make requests. Perhaps
>> Gabriel can commend.
>>
>> But yeah, looks like a bug, the patch should be simple enough. If you
>> whip it up and all the test cases pass that would be good enough for me.
>>
>> -Justin
>>
>> David R Robison wrote:
>>> I am trying to serialize a WFS GetFeature request back to XML. I
>>> setup my code as follows:
>>>
>>> Configuration c = new org.geotools.wfs.v1_0.WFSConfiguration();
>>> Encoder e = new Encoder( c );
>>> e.setIndenting(true);
>>> e.encode( object, new QName( c.getXSD().getNamespaceURI(),
>>> "GetFeature" ), System.out );
>>>
>>> However, I get the following error:
>>>
>>> Caused by: java.lang.ClassCastException: javax.xml.namespace.QName
>>> cannot be cast to java.lang.String
>>> at
>>> org.geotools.wfs.bindings.QueryTypeBinding.getProperty(QueryTypeBinding.java:192)
>>>
>>>
>>> at
>>> org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:91)
>>>
>>>
>>>
>>> It seems like the problem is in the
>>> org.geotools.wfs.bindings.QueryTypeBinding getProperty function. The
>>> XSD defines typeName as a QName but the code looks like it expects
>>> it to be a String:
>>>
>>> public Object getProperty(Object object, QName name) throws Exception {
>>> if ("typeName".equals(name.getLocalPart())) {
>>> QueryType query = (QueryType) object;
>>> List typeName = query.getTypeName();
>>> StringBuilder typeNameList = new StringBuilder();
>>> if (typeName != null) {
>>> for (Iterator<String> it = typeName.iterator();
>>> it.hasNext();) {
>>> typeNameList.append(it.next());
>>> if (it.hasNext()) {
>>> typeNameList.append(",");
>>> }
>>> }
>>> }
>>> return typeNameList.toString();
>>> } else if ("SortBy".equals(name.getLocalPart())) {
>>> QueryType query = (QueryType) object;
>>> List sortBy = query.getSortBy();
>>> if (sortBy != null && sortBy.size() == 0) {
>>> return null;
>>> }
>>> }
>>>
>>> return super.getProperty(object, name);
>>> }
>>>
>>> Am I reading this right? Any ideas?
>>>
>>> Thanks, David
>>>
>>
>
>
--
David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: [email protected]
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/bookstore/bookdetail.php?PB_ISBN=9781597816526
This e-mail communication (including any attachments) may contain confidential
and/or privileged material intended solely for the individual or entity to
which it is addressed. If you are not the intended recipient, you should
immediately stop reading this message and delete it from all computers that it
resides on. Any unauthorized reading, distribution, copying or other use of
this communication (or its attachments) is strictly prohibited. If you have
received this communication in error, please notify us immediately.
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users