Hi Daniel,

I will take a shot at this, as I have done some work w/ webservices and Flash. What is your webservice expecting? It looks to me that you want to pass in an array of structures, each element being of type DBCondition.

e.g.
<sequence>
   <complexType name="DBCondition">
       <element name="entry1" type="anyType"/>
      <element name="entry2" type="anyType"/>
      <element name="op" type="string"/>
   </complexType>
   <complexType name="DBCondition">
       <element name="entry1" type="anyType"/>
      <element name="entry2" type="anyType"/>
      <element name="op" type="string"/>
   </complexType>
   <complexType name="DBCondition">
       <element name="entry1" type="anyType"/>
      <element name="entry2" type="anyType"/>
      <element name="op" type="string"/>
   </complexType>
</sequence>


Your code references DBConditions nested w/in DBConditions. Seems like it is being made more difficult than necessary.

By using a simple array of structs:

  sequence = ArrayNew(1);
  DBCondition = StructNew();
  DBCondition.entry1 = "Name";
  DBCondition.entry2 = "love";
  DBCondition.op = "CONTAINS_ANY";
  ArrayAppend(sequence, DBCondition);
   ...
   ArrayAppend(sequence, DBCondition2);
   ...
   ArrayAppend(sequence, DBCondition3);
   etc.

That will certainly make parsing things on the CFC side much easier, b/c you do not have to parse the contents of entry1, entry2, etc. Just loop through the array:

condition = "WHERE 1=1";
for( i=0; i LTE ArrayLen( seqence ) ; i = i + 1 )
{
condition = condition & " AND " & sequence[i].entry1 & sequence[i].op & "'" & sequence[i].entry2 & "'";
}

Does that help?


Daniel Niklasson wrote:


This is really offtopic but I'm desperate. I need to fix this today! :(

<complexType name="DBCondition">
   <sequence>
       <element name="entry1" type="anyType"/>
       <element name="entry2" type="anyType"/>
       <element name="op" type="string"/>
   </sequence>
</complexType>

That's an webservice complex type.

   DBCondition = StructNew();
   DBCondition.entry1 = "Name";
   DBCondition.entry2 = "love";
   DBCondition.op = "CONTAINS_ANY";

This code works just fine, returning all objects that contains the word "love" in the field "Name". But when I try to have another DBCondition as entry1 and another one as entry2 I get serialization error from axis. What I tried was...

   DBCondition = StructNew();

   DBCondition.entry1 = StructNew();
   DBCondition.entry1.entry1 = "Person";
   DBCondition.entry1.entry2 = "Madonna";
   DBCondition.entry1.op = "=";

   DBCondition.entry2 = StructNew();
   DBCondition.entry1.entry1 = "Profession";
   DBCondition.entry1.entry2 = "-1";
   DBCondition.entry1.op = "=";

   DBCondition.op = "AND";

... I've also tried creating a cfc and using that instead of StructNew(), then I got "webservice with properties ... could not be found". Here's the example in java... (which should work with generated stubs)..

new DBCondition("AND",
new DBCondition("=","Person","Madonna"), new DBCondition("=","Profession","-1") )

... and finally I've tried to use the java stub type objects directly in ColdFusion but when I send it to the webservice I get "java.lang.IllegalArgumentException: argument type mismatch".

Anyone?

/ daniel


Reply via email to