adamzad General User


Joined: 08 Mar 2011 Posts: 16 Location: Buena Park, CA, USA
|
Posted: Thu May 12, 2011 8:55 pm Post subject: Syntax for "POST" Command? |
|
|
I have a number of web sites I need to query for data, some of which use the "POST" Submit Method in their forms. I have string variables with the appropriate post input. I also stumbled upon the PostCommandArgument struct (http://api.openoffice.org/docs/common/ref/com/sun/star/ucb/PostCommandArgument.html) that seems to do exactly what I need to do... put the string variable into a TextInputStream (Source parameter), fire it off to the server, and pour the reply into a data sink (Sink parameter). However, when I set it all up and try to execute it, I get the following error:
| Quote: | BASIC runtime error.
An exception occurred
Type: com.sun.star.lang.IllegalArgumengException
Message: Wront argument type!. |
Here is the relevant code: | Code: | '***** Set Up Post Command Arguments *****
Dim oPC as new com.sun.star.ucb.PostCommandArgument
oPC.Source = oOutStream
oPC.Sink = oInStream
'***** Now, Try the POST Command *****
Dim aCommand as New com.sun.star.ucb.Command
aCommand.Name = "post"
aCommand.Handle = -1
aCommand.Argument = oPC
oQC.Execute(aCommand, 0, oXCE) |
I have the Universal Content Broker set up, along with a command environment and the appropriate handlers.
The code that I've used, successfully, to catch replies from web servers (that, properly, used the GET submission method) doesn't work in this instance. Here's the snippet of that code: | Code: | 'Now, move returned page into a string variable.
Dim oInputText as Object
Dim sFileText as String
Dim DummyArray(0) : DummyArray(0) = ""
oInputText = createUNOService ("com.sun.star.io.TextInputStream")
oInputText.setInputStream(oStream)
oInputText.InputStream.Seek(0)
sFileText = oInputText.readString(DummyArray(), FALSE)
oInputText.InputStream.Flush
oInputText.CloseInput |
Does anybody know what I'm doing wrong? It's probably some bone-headed syntactic error like leaving out a comma, or some such, but I'm at my wit's end.
Thanks in advance!
Fair day and be well,
Adam-Zad, The Bear That Looks Like A Man |
|