RECIBO PARAMETROS NULL
Publicado por jesus (1 intervención) el 12/02/2018 02:06:04
Saludos...
Estoy tratando de consumir un servicio soap desde android.
el problema que tengo es que logro hacer la consulta pero los parametros llegan en null.
creo que con el código se entiende mejor.
CÓDIGO DEL CLIENTE ANDROID
CÓDIGO DEL SERVIDOR JAVA
al realizar la consulta me retorna lo siguiente:
Hello null!
no se cual sea el problema al enviar el parametro.
AQUI LES DEJO EL WSDL POR SI ES DE AYUDA
Estoy tratando de consumir un servicio soap desde android.
el problema que tengo es que logro hacer la consulta pero los parametros llegan en null.
creo que con el código se entiende mejor.
CÓDIGO DEL CLIENTE ANDROID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
String
url = "http://192.168.0.2:8084/tutosoap/HolaMundo",
soap_action = "http://ws/HolaMundo/helloRequest",
namespace = "http://ws/",
operation = "hello";
SoapObject request = new SoapObject(namespace, operation);
request.addProperty("nombre", "jesus");//*** Quiero establecer el valor jesus en la propiedad llamada nombre ***
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(url);
transport.call(soap_action, envelope);
String out = (SoapPrimitive) envelope.getResponse().toString;
CÓDIGO DEL SERVIDOR JAVA
1
2
3
4
5
6
7
8
9
@WebService(serviceName = "HolaMundo")
public class HolaMundo {
@WebMethod(operationName = "hello")
public String hello(@WebParam(name="nombre") String txt) {// ** aqui esta el nombre de la propiedad***
return "Hello " + txt + " !";
}
}
al realizar la consulta me retorna lo siguiente:
Hello null!
no se cual sea el problema al enviar el parametro.
AQUI LES DEJO EL WSDL POR SI ES DE AYUDA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<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://ws/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws/" name="HolaMundo">
<types>
<xsd:schema>
<xsd:import namespace="http://ws/" schemaLocation="http://localhost:8084/tutosoap/HolaMundo?xsd=1"/>
</xsd:schema>
</types>
<message name="hello">
<part name="parameters" element="tns:hello"/>
</message>
<message name="helloResponse">
<part name="parameters" element="tns:helloResponse"/>
</message>
<portType name="HolaMundo">
<operation name="hello">
<input wsam:Action="http://ws/HolaMundo/helloRequest" message="tns:hello"/>
<output wsam:Action="http://ws/HolaMundo/helloResponse" message="tns:helloResponse"/>
</operation>
</portType>
<binding name="HolaMundoPortBinding" type="tns:HolaMundo">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="hello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="HolaMundo">
<port name="HolaMundoPort" binding="tns:HolaMundoPortBinding">
<soap:address location="http://localhost:8084/tutosoap/HolaMundo"/>
</port>
</service>
</definitions>
Valora esta pregunta


0