Consumir servicios Web Java con NuSOAP
Publicado por Cristian (42 intervenciones) el 12/12/2012 17:46:48
Hola tengo el siguiente WS, que lo extraje con SoapUI:
Funciona:
Ahora estoy tratando de consumir ese servicio con un cliente PHP y usando NuSOAP.
Pero no logro hacerlo, aca posteo lo que hice.
No se en que me estoy equivocando, ayudenme por favor
Funciona:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.ongei.innobix.com/">
<soapenv:Header/>
<soapenv:Body>
<ws:sendSMS>
<!--Optional:-->
<sms>
<ws:sender>Empresa</ws:sender>
<ws:subject>prueba pide</ws:subject>
<ws:message>estoy probando el envio</ws:message>
<!--Optional:-->
<ws:receivers>
<!--Zero or more repetitions:-->
<ws:receiver>965373727</ws:receiver>
</ws:receivers>
<!--Optional:-->
<ws:file>cid:293082408891</ws:file>
</sms>
</ws:sendSMS>
</soapenv:Body>
</soapenv:Envelope>
Ahora estoy tratando de consumir ese servicio con un cliente PHP y usando NuSOAP.
Pero no logro hacerlo, aca posteo lo que hice.
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
require_once('lib/nusoap.php');
// haremos una simulacion de el cliente
try{
$client = new soapclient('http://ws.pide.gob.pe/sms/sendSMSService?wsdl');
$destino = $_POST['txtDestino'];
$usuario = $_POST['txtUsuario'];
$asunto = $_POST['txtAsunto'];
$mensaje = $_POST['txtnumero'];
// en este caso ya subimos el web service a internet
//$respCorreo= $client->enviarcorreo($destino,$usuario, $asunto, $mensaje);
$respCorreo= $client->sendSMS($destino,$usuario, $asunto, $mensaje);
// especificamos los paramentos
print_r($respCorreo);
// mostramos la respuesta
}
catch(Exception $e){
//procedimiento en caso de reportar errores
echo '<b>Error de envio!!: No se envio </b>';
}
?>
<form id="form1" name="form1" method="post" action="">
<table width="402" border="0">
<tr>
<td width="176" height="48">sender:</td>
<td width="216"><label>
<input name="txtDestino" type="text" id="txtDestino" />
</label></td>
</tr>
<tr>
<td>subject</td>
<td><label>
<input name="txtUsuario" type="text" id="txtUsuario" />
</label></td>
</tr>
<tr>
<td>message</td>
<td><label>
<input name="txtAsunto" type="text" id="txtAsunto" />
</label></td>
</tr>
<tr>
<td>receiver</td>
<td><label>
<input name="txtnumero" type="text" id="txtnumero" />
</label></td>
</tr>
<tr>
<td colspan="2"><label>
<input name="btnEnviar" type="submit" id="btnEnviar" value="Enviar" />
</label></td>
</tr>
</table>
</form>
No se en que me estoy equivocando, ayudenme por favor
Valora esta pregunta


0