so I am having a problem trying to send 6 variables to a web service (http://hydra.chorleywood.org/hydradevices/devicesmanagement.asmx)
I am using ksoap2-android in android running 4.2 API 17
My program crashes every time I press the button it is associated with. I have looked through many tutorials and have done just as they have but it just does not work for me whether i run it in eclipse or export and run it on my phone.
here is the relevant parts of the code
private static final String NAMESPACE = "http://hydra.chorleywood.org";
private static final String URL="http://hydra.chorleywood.org/hydradevices/devicesmanagement.asmx";
private static final String METHOD1_SOAP_ACTION_URL = "http://hydra.chorleywood.org/addNewDevice";
private static final String METHOD_NAME1 = "addNewDevice";
final Button status_button = (Button) findViewById(R.id.device_status);
status_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
// setting my variables
String EUI64 = "EHF7980HY3G793HG393GF737GH80G7";
String HashCode = "MB2GPD";
int DeviceTypeID = 528391;
String subType = "Weighing Scales";
String Manufacturer = "Samsung";
String SerialNumber = "8476403967";
// setting connectionas
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
envelope.dotNet = true;
// setting informaiton to be sent
request.addProperty("EUI64", EUI64);
request.addProperty("HashCode", HashCode);
request.addProperty("DeviceTypeID", DeviceTypeID);
request.addProperty("subType", subType);
request.addProperty("Manufacturer", Manufacturer);
request.addProperty("SerialNumber", SerialNumber);
// setting request to be sent out
envelope.setOutputSoapObject(request);
try
{
androidHttpTransport.call(METHOD1_SOAP_ACTION_URL, envelope);
//java.lang.String receivedString = (String)envelope.getResponse();
//java.lang.Boolean receivedBoolean = (Boolean)envelope.getResponse();
Object result = envelope.getResponse();
/**if(receivedBoolean = true) {
Context context = getApplicationContext();
CharSequence text = "testing toast";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}**/
}
catch(Exception e)
{
}
}
I have set the permission in the manifest I'm not certain what exactly is wrong, does anyone know?
I have tried different API's and that still did not work. I would really appreciate any help on this topic, I have put a week into it so far and I'm just running in circles.
I have literally copy pasted other peoples web services with (what i believe to be an active server) and tried running their exact code and that does not seem to work also. Perhaps that will help you figure out the problem I am having.
Many thanks,
Charlie