我想从没有ksop2的Android使用SAP SOAP web服务? Android有没有其他选择?如何在不使用Ksoap2的情况下在Android中启动SAP SOAP Web服务?
0
A
回答
0
是的,你可以但你必须在http请求中传递soap xml,如下所示。 [消耗而不的Android ksoap2一个web服务的SOAP]的
public class SimpleHTTPRequest {
String envelope1="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:tns=\"urn:insertdata\"" +
" targetNamespace=\"urn:insertdata\">"+
"<soap:Body>"+
"<insertdata>"+
"<name xsi:type=\"xsd:string\">ghjghj</name>"+
"<phone xsi:type=\"xsd:string\">1111</phone>"+
"<email xsi:type=\"xsd:string\">ascom</email>"+
"<score xsi:type=\"xsd:string\">12</score>"+
"</insertdata>"+
"</soap:Body>"+
"</soap:Envelope>";
/**
* @param args
*/
public static void main(String[] args) {
String url="http://url/iphone_soap_server.php/insertdata";
String soapAction="http://urkl/iphone_soap_server.php/insertdata/insertdata";
HttpURLConnection connection = null;
OutputStreamWriter wr = null;
BufferedReader rd = null;
StringBuilder sb = null;
String line = null;
URL serverAddress = null;
String data = "width=50&height=100";
try {
serverAddress = new URL("http://url/soap-server.php?wsdl");
connection = null;
//Set up the initial connection
connection = (HttpURLConnection)serverAddress.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(data);
writer.flush();
rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
sb = new StringBuilder();
while ((line = rd.readLine()) != null)
{
sb.append(line + '\n');
}
System.out.println(sb.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (ProtocolException e1) {
e1.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
finally
{
//close the connection, set all objects to null
connection.disconnect();
rd = null;
sb = null;
wr = null;
connection = null;
}
}
}
相关问题
- 1. 如何在Android中不使用KSOAP2的情况下调用Web服务?
- 2. 如何在不添加Web引用的情况下调用SOAP Web服务
- 3. Android Ksoap2 web服务
- 4. 在不使用肥皂的情况下调用Web服务
- 5. 在C#4.0中不添加服务引用的情况下使用Web服务
- 6. Spring-WS:如何在不启动Web服务的情况下生成WSDL?
- 7. 如何在不重新启动的情况下“重新启动”Internet Explorer服务
- 8. 在没有Web服务器的情况下构建Web服务
- 9. 在不使用JAX-RS的情况下调用Web服务
- 10. 在没有app.config的情况下在dll中使用web服务
- 11. 在不使用SoapClient的情况下与Web服务交谈?
- 12. 如何在android中使用KSOAP2提高soap web服务消耗和解析soap数据的性能?
- 13. 如何在不使用svcutil.exe的情况下使用WCF服务?
- 14. SAP B1 - 在SOAP Web服务中使用stanard dll's
- 15. 在html5网页中使用jQueryAjax消费SAP soap web服务iPad
- 16. 可以在没有WSDL的情况下使用SOAP Web服务吗?
- 17. 如何在不重启的情况下停止服务
- 18. 如何在不使用NetWeaver Gateway的情况下在SAPUI5中使用SAP ABAP RFC?
- 19. 如何在不使用ComponentScan的情况下启动Spring Boot Web应用程序
- 20. 如何在没有WebRequest的情况下使用WCF服务?
- 21. 在不重新启动服务的情况下更改jobcron
- 22. 如何在不使用JNLP文件的情况下从Web服务器启动Java应用程序?
- 23. 如何仅在未启动的情况下启动emacs服务器?
- 24. 如何在没有systemctl /服务工具的情况下启动mysql服务
- 25. 如何在不使用.controller()的情况下访问$ location服务?
- 26. 如何在不使用服务器的情况下运行node.js
- 27. 如何在不破坏服务层的情况下使用MVCMailer?
- 28. 如何在不使用app_code目录的情况下编写asmx Web服务?
- 29. 在没有代理的情况下调用web服务
- 30. 如何在不通过SSL添加服务引用的情况下动态调用Web服务
可能重复(http://stackoverflow.com/questions/6706331/consuming-a-soap-webservice-without-ksoap2-in-android) – Noundla 2015-07-25 16:03:23