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
37
38
39
40
41
42
| package soapclient;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;
public class SoapClient {
public static void main(String [] args) {
try {
String endpoint = "https://url.dominio.es/webservice/servidor.php";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("https://url.dominio.es/", "metodo"));
String NS_XSD = "http://www.w3.org/2001/XMLSchema";
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
call.addParameter("parametro1", QNAME_TYPE_STRING, ParameterMode.IN);
call.addParameter("parametro2", QNAME_TYPE_STRING, ParameterMode.IN);
String[] params = { "valor_un_parametro",
"valor_otro_parametro"
};
call.setReturnType(QNAME_TYPE_STRING);
System.out.println(call.getMessageContext().toString());
String ret = (String) call.invoke( params );
System.out.println("Respuesta: " + ret );
} catch (Exception e) {
System.err.println(e.toString());
}
}
} |
package soapclient;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;
public class SoapClient {
public static void main(String [] args) {
try {
String endpoint = "https://url.dominio.es/webservice/servidor.php";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("https://url.dominio.es/", "metodo"));
String NS_XSD = "http://www.w3.org/2001/XMLSchema";
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
call.addParameter("parametro1", QNAME_TYPE_STRING, ParameterMode.IN);
call.addParameter("parametro2", QNAME_TYPE_STRING, ParameterMode.IN);
String[] params = { "valor_un_parametro",
"valor_otro_parametro"
};
call.setReturnType(QNAME_TYPE_STRING);
System.out.println(call.getMessageContext().toString());
String ret = (String) call.invoke( params );
System.out.println("Respuesta: " + ret );
} catch (Exception e) {
System.err.println(e.toString());
}
}
}