找不到{} Ksoap2响应的调度方法

时间:2014-01-09 03:02:57

标签: android web-services wsdl android-ksoap2 ksoap

我无法弄明白我使用kso​​ap在android上创建了一个websercie客户端应用程序 我试图使用webservice将数据保存到服务器进行跟踪,我的客户端工作正常,因为我使用“SaveAppointment”web seervice方法,但是当我使用“SaveAppForTracking”时肥皂给我这个错误

SoapFault - faultcode: 'S:Client' faultstring: 'Cannot find dispatch method for {}' faultactor: 'null' detail: null

我很困惑,如果因为找不到方法那么为什么当我使用java-app(而不是andoid -javadesktop应用程序)作为客户端它成功.. myserver已经部署,这里是我的wsdl

    <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://service.ws.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://service.ws.com/" name="MeetAppService">
<types>
<xsd:schema>
<xsd:import namespace="http://service.ws.com/" schemaLocation="http://192.168.1.3:8080/MeetAppsServer/MeetAppService?xsd=1"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://jaxb.dev.java.net/array" schemaLocation="http://192.168.1.3:8080/MeetAppsServer/MeetAppService?xsd=2"/>
</xsd:schema>
</types>
<message name="getAllFriendsLocation">
<part name="parameters" element="tns:getAllFriendsLocation"/>
</message>
<message name="getAllFriendsLocationResponse">
<part name="parameters" element="tns:getAllFriendsLocationResponse"/>
</message>
<message name="UpdateAppointment">
<part name="parameters" element="tns:UpdateAppointment"/>
</message>
<message name="updateFriendStatus">
<part name="parameters" element="tns:updateFriendStatus"/>
</message>
<message name="DeleteAppointment">
<part name="parameters" element="tns:DeleteAppointment"/>
</message>
<message name="SaveAppointMent">
<part name="parameters" element="tns:SaveAppointMent"/>
</message>
<message name="SaveForTracking">
<part name="parameters" element="tns:SaveForTracking"/>
</message>
<message name="getApproveFriends">
<part name="parameters" element="tns:getApproveFriends"/>
</message>
<message name="getApproveFriendsResponse">
<part name="parameters" element="tns:getApproveFriendsResponse"/>
</message>
<message name="updateUserLocation">
<part name="parameters" element="tns:updateUserLocation"/>
</message>
<message name="DeleteTrack">
<part name="parameters" element="tns:DeleteTrack"/>
</message>
<message name="hello">
<part name="parameters" element="tns:hello"/>
</message>
<message name="helloResponse">
<part name="parameters" element="tns:helloResponse"/>
</message>
<message name="SetUserLocation">
<part name="parameters" element="tns:SetUserLocation"/>
</message>
<message name="SetUserLocationResponse">
<part name="parameters" element="tns:SetUserLocationResponse"/>
</message>
<message name="SaveAppForTracking">
<part name="parameters" element="tns:SaveAppForTracking"/>
</message>
<portType name="MeetAppService">
<operation name="getAllFriendsLocation">
<input wsam:Action="http://service.ws.com/MeetAppService/getAllFriendsLocationRequest" message="tns:getAllFriendsLocation"/>
<output wsam:Action="http://service.ws.com/MeetAppService/getAllFriendsLocationResponse" message="tns:getAllFriendsLocationResponse"/>
</operation>
<operation name="UpdateAppointment">
<input wsam:Action="http://service.ws.com/MeetAppService/UpdateAppointment" message="tns:UpdateAppointment"/>
</operation>
<operation name="updateFriendStatus">
<input wsam:Action="http://service.ws.com/MeetAppService/updateFriendStatus" message="tns:updateFriendStatus"/>
</operation>
<operation name="DeleteAppointment">
<input wsam:Action="http://service.ws.com/MeetAppService/DeleteAppointment" message="tns:DeleteAppointment"/>
</operation>
<operation name="SaveAppointMent">
<input wsam:Action="http://service.ws.com/MeetAppService/SaveAppointMent" message="tns:SaveAppointMent"/>
</operation>
<operation name="SaveForTracking">
<input wsam:Action="http://service.ws.com/MeetAppService/SaveForTracking" message="tns:SaveForTracking"/>
</operation>
<operation name="getApproveFriends">
<input wsam:Action="http://service.ws.com/MeetAppService/getApproveFriendsRequest" message="tns:getApproveFriends"/>
<output wsam:Action="http://service.ws.com/MeetAppService/getApproveFriendsResponse" message="tns:getApproveFriendsResponse"/>
</operation>
<operation name="updateUserLocation">
<input wsam:Action="http://service.ws.com/MeetAppService/updateUserLocation" message="tns:updateUserLocation"/>
</operation>
<operation name="DeleteTrack">
<input wsam:Action="http://service.ws.com/MeetAppService/DeleteTrack" message="tns:DeleteTrack"/>
</operation>
<operation name="hello">
<input wsam:Action="http://service.ws.com/MeetAppService/helloRequest" message="tns:hello"/>
<output wsam:Action="http://service.ws.com/MeetAppService/helloResponse" message="tns:helloResponse"/>
</operation>
<operation name="SetUserLocation">
<input wsam:Action="http://service.ws.com/MeetAppService/SetUserLocationRequest" message="tns:SetUserLocation"/>
<output wsam:Action="http://service.ws.com/MeetAppService/SetUserLocationResponse" message="tns:SetUserLocationResponse"/>
</operation>
<operation name="SaveAppForTracking">
<input wsam:Action="http://service.ws.com/MeetAppService/SaveAppForTracking" message="tns:SaveAppForTracking"/>
</operation>
</portType>
<binding name="MeetAppServicePortBinding" type="tns:MeetAppService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getAllFriendsLocation">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="UpdateAppointment">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="updateFriendStatus">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="DeleteAppointment">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="SaveAppointMent">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="SaveForTracking">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="getApproveFriends">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="updateUserLocation">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="DeleteTrack">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="hello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="SetUserLocation">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="SaveAppForTracking">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
</binding>
<service name="MeetAppService">
<port name="MeetAppServicePort" binding="tns:MeetAppServicePortBinding">
<soap:address location="http://192.168.1.3:8080/MeetAppsServer/MeetAppService"/>
</port>
</service>
</definitions>

我的StaticClassData:

public class StaticWebServiceData {
public static final String METHOD_SAVE_FOR_TRACKING = "SaveAppForTracking";
public static final String SOAP_ACTION_TRACKING = "http://service.ws.com/SaveAppForTracking";
public static final String NAMESPACE = "http://service.ws.com/";
public static final String URL="http://192.168.1.3:8080/MeetAppsServer/MeetAppService?wsdl";
}

这里是ipplementation:

SoapObject request = new SoapObject(StaticWebServiceData.NAMESPACE, StaticWebServiceData.METHOD_SAVE_FOR_TRACKING);           
            Log.d("FBEventID", app.fbEventid);
            Log.d("NAME_SPACE", StaticWebServiceData.NAMESPACE);
            Log.d("SAVE_TRACK", StaticWebServiceData.METHOD_SAVE_FOR_TRACKING);
            Log.d("ACTION", StaticWebServiceData.SOAP_ACTION_TRACKING);

            request.addProperty("FBEventID", app.fbEventid);
            request.addProperty("FBUserID", userID[indexFriend]);
            request.addProperty("status", "not_replied");
            request.addProperty("longitude", "0.0");
            request.addProperty("latitude", "0.0");
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

            HttpTransportSE ht = new HttpTransportSE(StaticWebServiceData.URL);
            ht.debug = true;
            try {
             ht.call(StaticWebServiceData.SOAP_ACTION_TRACKING, envelope);
             Log.d("web service", "Sukses" +envelope.bodyIn.toString());
            } catch (Exception e) {
                e.printStackTrace();
            }

这是我的网络服务:

 /**
     * Web service operation
     */
    @WebMethod(operationName = "SaveAppForTracking")
    @Oneway
    public void SaveAppForTracking(@WebParam(name = "FBEventID") String FBEventID, @WebParam(name = "FBUserID") String FBUserID, @WebParam(name = "status") String status, @WebParam(name = "longitude") String longitude, @WebParam(name = "latitude") String latitude) {
         new databseDAO().saveForTracking(new TrackData(FBEventID, FBUserID, status, longitude, latitude));
    }

有人可以告诉我这里有什么问题..

2 个答案:

答案 0 :(得分:1)

根据您的错误,

您的实现中无法访问公共类StaticWebServiceData {}。

这意味着,以下值在您的实现中变为null。

StaticWebServiceData.NAMESPACE
StaticWebServiceData.METHOD_SAVE_FOR_TRACKING
StaticWebServiceData.URL

答案 1 :(得分:0)

thanx到 user3090039

他的调查是正确的......但他显然不是正确的

我的静态变量不为空

错误发生是因为我忘记添加此行

 envelope.setOutputSoapObject(request);

抱歉被当作白痴..哈哈哈..感谢..