0

I am stuck in a situation where I am unable to send multi-response not array type using soapval(nusoap). I looking for a solution to make struct which accepts multi-request and send multi-response in nusoap. I saw a lot of examples where I only saw the response as an array this is the main issue I think so.

Let me show you my code

$server->wsdl->addComplexType(
    'InitiateHolidayDataTransferResult',
    'complexType',
    'struct',
    'sequence',
    '',
    array( 'HOLIDAY_COMPLEX_TYPE_RES' => array(  
            'name' => 'HOLIDAY_COMPLEX_TYPE_RES',  'type' => 'tns:HOLIDAY_COMPLEX_TYPE_RES' ,'minOccurs' => '0', 'maxOccurs' => 'unbounded' )
)
);


$server->wsdl->addComplexType(
    'HOLIDAY_COMPLEX_TYPE_RES',
    'complexType',
    'struct',
    'all',
    '',
    array( 'STATUS' => array('name' => 'STATUS','type' => 'xsd:string'),
           'STATUS_DESC' => array('name' => 'STATUS_DESC','type' => 'xsd:string')
));

// Register the method to expose
    $server->register('HOLIDAY_INFORMATION_DATA',                    // method name
    array('name' => 'tns:HOLIDAY_COMPLEX_TYPE_REQ'),          // input parameters
    array('return' => 'tns:HOLIDAY_COMPLEX_TYPE_RES'),    // output parameters
    'urn:HOLIDAY_SERVER1',                         // namespace
    'urn:HOLIDAY_SERVER1#HOLIDAY_INFORMATION_DATA',                   // soapaction
    'document',                                    // style
    'encoded',                                // use
    'Holiday Information Get Method'        // documentation
);

// Define the method as a PHP function
function HOLIDAY_INFORMATION_DATA($mycomplextype) {


    $holiday_data_success='';
// trying to send multi reponse in many ways see below
foreach($mycomplextype as $key=>$val){
//one way      
   $parm = array();
 $parm[] =  array('STATUS'=>"Success", "STATUS_DESC"=>"-Holiday Added");
 $parm[] =  array('STATUS'=>"Success", "STATUS_DESC"=>"-Holiday Added");
 $parm[] =  array('STATUS'=>"Success", "STATUS_DESC"=>"-Holiday Added");
 $holiday_data_success = new soapval('return', 'tns:HOLIDAYRES_COMPLEX_TYPE_RES', $parm);


//second way
        $arr = array("STATUS"=>"12345", "STATUS_DESC"=>"Test heading",);
        $arr2 = array("STATUS"=>"12346", "STATUS_DESC"=>"Test heading");
        $holiday_data_success = array($arr, $arr2);
 // third way
$holiday_data_success=[];
 $holiday_data_success[] =  new soapval('return', 'tns:InitiateHolidayRESTransferResult', array('STATUS'=>"Success", "STATUS_DESC"=>$successtr."-Holiday Added"));  

       } // end foreach






 return $holiday_data_success;
}
// but nothing is working

I am unable to send multi-response for each record that I insert in db

3
  • Too much code! Can you please edit your question and bring it down to a minimal reproducible example? Commented May 14, 2019 at 2:10
  • Yes I can, let me edit it for you Commented May 14, 2019 at 7:56
  • What does this have to do with SoapUI? Commented May 14, 2019 at 23:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.