OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Syntax for "POST" Command?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
adamzad
General User
General User


Joined: 08 Mar 2011
Posts: 16
Location: Buena Park, CA, USA

PostPosted: Thu May 12, 2011 8:55 pm    Post subject: Syntax for "POST" Command? Reply with quote

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! Smile

Fair day and be well,
Adam-Zad, The Bear That Looks Like A Man
Back to top
View user's profile Send private message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Thu May 26, 2011 3:24 am    Post subject: Reply with quote

adam,

have a look here :
http://api.openoffice.org/docs/common/ref/com/sun/star/ucb/PostCommandArgument2.html

POST needs aparantly other arguments Mimetype and a URL

please post more code so i also can run some tests

Greetz

Fernand
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group