Print Page | Close Window

Another Web Service Question

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1193
Printed Date: 23-Apr-2025 at 9:04pm


Topic: Another Web Service Question
Posted By: orcities
Subject: Another Web Service Question
Date Posted: 03-Apr-2009 at 2:30pm
I am still trying to get spans to work correctly. If I put a QuerySpan in that does not exist I get nothing. But, If I put one that does, and is webvisable, I get the following error:
 
{"The specified type was not recognized: name='ParentOf', namespace='http://ideablade.com/PersistenceWebService/Types/', at <ChildOf xmlns='http://ideablade.com/PersistenceWebService/Types/'>."}
 
The Entity Organization is a Web Method the Relation Property is WebServiceVisable.
 
If the span returns no values it passes. If the the span has values it throws the error.
 
Code: (Notice I am not reference ChildOf as it does in the error)

Query aQuery = new Query();

QueryClause aClause = new QueryClause();

aClause.ColumnName = "Name";

aClause.ColumnValue = "Oregon Cities";

aClause.Operator = QueryOp.EQ;

 

QuerySpan mOrgOrgGroupSpan = new QuerySpan();

mOrgOrgGroupSpan.Relations = new string[] { "ParentOf" };

 

aQuery.Spans = new QuerySpan[] { mOrgOrgGroupSpan };

 

aQuery.Expressions = new QueryExpression[] { aClause };

 

Organization[] mOrgs = mWebService.GetOrganizations(aQuery, String.Empty);




Replies:
Posted By: orcities
Date Posted: 03-Apr-2009 at 2:37pm
And the entity (OrganizationGroup) that is returned by ParentOf is also a Web Method


Posted By: kimj
Date Posted: 03-Apr-2009 at 4:09pm
First, if you haven't already checked it out, I would encourage you to take a look at the "Web Service Publishing" sample in the "300 Advanced" folder in the installed learning units.  The sample shows several types of queries with spans.
 
If it's still not making sense, please send your .ORM file and the generated webservice class to support.


Posted By: orcities
Date Posted: 06-Apr-2009 at 8:18am
I have sent the ORM.
 
One thing I have noticed. A span with a non overrided name works. The one I am having an issue with the property name has been changed from Organizations to ParentOf. This is because there was also another property Organizations that needed to be the children (ChildOf).
 
 


Posted By: kimj
Date Posted: 07-Apr-2009 at 1:18pm

This problem is due to a DevForce bug.  The serialized entity graph is not correct here because we're using the wrong type name when generating XML for null relational properties.

So, you've got -
 
Organization entity:
  - ParentOf  - returning a list of OrganizationGroups
  - ChildOf - returning a list of OrganizationGroups
  - ... other props
 
OrganizationGroup entity:
  - ParentOf - returning an Organization
  - ChildOf - returning an Organization
  - ... other props
 
When you call GetOrganizations with no spans in the query this will work and return only the requested organization(s).  Adding spans for either the ParentOf or ChildOf properties fails because the XML generator is confusing the various ParentOf/ChildOf properties with their entity types.  A workaround would be to retrieve organizations and organization groups in separate queries. 
 
We'll have this fixed in the next release (due in early May).


Posted By: orcities
Date Posted: 07-Apr-2009 at 1:24pm
This brings back the problem when I try and do a QueryOp.In.
 
"And because of this issue I am trying to do a work around by running multiple queries. Hopefully this does not become necessary.
 
In doing so I ran into an issue with using the QueryOp.In type of query. I have tried to use an string, object[], string[], Int64[], arraylist and list but they all return an error. String returns it has to be a collection and any collection returns:
The type xxx may not be used in this context."
 
Posted in: http://www.ideablade.com/forum/forum_posts.asp?TID=1187 - http://www.ideablade.com/forum/forum_posts.asp?TID=1187


Posted By: kimj
Date Posted: 07-Apr-2009 at 1:42pm
This works for me with your model:
 
Query aQuery = new Query();
QueryClause aClause = new QueryClause();
aClause.ColumnName = "Name";
aClause.ColumnValue = new string[] { "HQ", "South" };
aClause.Operator = QueryOp.In;
aQuery.Expressions = new QueryExpression[] { aClause };


Posted By: kimj
Date Posted: 07-Apr-2009 at 3:43pm
Hmm, I see that anything other than a string array does fail here, although the error is on the client side when sending the request to the web service.  I don't have an answer for that, but you can instead use the OR operator to build an expression with multiple or'ed clauses, or write a custom web method which instead of taking a query takes exactly the arguments you want.



Print Page | Close Window