Tag: ksoap2

如何从Android中的Web Service检索二进制数据?

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); Log.d(“WebService”, “2”); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SOAP_ACTION, envelope); SoapPrimitive result = (SoapPrimitive)envelope.getResponse(); 这是我调用.NET Web服务的代码,它发送一个byte []数组。 如何从结果变量中获取byte []数组,还是有另一种方法来检索byte []数组?

自签名证书

我使用带有自签名证书的主机。 所以我从我的域https://www.marpel.cz/下载了证书,并使用http://portecle.sourceforge.net/创建了.bks文件。 我需要建立https连接并从我的webservice中检索数据。 我用的是ksoap2库。 我复制并使用了ksoap2 wiki中声明的类ConnectionWithSelfSignedCertificate 。 这是我创建keyStore的方式 MainActivity.java // Get an instance of the Bouncy Castle KeyStore format try { this.keyStore = KeyStore.getInstance(“BKS”); } catch (KeyStoreException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Get the raw resource, which contains the keystore with // your trusted certificates (root and any intermediate certs) […]

java.io.EOFException使用kso​​ap2 lib libcore.io.Streams.readAsciiLine(Streams.java:203)

03-26 14:12:19.045: E/Webservices(2863): java.io.EOFException 03-26 14:12:19.045: E/Webservices(2863): at libcore.io.Streams.readAsciiLine(Streams.java:203) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:560) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:813) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274) 03-26 14:12:19.045: E/Webservices(2863): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486) 03-26 14:12:19.045: E/Webservices(2863): at org.ksoap2.transport.ServiceConnectionSE.getResponseCode(ServiceConnectionSE.java:103) 03-26 14:12:19.045: E/Webservices(2863): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:197) 03-26 14:12:19.045: E/Webservices(2863): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) 03-26 14:12:19.045: E/Webservices(2863): at .utils.Webservices.callinternet(Webservices.java:125) 03-26 14:12:19.045: E/Webservices(2863): at .utils.Webservices.getResponse(Webservices.java:73) 03-26 […]

使用kso​​ap2-android时出现exception

我有关于ksoap2的问题。 我的问题是,该项目过去一直工作到我必须格式化我的电脑并重新设置它的时间。 我不记得我在我的应用程序中引用了什么版本,但我尝试了很多版本,问题仍然存在。 04-05 13:56:18.289: E/dalvikvm(495): Could not find class ‘org.ksoap2.serialization.SoapObject’, referenced from method com.giatrosofia.Activity_Votana$ConnectAndGetLst.doInBackground 04-05 13:56:18.289: W/dalvikvm(495): VFY: unable to resolve new-instance 223 (Lorg/ksoap2/serialization/SoapObject;) in Lcom/giatrosofia/Activity_Votana$ConnectAndGetLst; 04-05 13:56:18.289: D/dalvikvm(495): VFY: replacing opcode 0x22 at 0x0000 04-05 13:56:29.627: W/dalvikvm(495): threadid=9: thread exiting with uncaught exception (group=0x40014760) 04-05 13:56:29.809: E/AndroidRuntime(495): FATAL EXCEPTION: AsyncTask #1 04-05 13:56:29.809: […]

Android:NTLM身份validation,ksoap和持久连接

在使用iOS并处理auth挑战而没有太多学习曲线之后,我发现Windows身份validation在Java / Android中的过程要复杂得多。 我尝试了多种不同的方法,所以在没有太多涉及这些方法的情况下,我会找到一个大部分工作的方法。 我现在正在使用为NTLM创建的类和ksoap为NtlmTransport创建的类 我现在通过以下方式成功进行身份validation: NtlmTransport httpTransport = new NtlmTransport(); httpTransport.setCredentials(serverURL, Login.username, Login.password, deviceIp, “DOMAINNAME”); httpTransport.call(SOAP_ACTION, envelope); 如果你看一下NtlmTransport类,你会看到它从setupNtlm()返回以下头文件: status line HTTP / 1.1 200 OK Setup Cache-Control:private,max-age = 0 设置内容类型:text / html; 字符集= utf-8的 设置服务器:Microsoft-IIS / 8.0 安装X-AspNet-Version:4.0.30319 Setup Persistent-Auth:true 安装X-Powered-By:ASP.NET 设置日期:2013年9月17日星期二20:57:45 GMT 设置内容长度:11549 “Persistent-Auth:true是我现在关注的主要问题。我得到的SoapObjects很好,可以从一个连接中获取我需要的数据,但是一旦我尝试访问网络再次服务,大概能够在成功validation后被击中,我无法使用HttpTransportSE访问不同的方法: private void setSomething() { xml = null; final String […]

android中的Ksoap2无法序列化

我在android中使用kso​​ap2 将数字列表作为字符串发送 但它有错误: java.lang.runtimeexception无法序列化 我搜索此错误的解决方案但结果没有改变 可以帮帮我 public String Send(ArrayList contactlist) { try{ SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME); PropertyInfo pi=new PropertyInfo(); pi.setType(String.class); pi.setName(“contactlist”); pi.setValue(contactlist); request.addProperty(“contactlist”, pi); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); // Creating SOAP envelope SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); new MarshalBase64().register(envelope); // this line is for serialization //You can comment that line if your […]

KSoap2和KvmSerializable – 如何发送像Stringarrays这样的复杂对象

我想从我的Ksoap客户端向我的web服务发送一个复杂的对象。 这是我的class级类别的对象。 该代码基于本教程的示例: http://seesharpgears.blogspot.de/2010/10/ksoap-android-web-service-tutorial-with.html Web服务正在运行,WSDL文件显示类别对象。 但是,如果我将类别对象发送到我的soap webservice,则会出现以下错误: [错误]尝试调用服务方法时发生exceptiongetCategoryObject org.apache.axis2.AxisFault:未知类型{http://ws.chathura.com}类别Logcat显示以下内容:06-12 11:08:57.576:W /System.err(777):SoapFault – faultcode:’soapenv:Server’faultstring:’Unknow type {http://ws.chathura.com} Category’faultactor:’null’detail:org.kxml2.kdom.Node @ 4054a528 这是我在Tomcat 7上运行的Java Webservice: package com.chathura.ws; import java.util.Vector; public class HelloWorldWS { public Category getCategoryObject(Category obj) { Category C1 = new Category(); C1.setCategoryId(1); C1.setDescription(“server desc”); C1.setName(“server Name”); System.out.println(obj.getCategoryId()); return C1; } } 这是我在WebServer上的Category类: package com.chathura.ws; public class Category […]

KSOP2图书馆课没有发现exception

我在我的项目中使用过KSOP2,这些都很有用。 最近我买了一台新机器并将我的项目移动到新机器并将ksoap库导入项目等等,当我尝试运行应用程序时,我在模拟器中得到以下错误 Caused by: java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject 这是抛出exception的地方。 SoapObject request = new SoapObject(namesapce, methodname); 64位机器有什么关系? 为什么这几天工作的应用程序突然停止工作? 请有人赐教。 我坚持这个。 感谢您提前的时间。

使用Ksoap2中的Web服务传递数组

我必须调用一个Web服务,其中通过kSoap2方法调用Web服务,现在在这个节点中是一个数组,所以我可以如何传递它。 POST /opera/OperaWS.asmx HTTP/1.1 Host: 182.71.19.26 Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: “http://tempuri.org/SendGroupMessageNotification” string string string string string string int string string boolean string 所以在上面的Web服务中,我如何设置reciverMemberId的值 使用propertyInfo可以轻松设置剩余参数。 为此,我做了一些代码如下 static class Group implements KvmSerializable { String groupid; Vector groupMembers; public Group(String groupId,Vector groupmembers) { this.groupid=groupId; this.groupMembers=groupmembers; } public Object getProperty(int i) { switch(i) { case 0: return […]

黑莓kSoap2和肥皂头

尝试指定自定义soap标头。 不确定如何填充SoapEnvelope.headerOut属性。 我的代码到目前为止? String soapAction = serviceNamespace + “/SearchCustomer”; SoapObject rpc = new SoapObject(serviceNamespace, “SearchCustomers”); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.bodyOut = rpc; envelope.dotNet = true; envelope.encodingStyle = SoapSerializationEnvelope.ENC; rpc.addProperty(“searchBy”, searchBy); rpc.addProperty(“groupBy”, Integer.toString(groupBy)); 这是头文件WSDL提取… string string