New Posts New Posts RSS Feed: Another Web Service Question
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Another Web Service Question

 Post Reply Post Reply
Author
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Topic: Another Web Service Question
    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);

Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 03-Apr-2009 at 2:37pm
And the entity (OrganizationGroup) that is returned by ParentOf is also a Web Method
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post 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).
 
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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).
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post 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."
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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 };
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down