Wrong number of arguments or invalid property assignment

V

vunet

Hello,
I've just installed ASPXMLRPC library and testing their main function:

xmlRPC ("URL", "command_name", params)

The function converts all parameters to XML, sends a request to third-
party server and receives XML response. It seems to be getting
response fine. But when I call the function like this:

myresp = xmlRPC ("http://someurl.com", "get", paramList)

I get error on this line:

"Wrong number of arguments or invalid property assignment"

All code details are:

dim myresp
ReDim paramList(1)
set dict=Server.createObject("Scripting.Dictionary")
dict.add "key_id", "SOME_ID"
dict.add "area", "blah"
set paramList(0)=dict
myresp = xmlRPC ("http://someurl.com", "get", paramList)
response.write(myresp)

Please recommend a fix. Thank you.
 
B

Bob Barrows [MVP]

vunet said:
Hello,
I've just installed ASPXMLRPC library and testing their main function:

xmlRPC ("URL", "command_name", params)

The function converts all parameters to XML, sends a request to third-
party server and receives XML response. It seems to be getting
response fine. But when I call the function like this:

myresp = xmlRPC ("http://someurl.com", "get", paramList)

I get error on this line:

"Wrong number of arguments or invalid property assignment"

Without access to the API documentation for that library, I'm afraid we are
not going to be able to help with this. I suggest you delve into that
documentation yourself, and if that fails you, contact the writer of the
class library for help.
 
V

vunet

Without access to the API documentation for that library, I'm afraid we are
not going to be able to help with this. I suggest you delve into that
documentation yourself, and if that fails you, contact the writer of the
class library for help.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

I thought it has something to do with syntax. Does this appear to be
correct calling the function

myresp = xmlRPC ("http://someurl.com", "get", paramList)

where returned result is a XML object response
 
A

Anthony Jones

vunet said:
Hello,
I've just installed ASPXMLRPC library and testing their main function:

xmlRPC ("URL", "command_name", params)

The function converts all parameters to XML, sends a request to third-
party server and receives XML response. It seems to be getting
response fine. But when I call the function like this:

myresp = xmlRPC ("http://someurl.com", "get", paramList)

I get error on this line:

"Wrong number of arguments or invalid property assignment"

All code details are:

dim myresp
ReDim paramList(1)
set dict=Server.createObject("Scripting.Dictionary")
dict.add "key_id", "SOME_ID"
dict.add "area", "blah"
set paramList(0)=dict
myresp = xmlRPC ("http://someurl.com", "get", paramList)
response.write(myresp)

Please recommend a fix. Thank you.

I don't know the xmlRPC product, however, I would hazard a guess that you
can't pass a reference to a dictionary object to a remote location in the
manner you appear to be attempting.

I suspect its not expecting any element of the paramList array to be an
object (or at least any object should have a default property that isn't an
object).
 
V

vunet

I don't know the xmlRPC product, however, I would hazard a guess that you
can't pass a reference to a dictionary object to a remote location in the
manner you appear to be attempting.

I suspect its not expecting any element of the paramList array to be an
object (or at least any object should have a default property that isn't an
object).

I tested the function and it runs perfectly fine: it takes dictionary
object, builds XML correctly, sends XML and I get responseText and
responseXML successfully.
But calling the function produces that error in that same line where I
call it:

Wrong number of arguments or invalid property assignment

line: myresp = xmlRPC ("http://someurl.com", "get", paramList)
 
B

Bob Barrows [MVP]

vunet said:
I thought it has something to do with syntax. Does this appear to be
correct calling the function

myresp = xmlRPC ("http://someurl.com", "get", paramList)

where returned result is a XML object response

No. Use Set to set object variables.

Set myresp = xmlRPC ("http://someurl.com", "get", paramList)

But I don't think that's what the error message is referring to. it could
be, but i don't think it is.
 
D

daddywhite

No. Use Set to set object variables.

Set myresp = xmlRPC ("http://someurl.com", "get", paramList)

But I don't think that's what the error message is referring to. it could
be, but i don't think it is.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Have you tried this without the brackets? so just:

Set myresp = xmlRPC "http://someurl.com", "get", paramList
 
V

vunet

No. Use Set to set object variables.

Set myresp = xmlRPC ("http://someurl.com", "get", paramList)

But I don't think that's what the error message is referring to. it could
be, but i don't think it is.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Using Set myresp = xmlRPC ("http://someurl.com", "get", paramList) is
fine but it then generates the same error in the next line where I am
using response.write:

response.write(myresp) ' ===> error Wrong number of arguments or
invalid property assignment

How do I display that result once I set "myresp"? If this is an XML
file...
Thank you
 
B

Bob Barrows [MVP]

vunet said:
Using Set myresp = xmlRPC ("http://someurl.com", "get", paramList) is
fine but it then generates the same error in the next line where I am
using response.write:

response.write(myresp) ' ===> error Wrong number of arguments or
invalid property assignment

How do I display that result once I set "myresp"? If this is an XML
file...
Thank you

Obviously, myresp is an object that does not have a default property that is
implicilty convertible to a string. I suspect myresp is an xml document (you
can use "response.write typename(myresp)" to be sure). If it is, you can
response.write its xml property:
response.write myresp.xml

If it isn't, we're still in the dark. Don't you have any documentation for
this library?
 
V

vunet

Obviously, myresp is an object that does not have a default property that is
implicilty convertible to a string. I suspect myresp is an xml document (you
can use "response.write typename(myresp)" to be sure). If it is, you can
response.write its xml property:
response.write myresp.xml

If it isn't, we're still in the dark. Don't you have any documentation for
this library?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

typename(myresp) is a dictionary object. I guess I have to loop
through the object and display all its key-values.
Thanks for your help
 
V

vunet

Obviously, myresp is an object that does not have a default property that is
implicilty convertible to a string. I suspect myresp is an xml document (you
can use "response.write typename(myresp)" to be sure). If it is, you can
response.write its xml property:
response.write myresp.xml

If it isn't, we're still in the dark. Don't you have any documentation for
this library?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

When I loop though dictionary the type of value is Variant(). See
below:

For Each key In myresp
response.write "<b>"&key&"</b> - "&typename(myresp(key))&"<br>"
Next

produces:
items - Variant()
total - Long

I do not think this library explains or gives the samples. I think I
am left alone with dictionary object which probably looks like multi-
dictionary object created from XML file.
How would you recommend looping further with Variant()?
Thank you very much
 
B

Bob Barrows [MVP]

vunet said:
When I loop though dictionary the type of value is Variant(). See
below:

For Each key In myresp
response.write "<b>"&key&"</b> - "&typename(myresp(key))&"<br>"
Next

produces:
items - Variant()
total - Long

I do not think this library explains or gives the samples. I think I
am left alone with dictionary object which probably looks like multi-
dictionary object created from XML file.
How would you recommend looping further with Variant()?
Thank you very much

It's a Variant array. Loop through it as you would any other array.
Either

for each itm in myresp("items")
response.write typename(itm)
next

or

ar=myresp("items")
for i = 0 to ubound(myresp("items"))
response.write typename(ar(i))
next

If the typename results are datatypes that can be converted to strings,
you are there.


Does the "total" item contain any relevant information in its value?
 
V

vunet

It's a Variant array. Loop through it as you would any other array.
Either

for each itm in myresp("items")
response.write typename(itm)
next

or

ar=myresp("items")
for i = 0 to ubound(myresp("items"))
response.write typename(ar(i))
next

If the typename results are datatypes that can be converted to strings,
you are there.

Does the "total" item contain any relevant information in its value?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Perfect! It was a multidictionary object and I just used your
suggested
ar=myresp("items")
for i = 0 to ubound(myresp("items"))
response.write typename(ar(i))
next
to loop though each deeper and deeper if array's element is dictionary
again.
I really appreciate. Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top