View Single Post
Old 12-18-2009, 12:28 AM   #50 (permalink)
anilarkay
New Member
 
Join Date: Nov 2009
Model: 8900
PIN: N/A
Carrier: Airtel
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Stuck on SOAP Application for BlackBerry

Hi All, I've successfully created a standalone java version of a SOAP communication class to enable Web Services data delegation.

But when I try to port to Blackberry device software, I'm having trouble.

1. I cannot find the correct replacement for H**pURLConnection class in Blackberry.

We need to use doOutput=true, so we can output the request/response to the Writer object through the stream.

right now, my coding goes like this:
==========================================
URL u = new URL(server);
URLConnection uc = u.openConnection();
H**pURLConnection connection = (H**pURLConnection) uc;
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("SOAPAction", SOAP_ACTION);
OutputStream out = connection.getOutputStream();
Writer wout = new OutputStreamWriter(out);
wout.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");

..................XML CODE HERE.................

wout.flush();
wout.close();

InputStream in = connection.getInputStream();
int c;
s="";
while ((c = in.read()) != -1)
{
//read and store the response as an XML String
}
in.close();

Can someone please look into this and suggest a solution with H**pTransport than using the H**pURLConnection? with H**pURLConnection, I am sending the SOAP request as an XML and getting the request as an XML. How can I do this with H**pTransport in KSOAPDemo version of the same, so I can get a simple SOAP Client working on blackberry device?
Offline   Reply With Quote