该代码的目的是连接到返回用户> data的Web服务
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:bdds" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:prodata="urn:schemas-progress-com:xml-prodata:0001" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:S1="urn:soap-fault:details" xmlns:S2="urn:bdds:WSPrueba" name="WSPrueba" targetNamespace="urn:bdds">
<wsdl:documentation>
-
</wsdl:documentation>
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" targetNamespace="urn:soap-fault:details">
<element name="FaultDetail">
<complexType>
<sequence>
<element name="errorMessage" type="xsd:string"/>
<element name="requestID" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="urn:bdds:WSPrueba">
<element name="pLeeArticulo">
<complexType>
<sequence>
<element name="liEmpre" nillable="true" type="xsd:int"/>
<element name="liDele" nillable="true" type="xsd:int"/>
<element name="lcArt" nillable="true" type="xsd:string"/>
<element name="piPRESS" nillable="true" type="xsd:int"/>
<element name="lcCampo" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="pLeeArticuloResponse">
<complexType>
<sequence>
<element name="result" nillable="true" type="xsd:string"/>
<element name="lcValor" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="pLeeCliente">
<complexType>
<sequence>
<element name="piEmp" nillable="true" type="xsd:int"/>
<element name="piDel" nillable="true" type="xsd:int"/>
<element name="pCCli" nillable="true" type="xsd:string"/>
<element name="piDE" nillable="true" type="xsd:int"/>
<element name="pcCampo" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="pLeeClienteResponse">
<complexType>
<sequence>
<element name="result" nillable="true" type="xsd:string"/>
<element name="pcValor" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="pLeeUsuario">
<complexType>
<sequence>
<element name="pcUsuario" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="pLeeUsuarioResponse">
<complexType>
<sequence>
<element name="result" nillable="true" type="xsd:string"/>
<element name="pcNombre" nillable="true" type="xsd:string"/>
<element name="pcContra" nillable="true" type="xsd:string"/>
<element name="piPerfil" nillable="true" type="xsd:int"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="WSPrueba_pLeeCliente">
<part name="parameters" element="S2:pLeeCliente"/>
</message>
<message name="WSPrueba_pLeeArticuloResponse">
<part name="parameters" element="S2:pLeeArticuloResponse"/>
</message>
<message name="WSPrueba_pLeeUsuario">
<part name="parameters" element="S2:pLeeUsuario"/>
</message>
<message name="FaultDetailMessage">
<part name="FaultDetail" element="S1:FaultDetail"/>
</message>
<message name="WSPrueba_pLeeUsuarioResponse">
<part name="parameters" element="S2:pLeeUsuarioResponse"/>
</message>
<message name="WSPrueba_pLeeArticulo">
<part name="parameters" element="S2:pLeeArticulo"/>
</message>
<message name="WSPrueba_pLeeClienteResponse">
<part name="parameters" element="S2:pLeeClienteResponse"/>
</message>
<portType name="WSPruebaObj">
<operation name="pLeeArticulo">
<input message="tns:WSPrueba_pLeeArticulo"/>
<output message="tns:WSPrueba_pLeeArticuloResponse"/>
<fault name="WSPruebaFault" message="tns:FaultDetailMessage"/>
</operation>
<operation name="pLeeCliente">
<input message="tns:WSPrueba_pLeeCliente"/>
<output message="tns:WSPrueba_pLeeClienteResponse"/>
<fault name="WSPruebaFault" message="tns:FaultDetailMessage"/>
</operation>
<operation name="pLeeUsuario">
<input message="tns:WSPrueba_pLeeUsuario"/>
<output message="tns:WSPrueba_pLeeUsuarioResponse"/>
<fault name="WSPruebaFault" message="tns:FaultDetailMessage"/>
</operation>
</portType>
<binding name="WSPruebaObj" type="tns:WSPruebaObj">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="pLeeArticulo">
<soap:operation soapAction="" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="WSPruebaFault">
<soap:fault name="WSPruebaFault" use="literal"/>
</fault>
</operation>
<operation name="pLeeCliente">
<soap:operation soapAction="" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="WSPruebaFault">
<soap:fault name="WSPruebaFault" use="literal"/>
</fault>
</operation>
<operation name="pLeeUsuario">
<soap:operation soapAction="" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="WSPruebaFault">
<soap:fault name="WSPruebaFault" use="literal"/>
</fault>
</operation>
</binding>
<service name="WSPruebaService">
<port name="WSPruebaObj" binding="tns:WSPruebaObj">
<wsdl:documentation/>
<soap:address location="http://185.5.126.18:8081/wsa/wsa1"/>
</port>
</service>
</definitions>
xxxxxxxxxxxxxxxxxxx
字符串NAMESPACE =“ http://schemas.xmlsoap.org/wsdl/”;
enter code here
字符串URL =“ http://xxxxx:8081/wsa/wsa1/wsdl?targetURI=WSPrueba”; 字符串METHOD_NAME =“ pLeeUsuario”; 字符串SOAP_ACTION =“ http://schemas.xmlsoap.org/wsdl/pLeeUsuario”;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
//SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = false;
envelope.setOutputSoapObject(request);
HttpTransportSE transporte = new HttpTransportSE(URL);
try
{
transporte.call(SOAP_ACTION, envelope);
SoapObject resSoap =(SoapObject)envelope.getResponse();
listaClientes = new Cliente[resSoap.getPropertyCount()];
for (int i = 0; i < listaClientes.length; i++)
{
SoapObject ic = (SoapObject)resSoap.getProperty(i);
Cliente cli = new Cliente();
cli.id = Integer.parseInt(ic.getProperty(0).toString());
cli.nombre = ic.getProperty(1).toString();
cli.telefono = Integer.parseInt(ic.getProperty(2).toString());
listaClientes[i] = cli;
}
}
catch (Exception e)
{
resul = false;
}
the error appears
java.io.IOException: HTTP request failed, HTTP status: 404