ライブラリ「ksoap2-android-assembly-2.4-jar-with-dependencies.jar」を追加しましたが、以下のエラーが発生します:
Exception in thread "main" java.lang.NullPointerException at org.kxml2.io.KXmlParser.require(KXmlParser.java:1353) at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127) at org.ksoap2.transport.Transport.parseResponse(Transport.java:63) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
private void getData()
{
String METHOD_NAME = "schedule.setschedule";
String SOAP_ACTION = "urn:schedule#setschedule";
String NAMESPACE = "urn:schedule";
String URL = "http://96.30.19.40:8080/server.php?wsdl";
try {
SoapObject request=soap(METHOD_NAME,SOAP_ACTION,NAMESPACE,URL);
System.out.println("suceess");
System.out.println(request.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("fail1");
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("fail2");
}
}
public static SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //set up request
request.addProperty("iTopN", "5"); //variable name, value. I got the variable name, from the wsdl file!
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //put all required data into a soap envelope
envelope.setOutputSoapObject(request); //prepare request
HttpTransport httpTransport = new HttpTransport(URL);
httpTransport.debug = true; //this is optional, use it if you don't want to use a packet sniffer to check what the sent message was (httpTransport.requestDump)
httpTransport.call(SOAP_ACTION, envelope); //send request
SoapObject result=(SoapObject)envelope.getResponse(); //get response
return result;
}