- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试访问托管在这里的 Web 服务
http://srilanka.lk:9080/services/CropServiceProxy?wsdl
在 SoapUI 中工作正常。我在其中得到了正确的回应。
SoapUI 请求
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:v1="http://schemas.icta.lk/xsd/crop/handler/v1/">
<soap:Header/>
<soap:Body>
<v1:getCropDataList>
<v1:code>ABK</v1:code>
</v1:getCropDataList>
</soap:Body>
</soap:Envelope>
SoapUI 响应
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns1:getCropDataListResponse xmlns:ns1="http://schemas.icta.lk/xsd/crop/handler/v1/">
<ns1:cropInfo>
<ns1:name>Ambul Kesel</ns1:name>
<ns1:price>35.0</ns1:price>
<ns1:location>Dambulla</ns1:location>
</ns1:cropInfo>
<ns1:cropInfo>
<ns1:name>Ambul Kesel</ns1:name>
<ns1:price>40.0</ns1:price>
<ns1:location>Dambulla</ns1:location>
</ns1:cropInfo>
</ns1:getCropDataListResponse>
</soapenv:Body>
</soapenv:Envelope>
但是在 Ksoap2 for android 中,soap 响应是一个错误。下面分别是requestDump和responseDump。
请求转储
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<n0:getCropDataList id="o0" c:root="1" xmlns:n0="http://schemas.icta.lk/xsd/crop/handler/v1/">
<code i:type="d:string">CNT</code>
</n0:getCropDataList>
</v:Body>
</v:Envelope>
响应转储
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
<wsa:RelatesTo>urn:uuid:3257ABC779195052D01293913466558</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode>VersionMismatch</faultcode>
<faultstring>Only SOAP 1.1 or SOAP 1.2 messages are supported in the system</faultstring>
<detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
这是我的代码。
public void btnOnClick(View v){
String NAMESPACE = "http://schemas.icta.lk/xsd/crop/handler/v1/";
String URL = "http://220.247.225.202:9080/services/CropServiceProxy.CropServiceProxyHttpSoap12Endpoint";
String METHOD_NAME = "getCropDataList";
String SOAP_ACTION = "http://schemas.icta.lk/xsd/crop/handler/v1/getCropDataList";
SoapObject soap_request = new SoapObject(NAMESPACE, METHOD_NAME);
soap_request.addProperty("code", "ABK" );
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
envelope.setOutputSoapObject(soap_request);
envelope.addMapping(NAMESPACE, "cropInfo", CropInfo.class);
envelope.dotNet=false;
Marshal floatMarshal = new MarshalFloat();
floatMarshal.register(envelope);
System.out.println("body out : " + envelope.bodyOut.toString());
AndroidHttpTransport http_transport = new AndroidHttpTransport(URL);
//HttpTransportSE http_transport = new HttpTransportSE(URL);
http_transport.debug = true;
try {
http_transport.call(SOAP_ACTION, envelope);
//because we should expect a vector, two kinds of prices are given
Vector<CropInfo> result_array = (Vector<CropInfo>)envelope.getResponse();
if(result_array != null){
for (CropInfo current_crop: result_array){
System.out.println(current_crop.getName());
System.out.println(Float.toString(current_crop.getPrice()));
}
}
} catch (Exception e) {
e.printStackTrace();
answer.setText("error caught");
System.out.print("REQUEST: ");
System.out.println(http_transport.requestDump);
System.out.print("RESPONSE: ");
System.out.println(http_transport.responseDump);
}
}
我如何才能在 Ksoap2 中为此获得正确的响应?
最佳答案
您应该使用 1.1 并查看错误消息。服务器端 axis2 中的代码子元素存在问题。可能只是您必须将 implicitTypes 设置为 false。尝试信封上的一些选项。
关于android - Soap Fault VersionMismatch KSOAP2 for Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4575592/
我的 kSOAP 网络服务将 xml 返回为这种格式我如何从中获取 country_name anyType{country=anyType{country_name=Egypt; };
我能够使用 ksoap2 获取复杂的类响应,现在我得到的响应是 xml 形式 任何人都可以帮我解决如何解析这个 Ksoap 响应吗?我已经在论坛上阅读了为它添加映射的内容,我也添加了映射。我可以使用
我一直在使用 Android 版 KSOAP 发送包含 6 个元素的 SOAP 请求,最后一个元素是一个值数组。这是代码... PropertyInfo properties[] = n
我在我的 Android 应用程序中使用 KSoap。我的应用程序使用 Web 服务与服务器通信。我找到了一个 KSoap wev 服务客户端的代码示例。在示例中,客户端使用以下代码与服务器进行通信
我正在使用 KSOAP2 调用 Web 服务。我收到了回复,但该回复中的特殊字符未正确显示。 我怎样才能改变它? 编辑: 以下代码负责发送和接收数据: package org.ksoap2.trans
我正在使用 Android ksoap2 库来使用 SOAP 网络服务。 请求中的一个节点看起来像.. //some more nodes .............
我有 ksop 请求。我揉出来的是 asdfdsafdsfasdfdsa
我正在使用支持超时的 ksoap2 2.5.4(在 Android 2.2 上)。我正在使用 Apache 2.2.16 来处理我的请求。一切正常,但当我关闭我的 Apache(或断开运行 Apach
帮帮我,我花了大约 3 周的时间搜索整个 www,但无法正常工作! 我有一个 WS,只想让我的应用程序有响应。但不幸的是,我在更正所有内容后总是得到以下错误! 08-09 15:29:30.930:
当向 soap 对象添加属性时无法指定其类型....我需要整数但它总是将其设置为“d:string”1312191347这是我添加属性(property)的方式: SoapObject _client
我在尝试使用 kSOAP2 在 Android 中使用 ColdFusion SOAP 服务时遇到了一个问题。这是我的 java 代码,用于调用我在 ColdFusion 中编写的测试方法(它只返回一
我正在尝试通过 kSOAP(直接从 Google 下载并包含“.jar”)调用公共(public) Web 服务 (w3schools.com/webservices/tempconvert.asmx
有没有人有使用 kSOAP 包的良好的复杂对象编码示例? 最佳答案 虽然这个例子不是可编译的和完整的,但基本思想是有一个类告诉 kSOAP 如何将 XML 标记转换为对象(即 readInstance
我正在通过 SOAP 发送多个 PDF 文件,Android 客户端将接收这些文件。但是当收到 SOAP 响应时,它会抛出 OutOfMemoryException。 我想知道它是否是 kSOAP 或
我正在使用 Android 中的 Ksoap 访问 .net 网络服务。 wsdl 的格式是这样的 Date1 Date2 我对 DateTo 使用相同的 addPropert
我不知道为什么我不能得到这个?......也许我遗漏了什么或者我太笨了 我想尝试从 Android 应用程序调用网络服务 现在要做到这一点,发现适用于 Android 的 kSOAP 2 是所需的库
我正在使用 ksoap2 (ksoap2-android-assembly-3.0.0-RC.1-jar-with-dependencies.jar) 与我的 android 应用通信在 jboss
我在下面显示的代码中使用 soap 访问 Web 服务并收到以下错误,我需要帮助来理解: SoapFault - faultcode: 'soap:Server' faultstring: 'Syst
我希望生成像这样的 soap 请求: - - Connect -
马上,这是我的 Soap 调用实现,减去不相关的位。 public class MySoapClient implements AbstractSoapClient { private Str
我是一名优秀的程序员,十分优秀!