我是使用VBScript的ASP的新手,当我想要获取并使用我的ASP代码中的Web方法的返回值时,我遇到了一个问题。 有一个名为getQuote的web方法,它接受一个字符串 表示符号作为参数,并返回一个 的数组" BTQuote"包含每个符号信息的对象。 此外,还有一个由 IDE自动生成的代理对象。这个代理对象被包装为COM tlb并部署在 服务器上,正确,我很有信心。 我想编写ASP代码得到返回的BTQuote数组,以便我可以显示信息,有人可以告诉我该怎么做吗? ps,我已经写了以下代码启动服务 对象,它工作正常: 设置btService = Server.CreateObject(" BTLib.BTDemoService") /// /////如何获得此返回值? = btService.getQuote(" bidu") 任何建议都必须受到赞赏。
I''m a novice on ASP using VBScript, and I encountered a problem when I want to get and use a return value of a web method in my ASP code. There is a web method called "getQuote", which takes a string indicating the symbols as its parameter, and return an array of "BTQuote" objects which contain the info of every symbol respectively. Also, there is a proxy object which is generated automatically by the IDE. This proxy object is wrapped as a COM tlb and deployed on the server, correctly, i''m sure. I want to write ASP code to get the returned "BTQuote" array so that I can show the information, can anybody tell me how to do that ? ps, I''ve already written the following code to initiate a service object, it worked fine: Set btService = Server.CreateObject("BTLib.BTDemoService") ////////How do I get this return value? = btService.getQuote("bidu") Any suggestion must be appreciated.
推荐答案这样的事情: - Dim aoBTQuote Dim oBTQuote aoBTQuote = btService.getQuote( bidu) 每个oBTQuote在aoBTQuote中 ''用oBTQuote做的东西 下一个 Anthony。 Something like this:- Dim aoBTQuote Dim oBTQuote aoBTQuote = btService.getQuote("bidu") For Each oBTQuote In aoBTQuote ''do stuff with oBTQuote Next Anthony.
它抛出了一个错误。 错误类型: Microsoft VBScript运行时(0x800A000D) 类型不匹配 此行中的:对于aoBTQuote中的每个oBTQuote 并且通过使用Response.write typename(aoBTQuote),我得到unknown()类型。 这是否意味着我无法获得数组类型的返回值? 谢谢 约翰逊 Hi, it threw out a error. Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch in this line: For Each oBTQuote In aoBTQuote and by using Response.write typename(aoBTQuote), I get unknown() type. does that mean I cannot get the array typed return value? thanks Johnson
我通过更改我的网络方法的返回类型进行另一项测试到 BTQuote,和我的asp代码如下 Dim oBTQuote 设置btService = Server.CreateObject(" BTLib2.BTDemoService") oBTQuote = btService.GetQuote(" bidu") Response.write typename(oBTQuote) Response.write oBTQuote 结果如下所示: String BTLib2.BTQuote 我不知道为什么会发生这种情况,方法必须返回一个BTQuote值, 但它会返回一个字符串,表示 返回值的实际类型,有谁知道为什么?谢谢 海洋 I make another test by change the return type of my web method to BTQuote, and my asp code as follows Dim oBTQuote Set btService = Server.CreateObject("BTLib2.BTDemoService") oBTQuote = btService.GetQuote("bidu") Response.write typename(oBTQuote) Response.write oBTQuote The result is shown as: String BTLib2.BTQuote I don''t know why this happens, the method must return a BTQuote value, but instead, it returns a string which indicates the actual type of the return value, anyone know why? thank Ocean
更多推荐
如何在ASP中获取Web服务方法的返回值(数组类型)
发布评论