Quote:
Originally Posted by akangbro
hai guys
nice tutorial...
i have exception, i dunno what should i do
this is exception :
Code:
expected: START_TAG {h t t p:/ / schemas .xmlsoap. org/soap/envelope/}Envelope (position:START_TAG (empty) < br>@1:6 in java.io .InputStreamR eader@d590dbc)
|
this is my wsdl
Code:
< definitions targetName space="h tt p:/ / www.wso2 .org / php">
xxx8722;
<types>
xxx8722;
< xsd:schema elementFormDefault="qualified" targetNamespace="h tt p:/ / wso2. org/projects/wsf/php/ds">
< xsd:element name="gettrxjual" type="ns0:gettrxjual"/>
< xsd:element name="poliss" type="ns0:polissType"/>
xxx8722;
< xsd:complexType name="gettrxjual">
xxx8722;
< xsd:sequence>
< xsd:element name="noagen1" type="xsd:any"/>
< xsd:element name="noagen2" type="xsd:any"/>
< xsd:element name="noagen3" type="xsd:any"/>
< xsd:element name="noagen4" type="xsd:any"/>
< /xsd:sequence>
< /xsd:complexType>
xxx8722;
< xsd:complexType name="polissType">
xxx8722;
< xsd:sequence>
< xsd:element name="polis" minOccurs="0" maxOccurs="unbounded" nillable="true" type="ns0:polisType"/>
</ xsd:sequence>
</ xsd:complexType>
xxx8722;
< xsd:complexType name="polisType">
xxx8722;
< xsd:sequence>
< xsd:element name="nmleng" type="xsd:any"/>
< xsd:element name="tgllhr" type="xsd:dateTime"/>
< xsd:element name="ultah" type="xsd:any"/>
< xsd:element name="nmagen" type="xsd:any"/>
< xsd:element name="nopoli" type="xsd:any"/>
< xsd:element name="ketsta" type="xsd:any"/>
< xsd:element name="nomohp" type="xsd:any"/>
< /xsd:sequence>
< /xsd:complexType>
< /xsd:schema>
< / types>
xxx8722;
< me ssage name="gettrxjual">
< par t name="parameters" element="ns0:gettrxjual"/>
< /me ssage>
xxx8722;
< mes sage name="gettrxjualResponse">
< part name="parameters" element="ns0:poliss"/>
< /mes sage>
xxx8722;
< portTy pe name="data_service_lapula_service.phpPortType">
xxx8722;
< opera tion name="gettrxjual">
< inpu t message="tns:gettrxjual"/>
< outp ut message="tns:gettrxjualResponse"/>
< /ope ration>
< /portType>
xxx8722;
< binding name="data_service_lapula_service.phpSOAPBinding" type="tns:data_service_lapula_service.phpPortType">
< s oap:binding transport="h t t p :// s chemas.xmlsoap.org/soap/ht tp" style="document"/>
xxx8722;
< operatio n name="gettrxjual">
< soap :operation soapAction="h tt p: / /192.168.100.7:8901/data_service/l apula_service.php/gettrxjual" style="document"/>
xxx8722;
< input>
< soap:body use="literal"/>
< /input>
xxx8722;
< output>
< soap:body use="literal"/>
< /output>
< /operation>
< /binding>
xxx8722;
< service name="data_service_lapula_service.php">
xxx8722;
< port name="data_service_lapula_service.phpSOAPPort_Http" binding="tns:data_service_lapula_service.phpSOAPBinding">
< soap:address location="ht tp :/ /192.168.100.7:8901/data_service/lapula_service.php"/>
</ port>
</ service>
</ definitions>
and
this is my source code
Code:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.ksoap2.*;
import org.ksoap2.transport.*;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.xmlpull.v1.XmlPullParserException;
import java.util.Vector;
import java.io.IOException;
/**
* @author secangkirkopipanas
*/
public class gui_mobile3 extends MIDlet implements CommandListener, Runnable{
private Display display;
private String url = "htt p : //127.0.0.1/ data_service/lapula_service.php";
private TextBox textbox = null;
private Form form;
private TextField input;
private StringItem output;
private Command cmOk;
private Command cmExit;
public gui_mobile3() {
form = new Form("Mobile");
input = new TextField("No. Agen", "", 10, TextField.ANY);
output = new StringItem("","");
cmOk = new Command("OK", Command.OK,1);
cmExit = new Command("EXIT", Command.EXIT, 2);
form.append(input);
form.append(output);
form.addCommand(cmOk);
form.addCommand(cmExit);
form.setCommandListener(this);
}
public void startApp() {
display = Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if(c==cmOk)
new Thread(this).start();
if(c==cmExit)
{
destroyApp(false);
notifyDestroyed();
}
//throw new UnsupportedOperationException("Not supported yet.");
}
public void run() {
try {
testWebService();
} catch (Exception ex) {
System.out.println(ex);
}
}
public void testWebService() throws Exception {
StringBuffer stringBuffer = new StringBuffer();
TextBox textBox = null;
String tem=null;
SoapObject resultsRequestSOAP = null;
String result = null;
// First WebService - echos name that is passed in, in this case 'Robertus Lilik Haryanto'
String method = "gettrxjual";
String namespace = "ht t p :/ /wso2.org/projects/wsf/php/ds";
String soapAction = "h ttp:// 19 2.168.100.7:8901/data_service/lapula_service.php/gettrxjual";
SoapObject client = new SoapObject(namespace , method);
client.addProperty("noagen1", "010300080");
client.addProperty("noagen2", "010300080");
client.addProperty("noagen3", "010300080");
client.addProperty("noagen4", "010300080");
// Creating the Soap Envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(client);
envelope.encodingStyle = SoapSerializationEnvelope.XSI;
HttpTransport transport = new HttpTransport(url);
transport.setXmlVersionTag("< ? xml version=\"1.0\" encoding=\"utf-8\"? >");
// Call the WebService
try {
transport.call(soapAction,envelope);
result = (envelope.getResult()).toString();
System.out.println("hasil : "+result);
} catch (XmlPullParserException ex) {
System.out.println(ex.getMessage());
output.setText(ex.getMessage());
} catch (IOException ex) {
output.setText(ex.getMessage());
} catch (Exception ex) {
output.setText(ex.getMessage());
}
stringBuffer.append(resultsRequestSOAP);
textBox = new TextBox("hasil ", stringBuffer.toString(), 4096, 0);
display.setCurrent(textBox);
}
}
i spent 2 weeks for this @_@
please help me
thanks