【发布时间】:2014-05-23 18:42:39
【问题描述】:
我使用 netbeans 创建了一个肥皂网络服务。现在我正在尝试使用我的 android 应用程序连接到它。 这是我的安卓方法:
public final static String SOAP_ACTION = "http://EntityPackage/verifyClient";
public final static String NAMESPACE = "http://EntityPackage/";
public final static String URL = "http://localhost:8080/WS/WS";
private boolean SendUserData(){
SoapObject request = new SoapObject(NAMESPACE, "verifyClient");
request.addProperty("user", Profile.username);
request.addProperty("pwd1", Profile.password);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
HttpTransportSE transport = new HttpTransportSE(URL);
transport.call(SOAP_ACTION, envelope);
SoapObject result = (SoapObject)envelope.bodyIn;
}
这是我的 WSDL:
<definitions targetNamespace="http://EntityPackage/" name="WS"><types><xsd:schema><xsd:import namespace="http://EntityPackage/" schemaLocation="http://localhost:8080/WS/WS?xsd=1"/></xsd:schema></types><message name="persist"><part name="parameters" element="tns:persist"/></message><message name="getPrenotazioniByAgenzia"><part name="parameters" element="tns:getPrenotazioniByAgenzia"/></message><message name="getPrenotazioniByAgenziaResponse"><part name="parameters" element="tns:getPrenotazioniByAgenziaResponse"/></message><message name="verifyClient"><part name="parameters" element="tns:verifyClient"/></message><message name="verifyClientResponse"><part name="parameters" element="tns:verifyClientResponse"/></message><message name="getPrenotazioniByCliente"><part name="parameters" element="tns:getPrenotazioniByCliente"/></message><message name="getPrenotazioniByClienteResponse"><part name="parameters" element="tns:getPrenotazioniByClienteResponse"/></message><portType name="WS"><operation name="persist"><input wsam:Action="http://EntityPackage/WS/persist" message="tns:persist"/></operation><operation name="getPrenotazioniByAgenzia"><input wsam:Action="http://EntityPackage/WS/getPrenotazioniByAgenziaRequest" message="tns:getPrenotazioniByAgenzia"/><output wsam:Action="http://EntityPackage/WS/getPrenotazioniByAgenziaResponse" message="tns:getPrenotazioniByAgenziaResponse"/></operation><operation name="verifyClient"><input wsam:Action="http://EntityPackage/WS/verifyClientRequest" message="tns:verifyClient"/><output wsam:Action="http://EntityPackage/WS/verifyClientResponse" message="tns:verifyClientResponse"/></operation><operation name="getPrenotazioniByCliente"><input wsam:Action="http://EntityPackage/WS/getPrenotazioniByClienteRequest" message="tns:getPrenotazioniByCliente"/><output wsam:Action="http://EntityPackage/WS/getPrenotazioniByClienteResponse" message="tns:getPrenotazioniByClienteResponse"/></operation></portType><binding name="WSPortBinding" type="tns:WS"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/><operation name="persist"><soap:operation soapAction=""/><input><soap:body use="literal"/></input></operation><operation name="getPrenotazioniByAgenzia"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation><operation name="verifyClient"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation><operation name="getPrenotazioniByCliente"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation></binding><service name="WS"><port name="WSPort" binding="tns:WSPortBinding"><soap:address location="http://localhost:8080/WS/WS"/></port></service></definitions>
结果始终为空。 SOAP_ACTION;URL 和 NAMESPACE 对吗????
【问题讨论】:
标签: java android web-services soap wsdl