BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-01-2004, 09:58 AM   #1 (permalink)
New Member
 
Join Date: Sep 2004
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP with HttpConnection.setRequestProperty()

Please Login to Remove!

Running 3.7. I'm trying to create a SOAP client in my blackberry simulator. I use: HttpConnection.setRequestProperty("SOAPAction", "ping")
to set the soap action. But, what HttpConnection writes out is:
"soapaction: ping". When the web service receives this, it complains that the SOAP Action is not set and returns an error to my client. Anyone have any ideas?
Offline  
Old 09-01-2004, 01:28 PM   #2 (permalink)
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

I am now attempting to make an inquiry with Blackberry developers, will let you know if I get an answer...

Others, please feel free to help here. Thanks!
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source
Offline  
Old 09-03-2004, 08:34 AM   #3 (permalink)
New Member
 
Join Date: Sep 2004
Location: Australia
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

My work-around is on the blackberry site
__________________
David O'Meara
JavaRanch
Offline  
Old 09-03-2004, 10:15 AM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
kirson's Avatar
 
Join Date: Aug 2004
Location: Chicago
Model: 9000
Carrier: ATT
Posts: 421
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

David,

Hope you don't mind, but I'm copying your response into this forum -- makes it easier to read the thread beginning to end. If you would rather I delete this, just let me know, and I'll remove it. Here is David's workaround:

Quote:
I'm shocked, you're quite right. I have no idea where the behaviour comes from. I also tried "Soap-Action" just to see what happens, and it too gets converted.

The work around I'm using is to open a socket connection and write the header myslef, but it means you now miss out on the automatic parsing of the response header. Annoying. I'm really looking forward to rewriting that when I shouldn't have to.

Just for the record:
Split the URL into the host and URI, use the Connector to open HOST:port, cast the Connection to StreamConnection (Not HttpConnection)
write the header like this: (i save it as a byte array then send as two chucks)
bos = new ByteArrayOutputStream();
out = new OutputStreamWriter(bos, "UTF-8");
out.write("POST ");
out.write( URI );
out.write(" HTTP/1.1\r\n");
out.write("Content-Type:text/html\r\n");
...

* Don't forget the request length
* Don't forget the extra \r\n at the end
* Note the URI in the POST part.

Then send the header followed by the payload.

OutputStream os = conn.openOutputStream();
byte[] header = getHeader(requestData.length);
os.write(header,0,header.length);
os.write(requestData, 0, requestData.length);
os.close();

The easiest place to get this is to use the Apache SOAP TCP Tunnel GUI and copy the header data as-is. Drop another post and tell me how you got on. I'm using kSoap2.0 by the way.
Offline  
Old 09-03-2004, 12:11 PM   #5 (permalink)
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

I was the one who made that inquiry on that website :D ....

Thanks for copying it back!
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source
Offline  
Old 09-22-2004, 10:26 PM   #6 (permalink)
New Member
 
Join Date: Sep 2004
Location: Australia
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mark, any response from RIM as to why the header gets mangled? I've been using the code I posted on my demo hand-held, but the default security for the company providing the demo blocks the request.

I find it strange that socket connections on port 80 appear to be treated differently to http connections, but I'm still looking into it. I haven't ruled out user error.
__________________
David O'Meara
JavaRanch
Offline  
Closed Thread


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

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





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.