Visual Basic.NET - Matriz en Web Service desde PHP

 
Vista:
Imágen de perfil de Cristian
Val: 97
Ha aumentado 1 puesto en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Matriz en Web Service desde PHP

Publicado por Cristian (90 intervenciones) el 03/09/2014 14:40:59
Hola a todos... hace tiempo que estoy con esto y no se para donde salir.
Estoy intentando pasar una matriz desde un web service, pero no se como se absorbe. Aca paso el codigo en PHP:

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require_once('lib/nusoap.php');
 
// Create server object 
$server = new soap_server();
 
// configure WSDL
$server->configureWSDL('PHP Web Services return array', 'urn:returnArray'); //- See more at: http://my-source-codes.blogspot.com.ar/2011/10/php-web-service-return-array.html#sthash.YIxlfr8x.dpuf
// Complex Type Struct for return array
 
$server->wsdl->addComplexType('array_php',
'complexType',
'struct',
'all',
 '',
    array(
    'id' => array('id' => 'id', 'type' => 'xsd:string'),
    'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), 
    'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), 
    'email' => array('name' => 'email', 'type' => 'xsd:string') 
    )
    );
 
    $server->wsdl->addComplexType('return_array_php', 
    'complexType', 
    'array', 
    'all',
    'SOAP-ENC:Array', 
    array(),
    array(
    array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:array_php[]') 
    ),
    'tns:array_php' ); 
 
 
    $server->register('get_data', 
    array('limit_start' => 'xsd:int','limit_end' => 'xsd:int'), 
    array('return' => 'tns:return_array_php'), 
    $ns,
    $ns.'#get_data',
     'rpc', 
     'encoded', 
     'Returns array data in php web service' 
     );
 
     function get_data($limit_start,$limit_end)
     { /* you can use mysql and your logic here this is sample array */
     $array_rtr=array();
 
     $array_rtr[0]['id']=0; 
     $array_rtr[0]['firstname']='Nikunj'; 
     $array_rtr[0]['lastname']='Gandhi'; 
     $array_rtr[0]['email']='Nik_gandhi007@yahoo.com'; 
 
     $array_rtr[1]['id']=1; 
     $array_rtr[1]['firstname']='ABC'; 
     $array_rtr[1]['lastname']='EGF'; 
     $array_rtr[1]['email']='ABC@yahoo.com'; 
 
     $array_rtr[2]['id']=2; 
     $array_rtr[2]['firstname']='XYZ'; 
     $array_rtr[2]['lastname']='ZYX'; 
     $array_rtr[2]['email']='XYZ@yahoo.com'; 
 
     $array_rtr[3]['id']=3; 
     $array_rtr[3]['firstname']='zcds'; 
     $array_rtr[3]['lastname']='asdsa'; 
     $array_rtr[3]['email']='dxds@yahoo.com';
 
 $return=array();
 
    for($i=$limit_start;$i<=$limit_end;$i++){
        $return[$i]=$array_rtr[$i];
        }
 
    return $return;
 
    }
 
    $server->service($HTTP_RAW_POST_DATA);

Si alguien sabe como pasar los datos a VB.NET se lo voy a agradecer.

Saludos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Juan Arturo Gomez
Val: 2
Ha disminuido 1 puesto en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

Matriz en Web Service desde PHP

Publicado por Juan Arturo Gomez (3 intervenciones) el 04/09/2014 08:03:25
A ver si entendi. El webservice esta desarrollado con PHP. Quien consumira dicho webservice es .net.

Desde PHP, aunque he trabajado con el, no he desarrollado webservices, pero con .net para que consuma un webservice, regularmente la respuesta de dicho webservice debe venir como SOAP, XML o REST.

Aqui puedes ver un ejemplo de como es un mensaje "rest" que se lee con JSON desde .net, eclipse u otro, en este caso, el webservice lo desarrolle con .net y el cliente que consume es Android.

http://www.foreverjunior.com/wslive/Service1.svc/getCategorias

Habria que ver como es la respuesta de tu webservice en un demo o real.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar