使用k-Soap从Android的Callin Java webservice出错

使用k-Soap从Android的Callin Java webservice出错,第1张

概述我在 Java中创建了一个简单的登录Web服务,我从 Android代码中调用它.我将两个字符串参数传递给Webservice.但它们在Webservice中变为null. WebService Code : public boolean authenicateUser(@WebParam(name="username")String username, 我在 Java中创建了一个简单的登录Web服务,我从 Android代码中调用它.我将两个字符串参数传递给Webservice.但它们在Webservice中变为null.
WebService Code :         public boolean authenicateUser(@WebParam(name="username")String username,@WebParam(name="password")String password) {                System.out.println("InsIDe Authenticae USER+=========="+name+"-----"+Password);//This becomes null and null                 final String LOGIN_sql="SELECT * FROM UserDetails WHERE Username=? and Password=?";

Web服务托管在Localhost Tomcat服务器上

AndroID Server Request :       private static String nameSPACE = "http://src.AndroIDExample.Nagesh.com/";        private static String URL = "http://192.168.56.1:8080/AndroIDLoginWS/LoginWebService?wsdl";        private static String SOAP_ACTION = "http://src.AndroIDExample.Nagesh.com/";     Systerequest=new SoapObject(nameSPACE,WebMethodname);                System.out.println("Values before calling WS"+user.Username+"------"+user.Password);                request.addProperty("username",user.Username);                request.addProperty("password",user.Password);                return request;     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(                        SoapEnvelope.VER11);                envelope.setoutputSoapObject(request);                httpTransportSE androIDhttpTransport = new httpTransportSE(URL);     androIDhttpTransport.call(SOAP_ACTION + WebMethodname,envelope);                    System.out.println("INsIDe InvokeLoginWS==========RETURNED.................");                    SoapPrimitive response = (SoapPrimitive) envelope.getResponse();                    loginStatus = Boolean.parseBoolean(response.toString());

WSDL文件是:

This XML file does not appear to have any style information associated with it. The document tree is shown below.<!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.10 svn-revision#919b322c92f13ad085a933e8dd6dd35d4947364b. --><!-- Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.10 svn-revision#919b322c92f13ad085a933e8dd6dd35d4947364b. --><deFinitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/Metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://src.AndroIDExample.Nagesh.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetnamespace="http://src.AndroIDExample.Nagesh.com/" name="LoginService"><types><xsd:schema><xsd:import namespace="http://src.AndroIDExample.Nagesh.com/" schemaLocation="http://192.168.56.1:8080/AndroIDLoginWS/LoginWebService?xsd=1"/></xsd:schema></types><message name="register"><part name="parameters" element="tns:register"/></message><message name="registerResponse"><part name="parameters" element="tns:registerResponse"/></message><message name="authenicateUser"><part name="parameters" element="tns:authenicateUser"/></message><message name="authenicateUserResponse"><part name="parameters" element="tns:authenicateUserResponse"/></message><portType name="LoginMethods"><operation name="register"><input wsam:Action="http://src.AndroIDExample.Nagesh.com/LoginMethods/registerRequest" message="tns:register"/><output wsam:Action="http://src.AndroIDExample.Nagesh.com/LoginMethods/registerResponse" message="tns:registerResponse"/></operation><operation name="authenicateUser"><input wsam:Action="http://src.AndroIDExample.Nagesh.com/LoginMethods/authenicateUserRequest" message="tns:authenicateUser"/><output wsam:Action="http://src.AndroIDExample.Nagesh.com/LoginMethods/authenicateUserResponse" message="tns:authenicateUserResponse"/></operation></portType><binding name="LoginWSPortBinding" type="tns:LoginMethods"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" /><operation name="register"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation><operation name="authenicateUser"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation></binding><service name="LoginService"><port name="LoginWSPort" binding="tns:LoginWSPortBinding"><soap:address location="http://192.168.56.1:8080/AndroIDLoginWS/LoginWebService"/></port></service></deFinitions>

我是AndroID和Creating Web Service的新手.我尝试了很多其他解决方案但它似乎不起作用.

解决方法 我找到了问题的解决方案.我从wdsl打开了xsd架构.虽然我已经给出了@WebParam注释,但它只有arg0和arg1参数.我在请求中更改了它,参数正确传递. 总结

以上是内存溢出为你收集整理的使用k-Soap从Android的Callin Java webservice出错全部内容,希望文章能够帮你解决使用k-Soap从Android的Callin Java webservice出错所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1135133.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存