Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > error accessing property of an object

Reply
Thread Tools

error accessing property of an object

 
 
Kevin Blount
Guest
Posts: n/a
 
      06-13-2007
I'm tyring to access an object created by using a method from a third
party API. The documentation tells me what object should be return,
and the properties of that object, but when I try and access one of
those properties I've shown an error message saying that the Object
doesn't support this property or method. Here's the code I'm using
(edited to protect the third party NDA)

[script]
1: <%
2: dim siteApi, userApi
3: dim userObj
4: dim session, user_date_created
5:
6: set siteApi = createobject("MSSoap.SoapClient30")
7: siteApi.mssoapinit("http://thirdparty.domain/site/api?wsdl")
8:
9: set userApi = createobject("MSSoap.SoapClient30")
10: userApi.mssoapinit("http://thirdparty.domain/user/api?wsdl")
11:
12: session = siteApi.login("username","p@ssw0rd")
13:
14: set userObj = userApi.getUser(session,"webadmins")
15:
16: user_date_created = userObj.date_created
17: %>
[/script]

In the above code, the session variable is populated with the correct
info (a HEX string), suggesting that my siteApi object is being
created and used correctly. However, I get the following error when I
run it without line 16 commented out:

[error]
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'date_created'

/soapTest/index.asp, line 16
[/error]

The documentation for the user API does show that 'date_created' is a
property of the UserStruct object, returned by the 'getUser' method,
so I'm readlly confused why this won't work.

Is there anything fundamentally wrong with my script? If not, is there
any ASP I can use to see what properties are available with the
userObj?

Thanks for any help you can offer

Kevin

 
Reply With Quote
 
 
 
 
J. Anos
Guest
Posts: n/a
 
      06-13-2007
why would you not simply go to the third party who created this?!?



"Kevin Blount" <> wrote in message
news: oups.com...
> I'm tyring to access an object created by using a method from a third
> party API. The documentation tells me what object should be return,
> and the properties of that object, but when I try and access one of
> those properties I've shown an error message saying that the Object
> doesn't support this property or method. Here's the code I'm using
> (edited to protect the third party NDA)
>
> [script]
> 1: <%
> 2: dim siteApi, userApi
> 3: dim userObj
> 4: dim session, user_date_created
> 5:
> 6: set siteApi = createobject("MSSoap.SoapClient30")
> 7: siteApi.mssoapinit("http://thirdparty.domain/site/api?wsdl")
> 8:
> 9: set userApi = createobject("MSSoap.SoapClient30")
> 10: userApi.mssoapinit("http://thirdparty.domain/user/api?wsdl")
> 11:
> 12: session = siteApi.login("username","p@ssw0rd")
> 13:
> 14: set userObj = userApi.getUser(session,"webadmins")
> 15:
> 16: user_date_created = userObj.date_created
> 17: %>
> [/script]
>
> In the above code, the session variable is populated with the correct
> info (a HEX string), suggesting that my siteApi object is being
> created and used correctly. However, I get the following error when I
> run it without line 16 commented out:
>
> [error]
> Microsoft VBScript runtime error '800a01b6'
>
> Object doesn't support this property or method: 'date_created'
>
> /soapTest/index.asp, line 16
> [/error]
>
> The documentation for the user API does show that 'date_created' is a
> property of the UserStruct object, returned by the 'getUser' method,
> so I'm readlly confused why this won't work.
>
> Is there anything fundamentally wrong with my script? If not, is there
> any ASP I can use to see what properties are available with the
> userObj?
>
> Thanks for any help you can offer
>
> Kevin
>


 
Reply With Quote
 
 
 
 
Kevin Blount
Guest
Posts: n/a
 
      06-13-2007
On Jun 13, 11:09 am, "J. Anos" <j...@anos.com> wrote:
> why would you not simply go to the third party who created this?!?
>
> "Kevin Blount" <kevin.blo...@gmail.com> wrote in message
>
> news: oups.com...
>
>
>
> > I'm tyring to access an object created by using a method from a third
> > party API. The documentation tells me what object should be return,
> > and the properties of that object, but when I try and access one of
> > those properties I've shown an error message saying that the Object
> > doesn't support this property or method. Here's the code I'm using
> > (edited to protect the third party NDA)

>
> > [script]
> > 1: <%
> > 2: dim siteApi, userApi
> > 3: dim userObj
> > 4: dim session, user_date_created
> > 5:
> > 6: set siteApi = createobject("MSSoap.SoapClient30")
> > 7: siteApi.mssoapinit("http://thirdparty.domain/site/api?wsdl")
> > 8:
> > 9: set userApi = createobject("MSSoap.SoapClient30")
> > 10: userApi.mssoapinit("http://thirdparty.domain/user/api?wsdl")
> > 11:
> > 12: session = siteApi.login("username","p@ssw0rd")
> > 13:
> > 14: set userObj = userApi.getUser(session,"webadmins")
> > 15:
> > 16: user_date_created = userObj.date_created
> > 17: %>
> > [/script]

>
> > In the above code, the session variable is populated with the correct
> > info (a HEX string), suggesting that my siteApi object is being
> > created and used correctly. However, I get the following error when I
> > run it without line 16 commented out:

>
> > [error]
> > Microsoft VBScript runtime error '800a01b6'

>
> > Object doesn't support this property or method: 'date_created'

>
> > /soapTest/index.asp, line 16
> > [/error]

>
> > The documentation for the user API does show that 'date_created' is a
> > property of the UserStruct object, returned by the 'getUser' method,
> > so I'm readlly confused why this won't work.

>
> > Is there anything fundamentally wrong with my script? If not, is there
> > any ASP I can use to see what properties are available with the
> > userObj?

>
> > Thanks for any help you can offer

>
> > Kevin- Hide quoted text -

>
> - Show quoted text -


The third party does not support my coding, and I suspect that my
coding is at fault here. Unless I can verify that my code is fine, the
door is open for the third party to say "it's your code, not our API".

 
Reply With Quote
 
Kevin Blount
Guest
Posts: n/a
 
      06-13-2007
On Jun 13, 12:19 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere
dot com> wrote:
> perhaps the API is case sensitive ?
>
> "Kevin Blount" <kevin.blo...@gmail.com> wrote in messagenews: ooglegroups.com...
> > I'm tyring to access an object created by using a method from a third
> > party API. The documentation tells me what object should be return,
> > and the properties of that object, but when I try and access one of
> > those properties I've shown an error message saying that the Object
> > doesn't support this property or method. Here's the code I'm using
> > (edited to protect the third party NDA)

>
> > [script]
> > 1: <%
> > 2: dim siteApi, userApi
> > 3: dim userObj
> > 4: dim session, user_date_created
> > 5:
> > 6: set siteApi = createobject("MSSoap.SoapClient30")
> > 7: siteApi.mssoapinit("http://thirdparty.domain/site/api?wsdl")
> > 8:
> > 9: set userApi = createobject("MSSoap.SoapClient30")
> > 10: userApi.mssoapinit("http://thirdparty.domain/user/api?wsdl")
> > 11:
> > 12: session = siteApi.login("username","p@ssw0rd")
> > 13:
> > 14: set userObj = userApi.getUser(session,"webadmins")
> > 15:
> > 16: user_date_created = userObj.date_created
> > 17: %>
> > [/script]

>
> > In the above code, the session variable is populated with the correct
> > info (a HEX string), suggesting that my siteApi object is being
> > created and used correctly. However, I get the following error when I
> > run it without line 16 commented out:

>
> > [error]
> > Microsoft VBScript runtime error '800a01b6'

>
> > Object doesn't support this property or method: 'date_created'

>
> > /soapTest/index.asp, line 16
> > [/error]

>
> > The documentation for the user API does show that 'date_created' is a
> > property of the UserStruct object, returned by the 'getUser' method,
> > so I'm readlly confused why this won't work.

>
> > Is there anything fundamentally wrong with my script? If not, is there
> > any ASP I can use to see what properties are available with the
> > userObj?

>
> > Thanks for any help you can offer

>
> > Kevin


Thanks for the suggestions, but all the cases used above are per the
documentation (assuming the documentation is right )

I'm guess by that comment, you don't see anything noticeably wrong
with my code?

 
Reply With Quote
 
Kevin Blount
Guest
Posts: n/a
 
      06-13-2007
On Jun 13, 2:03 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere
dot com> wrote:
> The error message is pretty specific.
>
> Not sure what else is possible, since we know nothing of the API . You have either instantiated the wrong object or the
> method/property doesn't exist for that object.
>
>
>
> "Kevin Blount" <kevin.blo...@gmail.com> wrote in messagenews: oglegroups.com...
> > On Jun 13, 12:19 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere
> > dot com> wrote:
> >> perhaps the API is case sensitive ?

>
> >> "Kevin Blount" <kevin.blo...@gmail.com> wrote in messagenews: ooglegroups.com...
> >> > I'm tyring to access an object created by using a method from a third
> >> > party API. The documentation tells me what object should be return,
> >> > and the properties of that object, but when I try and access one of
> >> > those properties I've shown an error message saying that the Object
> >> > doesn't support this property or method. Here's the code I'm using
> >> > (edited to protect the third party NDA)

>
> >> > [script]
> >> > 1: <%
> >> > 2: dim siteApi, userApi
> >> > 3: dim userObj
> >> > 4: dim session, user_date_created
> >> > 5:
> >> > 6: set siteApi = createobject("MSSoap.SoapClient30")
> >> > 7: siteApi.mssoapinit("http://thirdparty.domain/site/api?wsdl")
> >> > 8:
> >> > 9: set userApi = createobject("MSSoap.SoapClient30")
> >> > 10: userApi.mssoapinit("http://thirdparty.domain/user/api?wsdl")
> >> > 11:
> >> > 12: session = siteApi.login("username","p@ssw0rd")
> >> > 13:
> >> > 14: set userObj = userApi.getUser(session,"webadmins")
> >> > 15:
> >> > 16: user_date_created = userObj.date_created
> >> > 17: %>
> >> > [/script]

>
> >> > In the above code, the session variable is populated with the correct
> >> > info (a HEX string), suggesting that my siteApi object is being
> >> > created and used correctly. However, I get the following error when I
> >> > run it without line 16 commented out:

>
> >> > [error]
> >> > Microsoft VBScript runtime error '800a01b6'

>
> >> > Object doesn't support this property or method: 'date_created'

>
> >> > /soapTest/index.asp, line 16
> >> > [/error]

>
> >> > The documentation for the user API does show that 'date_created' is a
> >> > property of the UserStruct object, returned by the 'getUser' method,
> >> > so I'm readlly confused why this won't work.

>
> >> > Is there anything fundamentally wrong with my script? If not, is there
> >> > any ASP I can use to see what properties are available with the
> >> > userObj?

>
> >> > Thanks for any help you can offer

>
> >> > Kevin

>
> > Thanks for the suggestions, but all the cases used above are per the
> > documentation (assuming the documentation is right )

>
> > I'm guess by that comment, you don't see anything noticeably wrong
> > with my code?- Hide quoted text -

>
> - Show quoted text -


OK, that sounds like 2 reasonable assumptions. Do you know of any ASP
code that I can use to 'look inside' the object?

Since I last replied I've done some digging, and found that
userObj.length returns a value of 11. This almost matches the number
of documented properties of the expected returned object, which is 10.
Using another of the APIs provided by the third party, I checked the
length property and it returned 24, which again is close the 23
documented properties of that returned object.

My guess is that the object I'm creating does contain the info I
need... I'm just not using the right property names or syntax (or
something!!) to retrieve it. If I could loop through the object
somehow and list all the properties, that would help immensely.

Any ideas?

 
Reply With Quote
 
Ayush
Guest
Posts: n/a
 
      06-13-2007
[Kevin Blount] wrote-:
> If I could loop through the object
> somehow and list all the properties, that would help immensely.


In JScript:

1: siteApi = new ActiveXObject("MSSoap.SoapClient30")
2: siteApi.mssoapinit("http://thirdparty.domain/site/api?wsdl")
3:
4: userApi = new ActiveXObject("MSSoap.SoapClient30")
5: userApi.mssoapinit("http://thirdparty.domain/user/api?wsdl")
6:
7: session = siteApi.login("username","p@ssw0rd")
8:
9: userObj = userApi.getUser(session,"webadmins")
10:
11: list='Property/Method Name: Property/Method Value'
12: for(prop in userObj)
13: list+=prop + ": "+userObj[prop]+"\n"
14: WScript.Echo(list)


Good Luck, Ayush.
--
Scripting Home : http://snipurl.com/Scripting_Home
 
Reply With Quote
 
Kevin Blount
Guest
Posts: n/a
 
      06-14-2007
On Jun 13, 4:45 pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> [Kevin Blount] wrote-:
>
> > If I could loop through the object
> > somehow and list all the properties, that would help immensely.

>
> In JScript:
>
> 1: siteApi = new ActiveXObject("MSSoap.SoapClient30")
> 2: siteApi.mssoapinit("http://thirdparty.domain/site/api?wsdl")
> 3:
> 4: userApi = new ActiveXObject("MSSoap.SoapClient30")
> 5: userApi.mssoapinit("http://thirdparty.domain/user/api?wsdl")
> 6:
> 7: session = siteApi.login("username","p@ssw0rd")
> 8:
> 9: userObj = userApi.getUser(session,"webadmins")
> 10:
> 11: list='Property/Method Name: Property/Method Value'
> 12: for(prop in userObj)
> 13: list+=prop + ": "+userObj[prop]+"\n"
> 14: WScript.Echo(list)
>
> Good Luck, Ayush.
> --
> Scripting Home :http://snipurl.com/Scripting_Home


Hi Ayush,

Thanks for the response. I was able to figure out where I was going
wrong yesterday, and it was as I suspected part of my code. I had to
remember that the returned object was XML, and then I went out
searching and found a way to check the contents, or in better terms,
the nodes inside the object.

The script I found turns out to match your suggestion, execpt for
being in VBscript not JScript:

for each node In userApi
Response.Write("[" & node.nodeName & "]{" & node.Text & "}")
next

>From that I was able to find the node IDs, and then user_date_created

variable could be populated using:

user_date_created = userObj(.Text (where 8 is the internal ID of the
date I need, based on 0 thru 7 being other info)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding to property of property of object collection TS ASP .Net 3 08-31-2006 12:57 PM
object property as reference for html object torbs Javascript 2 04-21-2006 06:13 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
DataBinder.Eval for an object's property property... like Eval(Container.DataItem,"Version.Major") Eric Newton ASP .Net 3 04-04-2005 10:11 PM
COM object accessing asp Application object mrrrk ASP .Net 1 12-19-2003 09:37 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57