Web服务存根代+安卓 [英] Web services stub generation + android
问题描述
我要生成一个机器人(JAVA)基于存根访问所有的网络服务。我曾尝试使用以下工具生成存根:
I want to generate a android(java) based STUB for accessing all the web services. I have tried generating the stub using following tools:
1)的Sun Java(TM)无线工具包2.5.2_01为CLDC,
1) Sun Java (TM) Wireless Toolkit 2.5.2_01 for CLDC,
2)ksoap2产生存根-0.1-快照J2ME的机器人。
2) ksoap2-generating-stub-0.1-SNAPSHOT-J2me-Android.
但我无法产生适当的存根都可以使用。请建议您使用为目的的任何库或工具。
But i was unable to generate a proper stub that can be used. Please suggest any library or tool that you have used for the purpose.
谢谢!
这里有人!
更新:
的问题与Sun Java lib目录下:但是也有一些不支持Android的一些Java库。对于例如:javax.microedition.xml.rpc.Operation等
Problem with sun java lib: There are some java libs that are not supported by Android. For eg: "javax.microedition.xml.rpc.Operation" etc.
与ksoap2问题:与下面的日志在命令提示符处得到一个空指针异常:
Problem with ksoap2: getting a null pointer exception with following log in command prompt:
命令我使用运行Windows命令提示符:
command that i run using windows command prompt:
java -cp ksoap2-generating-stub-0.1-SNAPSHOT-jar-with-
dependencies.jar;"%JAVA_HOME%\lib\tools.jar"
ksoap2.generator.Wsdl2Android -w "http://localhost:8080/Ws2Ksoap/
services/HelloWorld?wsdl" -g .\generated
当我运行此code,我得到以下异常:
As soon as i am running this code,i am getting following exception:
Exception in thread "main" java.lang.NullPointerException
at ksoap2.generator.WsCompiler.compile(WsCompiler.java:86)
at ksoap2.generator.WsCompiler.run(WsCompiler.java:78)
at ksoap2.generator.Wsdl2J2me.run(Wsdl2J2me.java:116)
at ksoap2.generator.Wsdl2Android.main(Wsdl2Android.java:41)
另一个更新:创建的Web服务的不得使用的 java.rmi中的任何实例* 包
Another Update: The created web services must not use any instance of java.rmi.* package.
推荐答案
你有没有包括ksoap2 jar文件到您的项目...?我做了与例如使用ksoap2 web服务,并成功地得到了它。我已经使用和www.w3schools.com的在线网络服务,是Web服务的具体情况如下......
have you included the ksoap2 jar file to your project ...? I had done and example of webservice using ksoap2 and got it successfully. I had used and online web service of www.w3schools.com, the details of the web service are as follows....
soap_action =http://tempuri.org/CelsiusToFahrenheit; 方法_ =CelsiusToFahrenheit; 命名空间=http://tempuri.org/; URL =http://www.w3schools.com/webservices/tempconvert.asmx;
soap_action = "http://tempuri.org/CelsiusToFahrenheit"; method_name = "CelsiusToFahrenheit"; namespace = "http://tempuri.org/"; url = "http://www.w3schools.com/webservices/tempconvert.asmx";
希望这将有助于you.Good运气
hope this will help you.Good Luck
这篇关于Web服务存根代+安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!