2014-10-20 61 views
0

我正在使用wcf web服務製作應用程序。如何使用kso​​ap2從android發送多個參數到wcf服務器

我想發送多個參數,但只有我知道事情是這樣的

request.addProperty("Fahrenheit",txtData.getText().toString()); 

那麼怎麼辦呢?

下面是我的wcf代碼的一部分。

public string GetFirstName(byte[] source, int height, int width) 
    { 
     Bitmap bitmap = ImageTypeConverter.ArrayToImage(source, height, width); 
     bitmap.Save(Environment.CurrentDirectory + "test" + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp); 

     return "ImageSaveComplete"; 
    } 

正如你所看到的,我想傳遞字節數組和整數值。

請讓我知道答案。

回答

1

要發送多個參數,字符串,整數,等:

SoapObject request = new SoapObject(NAMESPACE, METHOD); 

    PropertyInfo variableHeight = new PropertyInfo(); 

    variableHeight.setName("height"); 
    variableHeight.setValue(value); // your variable value 
    variableHeight.setType(Integer.class); // if its string type change to String.class 
    request.addProperty(variableHeight); 

    PropertyInfo variableWidth = new PropertyInfo(); 

    variableWidth.setName("width"); 
    variableWidth.setValue(value); 
    variableWidth.setType(Integer.class); 
    request.addProperty(variableWidth); 

但發送字節數組林不知道,看看這個: http://code.google.com/p/ksoap2-android/issues/detail?id=116

+0

謝謝。我將應用此代碼。 – 2014-11-07 06:43:01

相關問題