2014-10-20 63 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

相关问题