Menu

return array

Help
ThaLyric
2005-04-19
2021-11-18
  • ThaLyric

    ThaLyric - 2005-04-19

    I'm trying to return an array like this :

    $array[0]["ticketID"]=1;
    $array[1]["ticketID"]=1;
    $array[2]["ticketID"]=1;

    etc ...

    Below is my code .... I still can't read the array in my client (Macromedia Flex 1.5). Am I doing something wrong?

    Please help!!!!!

    <?php

    $NAMESPACE1="tickets";
    $NAMESPACE='urn:' . $NAMESPACE1 .'wsdl';

    // Pull in the NuSOAP code
    require_once('lib/nusoap.php');

    // Create the server instance
    $server = new soap_server();

    // Initialize WSDL support
    $server->configureWSDL($NAMESPACE1 . 'wsdl', $NAMESPACE);
    $server->wsdl->schemaTargetNamespace = $NAMESPACE;

    $server->wsdl->addComplexType(
        'User',
        'complexType',
        'struct',
        'all',
        '',
        array(
            'username' => array('name' => 'username', 'type' => 'xsd:string'),
            'password' => array('name' => 'password', 'type' => 'xsd:string')
        )
    );

    $server->wsdl->addComplexType(
        'SOAPStruct',
        'complexType',
        'struct',
        'all',
        '',
        array(
            'ticketID' => array('name'=>'ticketID','type'=>'int')
        )
    );

    $server->wsdl->addComplexType(
        'Tickets',
        'complexType',
        'array',
        '',
        'SOAP-ENC:Array',
        array(),
        array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'SOAPStruct[]')),
        'SOAPStruct'
    );

    // Register the method to expose

    $server->register('getTickets',                // method name
        array('user' => 'tns:User'),        // input parameters
        array('return'=>'tns:Tickets'),
        $NAMESPACE,                    // namespace
        $NAMESPACE.'#getTickets',                // soapaction
        'rpc',                                // style
        'encoded',                            // use
        'get list of tickets'            // documentation
    );

    function getTickets($user)
    {
        /*
            trying to get the following array
           
            $array[0]["ticketID"]=1;
            $array[1]["ticketID"]=1;
            $array[2]["ticketID"]=1;
           
            etc
           
            but how?
        */
    }

    // Use the request to (try to) invoke the service
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
    $server->service($HTTP_RAW_POST_DATA);

    ?>

     
  • Jaime Tun

    Jaime Tun - 2021-11-18

    Did you find a solution? I am having the same problem.

     

Log in to post a comment.