2

I am trying to write a soap parameter in REALbasic.

I need to add an array within another array similar to this in php:

 $params = array(array(
     'sku' => 'some sku'
 ));

so I can pass this:

$result = $client->call($session, 'catalog_product.list', $params);

I have

  dim aArgs  (0,1) as String
  dim aParmas  (0,1) as String
  aArgs(0,0)="sku"
  aArgs(0,1)="some sku"
  aParmas(0,1)= aArgs

But receive a "Type mismatch error. Expected String, but got String(,)"

How can I do this.

Thanks

Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
rayron
  • 21
  • 4

2 Answers2

1

First off, the line

aParmas(0,1)= aArgs

is wrong because you assign an array (which is in aArgs) to a single element of aParmas. And since those single elements hold a String, you try to assign an array to a single string here, hence the error message.

But I think you're looking at this from the wrong end. You need to start with figuring out what parameters you need to send to the session function you want to call.

That means: You need to find the REALbasic function for $client->call. Once you know which function that is, look at the parameters that function expects. I doubt it expects a two-dimensional array for the "params". Once you know what to pass here, let us know if you still cannot figure out how to get it working.

Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
0

An explanation of multidimensional arrays in REALbasic is here

The short answer is that you can't have a PHP-like array of arrays. You need to wrap your array in a class and make the class behave like an array.

Any reason you're using REALbasic? If it's cross-platform you're after, python is ALWAYS a better choice

hammus
  • 2,602
  • 2
  • 19
  • 37
  • The solution is correct, but the assertion that python is "ALWAYS" better is very subjective. – mjdth Dec 09 '13 at 20:19
  • In this case I stand by the assessment. A huge community, superior documentation, pythonic readability. I have used both languages extensively and would like to hear arguments otherwise. – hammus Dec 09 '13 at 20:40
  • Just getting started with python and making a compiled app is much more complicated than the Xojo workflow of simply selecting a platform and pressing Build. While Python might be better in many cases, there are plenty of situations where it would be easier and quicker to do the same thing in Xojo. For instance, there is need for a topic like this for Xojo: http://stackoverflow.com/questions/2933/an-executable-python-app – mjdth Dec 09 '13 at 21:16