BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-09-2007, 05:23 PM   #1
leo12_chandu
New Member
 
Join Date: May 2007
Model: 8800J
PIN: N/A
Carrier: Cingular
Posts: 6
Default JDE + ksoap web service invocation

Please Login to Remove!

Hi,
I wrote a Web service Client using ksoap2 to invoke the StockQuote Service available with axis in Blackberry JDE. I am getting the following error.
"org.xmlpull.vl.XmlPullParserException: unexpected type (position: TEXT Not authorized t...@1:39 in java.io.InputStreamReader@59324728)". Did anyone get this error before? Any suggestions? I would really appreciate if someone can help me with this. Please find the code snippet below. Thank you.

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

import org.ksoap2.*;
import org.ksoap2.serialization.*;
import org.ksoap2.transport.*;

/**
*
*/
class StockQuoteScreen extends MainScreen{

StockQuoteScreen()
{
super();

LabelField applicationTitle = new LabelField("Stock Quote");
setTitle(applicationTitle);
RichTextField stockQuoteTextField = new RichTextField("gotResponse");
add(stockQuoteTextField);

// Create the outgoing message
SoapObject requestObject = new SoapObject("x", "getQuote");
// ask for the specially encoded symbol in the included service
requestObject.addProperty("symbol", "XXX");

// use version 1.1 of soap
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

// add the outgoing object as the request
envelope.setOutputSoapObject(requestObject);
//new MarshalFloat().register(envelope); // not really needed for j2se version

// Create a transport layer for the J2SE platform. You should change this for
// another transport on midp or j2me devices.
HttpTransport transportSE = new HttpTransport("http://localhost:8080/axis/StockQuoteService.jws");
// turn on debug mode if you want to see what is happening over the wire.
//transport.debug = true;
try {
// call and print out the result
transportSE.call("getQuote", envelope);
//System.out.println(envelope.getResponse());
//stockQuoteTextField.setText(((Float)envelope.getRe sponse()).toString());
stockQuoteTextField.setText(stockQuoteTextField.ge tText() + " called ");
//stockQuoteTextField = new RichTextField("gotResponse");
} catch (Exception e) {
// if we get an error print the stacktrace and dump the response out.
e.printStackTrace();
//System.out.println(transportSE.responseDump);
stockQuoteTextField.setText(stockQuoteTextField.ge tText() + e);
//stockQuoteTextField = new RichTextField(transportSE.responseDump);
}
}

public boolean onClose()
{
Dialog.alert("Bye Stock Quote!");
System.exit(0);
return true;
}
}

I tried executing the HelloWorld program with a method echo which returns back the string you pass to invoke the service. But I still have the same error showing up on BlackBerry.

Thank you,
Chandra.
Offline  
Old 05-10-2007, 01:34 PM   #2
leo12_chandu
New Member
 
Join Date: May 2007
Model: 8800J
PIN: N/A
Carrier: Cingular
Posts: 6
Default It works

Never mind. The problem was I changed the URL from localhost to complete domain name and it works. Obviously the device simulator doesnt have any localhost web service running.

thank you.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Peak, Atlas DCA55 Semiconductor Tester,  picture

Peak, Atlas DCA55 Semiconductor Tester,

$97.99



DCA55 Peak Atlas Semiconductor Tester Transistor MOSFET Diode Analyzer DCA 55 picture

DCA55 Peak Atlas Semiconductor Tester Transistor MOSFET Diode Analyzer DCA 55

$83.94



Dual Range Transistor Diode Semiconductor & Passive Curve Tracer Tester/Tracker picture

Dual Range Transistor Diode Semiconductor & Passive Curve Tracer Tester/Tracker

$26.99



WESTCODE SEMICONDUCTOR 12-679126-04 NEW 1267912604 picture

WESTCODE SEMICONDUCTOR 12-679126-04 NEW 1267912604

$150.00



Fuse, Semiconductor, Blade, FWP, 175A, 700V picture

Fuse, Semiconductor, Blade, FWP, 175A, 700V

$283.43



Powerex Mitsubishi Semiconductor Power Supply Module CM1000HA-24H picture

Powerex Mitsubishi Semiconductor Power Supply Module CM1000HA-24H

$169.96







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