.Net 웹 서비스를 호출하기위한 샘플 응용 프로그램을 개발 중입니다. Eclipse의 빌드 경로에 ksoap2-j2me-core-prev-2.1.2.jar를 추가했습니다."메서드는 인수에 적용되지 않습니다."BlackBerry 응용 프로그램을 만들 때
내가 addProperty를 통해 두 개의 값을 전달하고있다 :
The method addProperty(String, Object) in the type SoapObject is not applicable for the arguments (String, int)
내가 할 수있는 오류를 해결하는 방법과 어떻게 : "번호 1"과 정수 (10), 또한 "번호 2"와 (20)이 컴파일러 오류가 발생합니다 addProperty에 하나의 문자열과 하나의 int 값을 전달합니까? 나는 안드로이드에서 같은 방식으로이 작업을 수행했으며 잘 작동한다.
String serviceUrl = "URL to webservice";
String serviceNameSpace = "namespace of web service";
String soapAction = "URL to method name";
String methodName = "Name of method";
SoapObject rpc = new SoapObject(serviceNameSpace, methodName);
//compiler error here
rpc.addProperty("number1", 10);
rpc.addProperty("number2", 20);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = true;//IF you are accessing .net based web service this should be true
envelope.encodingStyle = SoapSerializationEnvelope.ENC;
HttpTransport ht = new HttpTransport(serviceUrl);
ht.debug = true;
ht.setXmlVersionTag("");
String result = null;
try
{
ht.call(soapAction, envelope);
result = (String) (envelope.getResult());
}
catch(org.xmlpull.v1.XmlPullParserException ex2){
}
catch(Exception ex){
String bah = ex.toString();
}
return result;