@@ -113,7 +113,7 @@ |
||
113 | 113 | foreach ($data_array as $item) { |
114 | 114 | $row = array (); |
115 | 115 | if ($this->iscourse == '1') { |
116 | - $row[] = $item['result_id']; |
|
116 | + $row[] = $item['result_id']; |
|
117 | 117 | } |
118 | 118 | if ($is_western_name_order) { |
119 | 119 | $row[] = $item['firstname']; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | isset ($_GET['action']) || |
19 | 19 | isset ($_POST['action'])) |
20 | 20 | ) { |
21 | - api_not_allowed(); |
|
21 | + api_not_allowed(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -86,30 +86,30 @@ discard block |
||
86 | 86 | |
87 | 87 | // Build the form |
88 | 88 | if (isset($_GET['id'])) { |
89 | - // Update settings of existing category |
|
90 | - $action = 'update_settings'; |
|
89 | + // Update settings of existing category |
|
90 | + $action = 'update_settings'; |
|
91 | 91 | $form = new FormValidator( |
92 | 92 | 'group_category', |
93 | 93 | 'post', |
94 | 94 | api_get_self().'?id='.$category['id'].'&'.api_get_cidreq() |
95 | 95 | ); |
96 | - $form->addElement('hidden', 'id'); |
|
96 | + $form->addElement('hidden', 'id'); |
|
97 | 97 | } else { |
98 | 98 | // Checks if the field was created in the table Category. It creates it if is neccesary |
99 | 99 | $table_category = Database :: get_course_table(TABLE_GROUP_CATEGORY); |
100 | 100 | if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) { |
101 | 101 | Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = $course_id"); |
102 | 102 | } |
103 | - // Create a new category |
|
104 | - $action = 'add_category'; |
|
105 | - $form = new FormValidator('group_category'); |
|
103 | + // Create a new category |
|
104 | + $action = 'add_category'; |
|
105 | + $form = new FormValidator('group_category'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // If categories allowed, show title & description field |
109 | 109 | if (api_get_setting('allow_group_categories') == 'true') { |
110 | 110 | $form->addElement('header', $nameTools); |
111 | 111 | $form->addElement('html', '<div class="row"><div class="col-md-6">'); |
112 | - $form->addText('title', get_lang('Title')); |
|
112 | + $form->addText('title', get_lang('Title')); |
|
113 | 113 | |
114 | 114 | // Groups per user |
115 | 115 | $possible_values = array(); |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $form->addElement('html', '</div>'); |
143 | 143 | $form->addElement('html', '</div>'); |
144 | 144 | } else { |
145 | - $form->addElement('hidden', 'title'); |
|
146 | - $form->addElement('hidden', 'description'); |
|
145 | + $form->addElement('hidden', 'title'); |
|
146 | + $form->addElement('hidden', 'description'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $form->addElement('header', get_lang('DefaultSettingsForNewGroups')); |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | if (isset($_POST['number_of_groups'])) { |
80 | 80 | if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) { |
81 | 81 | Display :: display_error_message( |
82 | - get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
82 | + get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
83 | 83 | <a href="group_creation.php?'.api_get_cidreq().'">« '.get_lang('Back').'</a>', |
84 | - false |
|
85 | - ); |
|
84 | + false |
|
85 | + ); |
|
86 | 86 | } else { |
87 | 87 | $number_of_groups = intval($_POST['number_of_groups']); |
88 | 88 | if ($number_of_groups > 1) { |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | } |
121 | 121 | </script> |
122 | 122 | <?php |
123 | - } |
|
124 | - $group_categories = GroupManager::get_categories(); |
|
125 | - $group_id = GroupManager :: get_number_of_groups() + 1; |
|
126 | - $cat_options = []; |
|
127 | - foreach ($group_categories as $index => $category) { |
|
128 | - $cat_options[$category['id']] = $category['title']; |
|
129 | - } |
|
123 | + } |
|
124 | + $group_categories = GroupManager::get_categories(); |
|
125 | + $group_id = GroupManager :: get_number_of_groups() + 1; |
|
126 | + $cat_options = []; |
|
127 | + foreach ($group_categories as $index => $category) { |
|
128 | + $cat_options[$category['id']] = $category['title']; |
|
129 | + } |
|
130 | 130 | $form = new FormValidator('create_groups_step2', 'POST', api_get_self().'?'.api_get_cidreq()); |
131 | 131 | |
132 | - // Modify the default templates |
|
133 | - $renderer = $form->defaultRenderer(); |
|
134 | - $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
135 | - $renderer->setFormTemplate($form_template); |
|
136 | - $element_template = <<<EOT |
|
132 | + // Modify the default templates |
|
133 | + $renderer = $form->defaultRenderer(); |
|
134 | + $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
135 | + $renderer->setFormTemplate($form_template); |
|
136 | + $element_template = <<<EOT |
|
137 | 137 | <tr class="separate"> |
138 | 138 | <td> |
139 | 139 | <!-- BEGIN required --> |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $form->setDefaults($defaults); |
226 | 226 | $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
227 | 227 | $form->display(); |
228 | - } |
|
228 | + } |
|
229 | 229 | } else { |
230 | 230 | /* |
231 | 231 | * Show form to generate new groups |
@@ -267,11 +267,11 @@ |
||
267 | 267 | $coachName = api_get_person_name($userResult['firstname'], $userResult['lastname']); |
268 | 268 | } |
269 | 269 | |
270 | - $courses[] = array( |
|
271 | - 'id' => $courseId, |
|
272 | - 'name' => $course['title'], |
|
273 | - 'coachName' => $coachName, |
|
274 | - ); |
|
270 | + $courses[] = array( |
|
271 | + 'id' => $courseId, |
|
272 | + 'name' => $course['title'], |
|
273 | + 'coachName' => $coachName, |
|
274 | + ); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | echo json_encode($courses); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $add_type = 'unique'; |
39 | 39 | |
40 | 40 | if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { |
41 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
41 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null; |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | |
427 | 427 | if ($use_extra_fields) { |
428 | 428 | $final_result = array(); |
429 | - if (count($extra_field_result)>1) { |
|
430 | - for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
429 | + if (count($extra_field_result)>1) { |
|
430 | + for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
431 | 431 | if (is_array($extra_field_result[$i+1])) { |
432 | 432 | $final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]); |
433 | 433 | } |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | } |
548 | 548 | |
549 | 549 | if ($add_type == 'multiple') { |
550 | - $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'. |
|
550 | + $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'. |
|
551 | 551 | Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
552 | - $link_add_type_multiple = Display::url(Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'), ''); |
|
552 | + $link_add_type_multiple = Display::url(Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'), ''); |
|
553 | 553 | } else { |
554 | - $link_add_type_unique = Display::url(Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'), ''); |
|
555 | - $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
554 | + $link_add_type_unique = Display::url(Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'), ''); |
|
555 | + $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
556 | 556 | } |
557 | 557 | $link_add_group = Display::url( |
558 | 558 | Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'), |
@@ -580,17 +580,17 @@ discard block |
||
580 | 580 | <?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?> |
581 | 581 | <?php |
582 | 582 | if ($add_type=='multiple') { |
583 | - if (is_array($extra_field_list)) { |
|
584 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
585 | - echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
586 | - foreach ($new_field_list as $new_field) { |
|
587 | - echo $new_field['name']; |
|
588 | - $varname = 'field_'.$new_field['variable']; |
|
583 | + if (is_array($extra_field_list)) { |
|
584 | + if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
585 | + echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
586 | + foreach ($new_field_list as $new_field) { |
|
587 | + echo $new_field['name']; |
|
588 | + $varname = 'field_'.$new_field['variable']; |
|
589 | 589 | $fieldtype = $new_field['type']; |
590 | - echo ' <select name="'.$varname.'">'; |
|
591 | - echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
592 | - foreach ($new_field['data'] as $option) { |
|
593 | - $checked=''; |
|
590 | + echo ' <select name="'.$varname.'">'; |
|
591 | + echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
592 | + foreach ($new_field['data'] as $option) { |
|
593 | + $checked=''; |
|
594 | 594 | if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { |
595 | 595 | if (isset($_POST[$varname])) { |
596 | 596 | if ($_POST[$varname] == $option['tag']) { |
@@ -611,11 +611,11 @@ discard block |
||
611 | 611 | $extraHidden = $fieldtype == ExtraField::FIELD_TYPE_TAG ? '<input type="hidden" name="field_id" value="'.$option['field_id'].'" />' : ''; |
612 | 612 | echo $extraHidden; |
613 | 613 | echo ' '; |
614 | - } |
|
615 | - echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
616 | - echo '<br /><br />'; |
|
617 | - } |
|
618 | - } |
|
614 | + } |
|
615 | + echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
616 | + echo '<br /><br />'; |
|
617 | + } |
|
618 | + } |
|
619 | 619 | } |
620 | 620 | ?> |
621 | 621 | <input type="hidden" name="form_sent" value="1" /> |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | |
624 | 624 | <?php |
625 | 625 | if (!empty($errorMsg)) { |
626 | - Display::display_normal_message($errorMsg); //main API |
|
626 | + Display::display_normal_message($errorMsg); //main API |
|
627 | 627 | } |
628 | 628 | ?> |
629 | 629 | <div id="multiple-add-session" class="row"> |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | <label><?php echo get_lang('UserListInPlatform') ?> </label> |
633 | 633 | <?php |
634 | 634 | if (!($add_type=='multiple')) { |
635 | - ?> |
|
635 | + ?> |
|
636 | 636 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" class="form-control" /> |
637 | 637 | <div id="ajax_list_users_single" class="select-list-ajax"></div> |
638 | 638 | <?php |
@@ -641,21 +641,21 @@ discard block |
||
641 | 641 | <div id="ajax_list_users_multiple"> |
642 | 642 | <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" class="form-control"> |
643 | 643 | <?php |
644 | - foreach ($nosessionUsersList as $uid => $enreg) { |
|
645 | - ?> |
|
644 | + foreach ($nosessionUsersList as $uid => $enreg) { |
|
645 | + ?> |
|
646 | 646 | <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>> |
647 | 647 | <?php |
648 | - $personName = api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].') '.$enreg['official_code']; |
|
649 | - if ($showOfficialCode) { |
|
650 | - $officialCode = !empty($enreg['official_code']) ? $enreg['official_code'].' - ' : '? - '; |
|
651 | - $personName = $officialCode.api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; |
|
652 | - } |
|
653 | - echo $personName; |
|
654 | - ?> |
|
648 | + $personName = api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].') '.$enreg['official_code']; |
|
649 | + if ($showOfficialCode) { |
|
650 | + $officialCode = !empty($enreg['official_code']) ? $enreg['official_code'].' - ' : '? - '; |
|
651 | + $personName = $officialCode.api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; |
|
652 | + } |
|
653 | + echo $personName; |
|
654 | + ?> |
|
655 | 655 | </option> |
656 | 656 | <?php |
657 | - } |
|
658 | - ?> |
|
657 | + } |
|
658 | + ?> |
|
659 | 659 | </select> |
660 | 660 | </div> |
661 | 661 | <input type="checkbox" onchange="checked_in_no_session(this.checked);" name="user_with_any_session" id="user_with_any_session_id"> |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | <?php |
664 | 664 | } |
665 | 665 | unset($nosessionUsersList); |
666 | - ?> |
|
666 | + ?> |
|
667 | 667 | </div> |
668 | 668 | </div> |
669 | 669 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | <?php |
708 | 708 | } |
709 | 709 | if (!empty($addProcess)) { |
710 | - echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
710 | + echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
711 | 711 | } else { |
712 | 712 | echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>'; |
713 | 713 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $add_type = 'multiple'; |
57 | 57 | if (isset($_GET['add_type']) && $_GET['add_type']!='') { |
58 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
58 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if (!api_is_platform_admin()) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $return .= '...<br />'; |
161 | 161 | } |
162 | 162 | } |
163 | - $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
163 | + $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
164 | 164 | } else { |
165 | 165 | $return .= '<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15" ">'; |
166 | 166 | while($user = Database :: fetch_array($rs)) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - return $xajax_response; |
|
175 | + return $xajax_response; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | $xajax->processRequests(); |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | $assigned_users_id = array_keys($assigned_users_to_hrm); |
360 | 360 | $without_assigned_users = ''; |
361 | 361 | if (count($assigned_users_id) > 0) { |
362 | - $without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND "; |
|
362 | + $without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND "; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | $search_user = ''; |
366 | 366 | if (!empty($firstLetterUser)) { |
367 | - $needle = Database::escape_string($firstLetterUser); |
|
368 | - $search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
367 | + $needle = Database::escape_string($firstLetterUser); |
|
368 | + $search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $sqlConditions = null; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | if (api_is_multiple_url_enabled()) { |
388 | - $sql = "SELECT user.user_id, username, lastname, firstname |
|
388 | + $sql = "SELECT user.user_id, username, lastname, firstname |
|
389 | 389 | FROM $tbl_user user LEFT JOIN $tbl_access_url_rel_user au |
390 | 390 | ON (au.user_id = user.user_id) |
391 | 391 | WHERE |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $sqlConditions |
397 | 397 | ORDER BY firstname"; |
398 | 398 | } else { |
399 | - $sql = "SELECT user_id, username, lastname, firstname |
|
399 | + $sql = "SELECT user_id, username, lastname, firstname |
|
400 | 400 | FROM $tbl_user user |
401 | 401 | WHERE |
402 | 402 | $without_assigned_users |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | <input type="hidden" name="formSent" value="1" /> |
413 | 413 | <?php |
414 | 414 | if(!empty($msg)) { |
415 | - Display::display_normal_message($msg); //main API |
|
415 | + Display::display_normal_message($msg); //main API |
|
416 | 416 | } |
417 | 417 | ?> |
418 | 418 | |
@@ -465,26 +465,26 @@ discard block |
||
465 | 465 | </button> |
466 | 466 | </div> |
467 | 467 | <?php |
468 | - } |
|
469 | - ?> |
|
468 | + } |
|
469 | + ?> |
|
470 | 470 | <div class="separate-action"> |
471 | 471 | <?php |
472 | - echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
472 | + echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
473 | 473 | ?> |
474 | 474 | </div> |
475 | 475 | </div> |
476 | 476 | </div> |
477 | 477 | <div class="col-md-4"> |
478 | 478 | <?php |
479 | - if (UserManager::is_admin($user_id)) { |
|
480 | - echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
479 | + if (UserManager::is_admin($user_id)) { |
|
480 | + echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
481 | 481 | } else if ($user_info['status'] == SESSIONADMIN) { |
482 | 482 | echo get_lang('AssignedUsersListToSessionsAdministrator'); |
483 | 483 | } else if ($user_info['status'] == STUDENT_BOSS) { |
484 | 484 | echo get_lang('AssignedUsersListToStudentBoss'); |
485 | 485 | } else { |
486 | 486 | echo get_lang('AssignedUsersListToHumanResourcesManager'); |
487 | - } |
|
487 | + } |
|
488 | 488 | ?> |
489 | 489 | <div class="form-group"> |
490 | 490 | <div class="col-sm-12"> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name" => get_lang('SessionOverview')); |
61 | 61 | |
62 | 62 | if (isset($_POST['formSent']) && $_POST['formSent']) { |
63 | - $formSent = 1; |
|
63 | + $formSent = 1; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $order_clause = 'ORDER BY '; |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | WHERE status='1'".$order_clause; |
72 | 72 | |
73 | 73 | if (api_is_multiple_url_enabled()) { |
74 | - $table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
75 | - $access_url_id = api_get_current_access_url_id(); |
|
76 | - if ($access_url_id != -1) { |
|
77 | - $sql = "SELECT DISTINCT u.user_id,lastname,firstname,username |
|
74 | + $table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
75 | + $access_url_id = api_get_current_access_url_id(); |
|
76 | + if ($access_url_id != -1) { |
|
77 | + $sql = "SELECT DISTINCT u.user_id,lastname,firstname,username |
|
78 | 78 | FROM $tbl_user u |
79 | 79 | INNER JOIN $table_access_url_rel_user url_rel_user |
80 | 80 | ON (url_rel_user.user_id = u.user_id) |
81 | 81 | WHERE status='1' AND access_url_id = '$access_url_id' $order_clause"; |
82 | - } |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $result = Database::query($sql); |
@@ -15,36 +15,36 @@ discard block |
||
15 | 15 | class BlockSession extends Block |
16 | 16 | { |
17 | 17 | private $user_id; |
18 | - private $sessions; |
|
19 | - private $path; |
|
20 | - private $permission = array(DRH, SESSIONADMIN); |
|
18 | + private $sessions; |
|
19 | + private $path; |
|
20 | + private $permission = array(DRH, SESSIONADMIN); |
|
21 | 21 | |
22 | - /** |
|
23 | - * Constructor |
|
24 | - */ |
|
22 | + /** |
|
23 | + * Constructor |
|
24 | + */ |
|
25 | 25 | public function __construct ($user_id) |
26 | 26 | { |
27 | - $this->user_id = $user_id; |
|
28 | - $this->path = 'block_session'; |
|
29 | - if ($this->is_block_visible_for_user($user_id)) { |
|
27 | + $this->user_id = $user_id; |
|
28 | + $this->path = 'block_session'; |
|
29 | + if ($this->is_block_visible_for_user($user_id)) { |
|
30 | 30 | $this->sessions = SessionManager::get_sessions_followed_by_drh($user_id); |
31 | - } |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | |
34 | - /** |
|
35 | - * This method check if a user is allowed to see the block inside dashboard interface |
|
36 | - * @param int User id |
|
37 | - * @return bool Is block visible for user |
|
38 | - */ |
|
34 | + /** |
|
35 | + * This method check if a user is allowed to see the block inside dashboard interface |
|
36 | + * @param int User id |
|
37 | + * @return bool Is block visible for user |
|
38 | + */ |
|
39 | 39 | public function is_block_visible_for_user($user_id) |
40 | 40 | { |
41 | - $user_info = api_get_user_info($user_id); |
|
42 | - $user_status = $user_info['status']; |
|
43 | - $is_block_visible_for_user = false; |
|
44 | - if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
45 | - $is_block_visible_for_user = true; |
|
46 | - } |
|
47 | - return $is_block_visible_for_user; |
|
41 | + $user_info = api_get_user_info($user_id); |
|
42 | + $user_status = $user_info['status']; |
|
43 | + $is_block_visible_for_user = false; |
|
44 | + if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
45 | + $is_block_visible_for_user = true; |
|
46 | + } |
|
47 | + return $is_block_visible_for_user; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | public function get_block() |
56 | 56 | { |
57 | 57 | |
58 | - global $charset; |
|
58 | + global $charset; |
|
59 | 59 | |
60 | - $column = 2; |
|
61 | - $data = array(); |
|
60 | + $column = 2; |
|
61 | + $data = array(); |
|
62 | 62 | |
63 | - $content = $this->get_content_html(); |
|
63 | + $content = $this->get_content_html(); |
|
64 | 64 | |
65 | - $content_html = ' |
|
65 | + $content_html = ' |
|
66 | 66 | <div class="panel panel-default" id="intro"> |
67 | 67 | <div class="panel-heading"> |
68 | 68 | '.get_lang('SessionsInformation').' |
@@ -76,40 +76,40 @@ discard block |
||
76 | 76 | </div> |
77 | 77 | '; |
78 | 78 | |
79 | - $data['column'] = $column; |
|
80 | - $data['content_html'] = $content_html; |
|
79 | + $data['column'] = $column; |
|
80 | + $data['content_html'] = $content_html; |
|
81 | 81 | |
82 | - return $data; |
|
82 | + return $data; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * This method return a content html, it's used inside get_block method for showing it inside dashboard interface |
|
87 | - * @return string content html |
|
88 | - */ |
|
86 | + * This method return a content html, it's used inside get_block method for showing it inside dashboard interface |
|
87 | + * @return string content html |
|
88 | + */ |
|
89 | 89 | public function get_content_html() |
90 | 90 | { |
91 | 91 | |
92 | - $content = ''; |
|
93 | - $sessions = $this->sessions; |
|
92 | + $content = ''; |
|
93 | + $sessions = $this->sessions; |
|
94 | 94 | |
95 | - //$content = '<div style="margin:10px;">'; |
|
96 | - $content .= '<h4>'.get_lang('YourSessionsList').'</h4>'; |
|
95 | + //$content = '<div style="margin:10px;">'; |
|
96 | + $content .= '<h4>'.get_lang('YourSessionsList').'</h4>'; |
|
97 | 97 | |
98 | - if (count($sessions) > 0) { |
|
99 | - $sessions_table = '<table class="data_table" width:"95%">'; |
|
100 | - $sessions_table .= '<tr> |
|
98 | + if (count($sessions) > 0) { |
|
99 | + $sessions_table = '<table class="data_table" width:"95%">'; |
|
100 | + $sessions_table .= '<tr> |
|
101 | 101 | <th >'.get_lang('Title').'</th> |
102 | 102 | <th >'.get_lang('Date').'</th> |
103 | 103 | <th width="100px">'.get_lang('NbCoursesPerSession').'</th> |
104 | 104 | </tr>'; |
105 | - $i = 1; |
|
106 | - foreach ($sessions as $session) { |
|
105 | + $i = 1; |
|
106 | + foreach ($sessions as $session) { |
|
107 | 107 | |
108 | - $session_id = intval($session['id']); |
|
109 | - $title = $session['name']; |
|
108 | + $session_id = intval($session['id']); |
|
109 | + $title = $session['name']; |
|
110 | 110 | |
111 | - if (!empty($session['access_start_date'])) { |
|
112 | - $dateFrom = api_convert_and_format_date( |
|
111 | + if (!empty($session['access_start_date'])) { |
|
112 | + $dateFrom = api_convert_and_format_date( |
|
113 | 113 | $session['access_start_date'], |
114 | 114 | DATE_FORMAT_SHORT, |
115 | 115 | date_default_timezone_get() |
@@ -121,44 +121,44 @@ discard block |
||
121 | 121 | ); |
122 | 122 | |
123 | 123 | $date = vsprintf(get_lang('FromDateXToDateY'), [$dateFrom, $dateUntil]); |
124 | - } else { |
|
125 | - $date = ' - '; |
|
126 | - } |
|
124 | + } else { |
|
125 | + $date = ' - '; |
|
126 | + } |
|
127 | 127 | |
128 | - $count_courses_in_session = count(Tracking::get_courses_list_from_session($session_id)); |
|
128 | + $count_courses_in_session = count(Tracking::get_courses_list_from_session($session_id)); |
|
129 | 129 | |
130 | - if ($i%2 == 0) $class_tr = 'row_odd'; |
|
131 | - else $class_tr = 'row_even'; |
|
130 | + if ($i%2 == 0) $class_tr = 'row_odd'; |
|
131 | + else $class_tr = 'row_even'; |
|
132 | 132 | |
133 | - $sessions_table .= '<tr class="'.$class_tr.'"> |
|
133 | + $sessions_table .= '<tr class="'.$class_tr.'"> |
|
134 | 134 | <td>'.$title.'</td> |
135 | 135 | <td align="center">'.$date.'</td> |
136 | 136 | <td align="center">'.$count_courses_in_session.'</td> |
137 | 137 | </tr>'; |
138 | - $i++; |
|
139 | - } |
|
140 | - $sessions_table .= '</table>'; |
|
141 | - $content .= $sessions_table; |
|
142 | - } else { |
|
143 | - $content .= get_lang('ThereIsNoInformationAboutYourSessions'); |
|
144 | - } |
|
138 | + $i++; |
|
139 | + } |
|
140 | + $sessions_table .= '</table>'; |
|
141 | + $content .= $sessions_table; |
|
142 | + } else { |
|
143 | + $content .= get_lang('ThereIsNoInformationAboutYourSessions'); |
|
144 | + } |
|
145 | 145 | |
146 | - if (count($sessions) > 0) { |
|
147 | - $content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/session.php">'.get_lang('SeeMore').'</a></div>'; |
|
148 | - } |
|
146 | + if (count($sessions) > 0) { |
|
147 | + $content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/session.php">'.get_lang('SeeMore').'</a></div>'; |
|
148 | + } |
|
149 | 149 | |
150 | - //$content .= '</div>'; |
|
150 | + //$content .= '</div>'; |
|
151 | 151 | |
152 | - return $content; |
|
153 | - } |
|
152 | + return $content; |
|
153 | + } |
|
154 | 154 | |
155 | 155 | /** |
156 | - * Get number of sessions |
|
157 | - * @return int |
|
158 | - */ |
|
159 | - function get_number_of_sessions() |
|
156 | + * Get number of sessions |
|
157 | + * @return int |
|
158 | + */ |
|
159 | + function get_number_of_sessions() |
|
160 | 160 | { |
161 | - return count($this->sessions); |
|
162 | - } |
|
161 | + return count($this->sessions); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class wsdl extends nusoap_base |
13 | 13 | { |
14 | - // URL or filename of the root of this WSDL |
|
14 | + // URL or filename of the root of this WSDL |
|
15 | 15 | var $wsdl; |
16 | 16 | // define internal arrays of bindings, ports, operations, messages, etc. |
17 | 17 | var $schemas = array(); |
@@ -38,142 +38,142 @@ discard block |
||
38 | 38 | var $position = 0; |
39 | 39 | var $depth = 0; |
40 | 40 | var $depth_array = array(); |
41 | - // for getting wsdl |
|
42 | - var $proxyhost = ''; |
|
41 | + // for getting wsdl |
|
42 | + var $proxyhost = ''; |
|
43 | 43 | var $proxyport = ''; |
44 | - var $proxyusername = ''; |
|
45 | - var $proxypassword = ''; |
|
46 | - var $timeout = 0; |
|
47 | - var $response_timeout = 30; |
|
48 | - var $curl_options = array(); // User-specified cURL options |
|
49 | - var $use_curl = false; // whether to always try to use cURL |
|
50 | - // for HTTP authentication |
|
51 | - var $username = ''; // Username for HTTP authentication |
|
52 | - var $password = ''; // Password for HTTP authentication |
|
53 | - var $authtype = ''; // Type of HTTP authentication |
|
54 | - var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
44 | + var $proxyusername = ''; |
|
45 | + var $proxypassword = ''; |
|
46 | + var $timeout = 0; |
|
47 | + var $response_timeout = 30; |
|
48 | + var $curl_options = array(); // User-specified cURL options |
|
49 | + var $use_curl = false; // whether to always try to use cURL |
|
50 | + // for HTTP authentication |
|
51 | + var $username = ''; // Username for HTTP authentication |
|
52 | + var $password = ''; // Password for HTTP authentication |
|
53 | + var $authtype = ''; // Type of HTTP authentication |
|
54 | + var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * constructor |
58 | 58 | * |
59 | 59 | * @param string $wsdl WSDL document URL |
60 | - * @param string $proxyhost |
|
61 | - * @param string $proxyport |
|
62 | - * @param string $proxyusername |
|
63 | - * @param string $proxypassword |
|
64 | - * @param integer $timeout set the connection timeout |
|
65 | - * @param integer $response_timeout set the response timeout |
|
66 | - * @param array $curl_options user-specified cURL options |
|
67 | - * @param boolean $use_curl try to use cURL |
|
60 | + * @param string $proxyhost |
|
61 | + * @param string $proxyport |
|
62 | + * @param string $proxyusername |
|
63 | + * @param string $proxypassword |
|
64 | + * @param integer $timeout set the connection timeout |
|
65 | + * @param integer $response_timeout set the response timeout |
|
66 | + * @param array $curl_options user-specified cURL options |
|
67 | + * @param boolean $use_curl try to use cURL |
|
68 | 68 | * @access public |
69 | 69 | */ |
70 | 70 | function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ |
71 | - parent::__construct(); |
|
72 | - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
|
71 | + parent::__construct(); |
|
72 | + $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
|
73 | 73 | $this->proxyhost = $proxyhost; |
74 | 74 | $this->proxyport = $proxyport; |
75 | - $this->proxyusername = $proxyusername; |
|
76 | - $this->proxypassword = $proxypassword; |
|
77 | - $this->timeout = $timeout; |
|
78 | - $this->response_timeout = $response_timeout; |
|
79 | - if (is_array($curl_options)) |
|
80 | - $this->curl_options = $curl_options; |
|
81 | - $this->use_curl = $use_curl; |
|
82 | - $this->fetchWSDL($wsdl); |
|
75 | + $this->proxyusername = $proxyusername; |
|
76 | + $this->proxypassword = $proxypassword; |
|
77 | + $this->timeout = $timeout; |
|
78 | + $this->response_timeout = $response_timeout; |
|
79 | + if (is_array($curl_options)) |
|
80 | + $this->curl_options = $curl_options; |
|
81 | + $this->use_curl = $use_curl; |
|
82 | + $this->fetchWSDL($wsdl); |
|
83 | 83 | } |
84 | 84 | |
85 | - /** |
|
86 | - * fetches the WSDL document and parses it |
|
87 | - * |
|
88 | - * @access public |
|
89 | - */ |
|
90 | - function fetchWSDL($wsdl) { |
|
91 | - $this->debug("parse and process WSDL path=$wsdl"); |
|
92 | - $this->wsdl = $wsdl; |
|
85 | + /** |
|
86 | + * fetches the WSDL document and parses it |
|
87 | + * |
|
88 | + * @access public |
|
89 | + */ |
|
90 | + function fetchWSDL($wsdl) { |
|
91 | + $this->debug("parse and process WSDL path=$wsdl"); |
|
92 | + $this->wsdl = $wsdl; |
|
93 | 93 | // parse wsdl file |
94 | 94 | if ($this->wsdl != "") { |
95 | 95 | $this->parseWSDL($this->wsdl); |
96 | 96 | } |
97 | 97 | // imports |
98 | 98 | // TODO: handle imports more properly, grabbing them in-line and nesting them |
99 | - $imported_urls = array(); |
|
100 | - $imported = 1; |
|
101 | - while ($imported > 0) { |
|
102 | - $imported = 0; |
|
103 | - // Schema imports |
|
104 | - foreach ($this->schemas as $ns => $list) { |
|
105 | - foreach ($list as $xs) { |
|
106 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
107 | - foreach ($xs->imports as $ns2 => $list2) { |
|
108 | - for ($ii = 0; $ii < count($list2); $ii++) { |
|
109 | - if (! $list2[$ii]['loaded']) { |
|
110 | - $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; |
|
111 | - $url = $list2[$ii]['location']; |
|
112 | - if ($url != '') { |
|
113 | - $urlparts = parse_url($url); |
|
114 | - if (!isset($urlparts['host'])) { |
|
115 | - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . |
|
116 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
117 | - } |
|
118 | - if (! in_array($url, $imported_urls)) { |
|
119 | - $this->parseWSDL($url); |
|
120 | - $imported++; |
|
121 | - $imported_urls[] = $url; |
|
122 | - } |
|
123 | - } else { |
|
124 | - $this->debug("Unexpected scenario: empty URL for unloaded import"); |
|
125 | - } |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - } |
|
130 | - } |
|
131 | - // WSDL imports |
|
132 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
99 | + $imported_urls = array(); |
|
100 | + $imported = 1; |
|
101 | + while ($imported > 0) { |
|
102 | + $imported = 0; |
|
103 | + // Schema imports |
|
104 | + foreach ($this->schemas as $ns => $list) { |
|
105 | + foreach ($list as $xs) { |
|
106 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
107 | + foreach ($xs->imports as $ns2 => $list2) { |
|
108 | + for ($ii = 0; $ii < count($list2); $ii++) { |
|
109 | + if (! $list2[$ii]['loaded']) { |
|
110 | + $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; |
|
111 | + $url = $list2[$ii]['location']; |
|
112 | + if ($url != '') { |
|
113 | + $urlparts = parse_url($url); |
|
114 | + if (!isset($urlparts['host'])) { |
|
115 | + $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . |
|
116 | + substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
117 | + } |
|
118 | + if (! in_array($url, $imported_urls)) { |
|
119 | + $this->parseWSDL($url); |
|
120 | + $imported++; |
|
121 | + $imported_urls[] = $url; |
|
122 | + } |
|
123 | + } else { |
|
124 | + $this->debug("Unexpected scenario: empty URL for unloaded import"); |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + } |
|
130 | + } |
|
131 | + // WSDL imports |
|
132 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
133 | 133 | foreach ($this->import as $ns => $list) { |
134 | 134 | for ($ii = 0; $ii < count($list); $ii++) { |
135 | - if (! $list[$ii]['loaded']) { |
|
136 | - $this->import[$ns][$ii]['loaded'] = true; |
|
137 | - $url = $list[$ii]['location']; |
|
138 | - if ($url != '') { |
|
139 | - $urlparts = parse_url($url); |
|
140 | - if (!isset($urlparts['host'])) { |
|
141 | - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . |
|
142 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
143 | - } |
|
144 | - if (! in_array($url, $imported_urls)) { |
|
145 | - $this->parseWSDL($url); |
|
146 | - $imported++; |
|
147 | - $imported_urls[] = $url; |
|
148 | - } |
|
149 | - } else { |
|
150 | - $this->debug("Unexpected scenario: empty URL for unloaded import"); |
|
151 | - } |
|
152 | - } |
|
153 | - } |
|
135 | + if (! $list[$ii]['loaded']) { |
|
136 | + $this->import[$ns][$ii]['loaded'] = true; |
|
137 | + $url = $list[$ii]['location']; |
|
138 | + if ($url != '') { |
|
139 | + $urlparts = parse_url($url); |
|
140 | + if (!isset($urlparts['host'])) { |
|
141 | + $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . |
|
142 | + substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
143 | + } |
|
144 | + if (! in_array($url, $imported_urls)) { |
|
145 | + $this->parseWSDL($url); |
|
146 | + $imported++; |
|
147 | + $imported_urls[] = $url; |
|
148 | + } |
|
149 | + } else { |
|
150 | + $this->debug("Unexpected scenario: empty URL for unloaded import"); |
|
151 | + } |
|
152 | + } |
|
153 | + } |
|
154 | 154 | } |
155 | - } |
|
155 | + } |
|
156 | 156 | // add new data to operation data |
157 | 157 | foreach($this->bindings as $binding => $bindingData) { |
158 | 158 | if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { |
159 | 159 | foreach($bindingData['operations'] as $operation => $data) { |
160 | 160 | $this->debug('post-parse data gathering for ' . $operation); |
161 | 161 | $this->bindings[$binding]['operations'][$operation]['input'] = |
162 | - isset($this->bindings[$binding]['operations'][$operation]['input']) ? |
|
163 | - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : |
|
164 | - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; |
|
162 | + isset($this->bindings[$binding]['operations'][$operation]['input']) ? |
|
163 | + array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : |
|
164 | + $this->portTypes[ $bindingData['portType'] ][$operation]['input']; |
|
165 | 165 | $this->bindings[$binding]['operations'][$operation]['output'] = |
166 | - isset($this->bindings[$binding]['operations'][$operation]['output']) ? |
|
167 | - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : |
|
168 | - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; |
|
166 | + isset($this->bindings[$binding]['operations'][$operation]['output']) ? |
|
167 | + array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : |
|
168 | + $this->portTypes[ $bindingData['portType'] ][$operation]['output']; |
|
169 | 169 | if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ |
170 | - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; |
|
171 | - } |
|
172 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ |
|
173 | - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; |
|
170 | + $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; |
|
171 | + } |
|
172 | + if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ |
|
173 | + $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; |
|
174 | 174 | } |
175 | 175 | // Set operation style if necessary, but do not override one already provided |
176 | - if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { |
|
176 | + if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { |
|
177 | 177 | $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; |
178 | 178 | } |
179 | 179 | $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | } |
184 | 184 | } |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * parses the wsdl document |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @access private |
192 | 192 | */ |
193 | 193 | function parseWSDL($wsdl = '') { |
194 | - $this->debug("parse WSDL at path=$wsdl"); |
|
194 | + $this->debug("parse WSDL at path=$wsdl"); |
|
195 | 195 | |
196 | 196 | if ($wsdl == '') { |
197 | 197 | $this->debug('no wsdl passed to parseWSDL()!!'); |
@@ -204,38 +204,38 @@ discard block |
||
204 | 204 | |
205 | 205 | if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { |
206 | 206 | $this->debug('getting WSDL http(s) URL ' . $wsdl); |
207 | - // get wsdl |
|
208 | - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); |
|
209 | - $tr->request_method = 'GET'; |
|
210 | - $tr->useSOAPAction = false; |
|
211 | - if($this->proxyhost && $this->proxyport){ |
|
212 | - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); |
|
213 | - } |
|
214 | - if ($this->authtype != '') { |
|
215 | - $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); |
|
216 | - } |
|
217 | - $tr->setEncoding('gzip, deflate'); |
|
218 | - $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); |
|
219 | - //$this->debug("WSDL request\n" . $tr->outgoing_payload); |
|
220 | - //$this->debug("WSDL response\n" . $tr->incoming_payload); |
|
221 | - $this->appendDebug($tr->getDebug()); |
|
222 | - // catch errors |
|
223 | - if($err = $tr->getError() ){ |
|
224 | - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; |
|
225 | - $this->debug($errstr); |
|
226 | - $this->setError($errstr); |
|
227 | - unset($tr); |
|
228 | - return false; |
|
229 | - } |
|
230 | - unset($tr); |
|
231 | - $this->debug("got WSDL URL"); |
|
207 | + // get wsdl |
|
208 | + $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); |
|
209 | + $tr->request_method = 'GET'; |
|
210 | + $tr->useSOAPAction = false; |
|
211 | + if($this->proxyhost && $this->proxyport){ |
|
212 | + $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); |
|
213 | + } |
|
214 | + if ($this->authtype != '') { |
|
215 | + $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); |
|
216 | + } |
|
217 | + $tr->setEncoding('gzip, deflate'); |
|
218 | + $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); |
|
219 | + //$this->debug("WSDL request\n" . $tr->outgoing_payload); |
|
220 | + //$this->debug("WSDL response\n" . $tr->incoming_payload); |
|
221 | + $this->appendDebug($tr->getDebug()); |
|
222 | + // catch errors |
|
223 | + if($err = $tr->getError() ){ |
|
224 | + $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; |
|
225 | + $this->debug($errstr); |
|
226 | + $this->setError($errstr); |
|
227 | + unset($tr); |
|
228 | + return false; |
|
229 | + } |
|
230 | + unset($tr); |
|
231 | + $this->debug("got WSDL URL"); |
|
232 | 232 | } else { |
233 | 233 | // $wsdl is not http(s), so treat it as a file URL or plain file path |
234 | - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { |
|
235 | - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; |
|
236 | - } else { |
|
237 | - $path = $wsdl; |
|
238 | - } |
|
234 | + if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { |
|
235 | + $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; |
|
236 | + } else { |
|
237 | + $path = $wsdl; |
|
238 | + } |
|
239 | 239 | $this->debug('getting WSDL file ' . $path); |
240 | 240 | if ($fp = @fopen($path, 'r')) { |
241 | 241 | $wsdl_string = ''; |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | } |
245 | 245 | fclose($fp); |
246 | 246 | } else { |
247 | - $errstr = "Bad path to WSDL file $path"; |
|
248 | - $this->debug($errstr); |
|
247 | + $errstr = "Bad path to WSDL file $path"; |
|
248 | + $this->debug($errstr); |
|
249 | 249 | $this->setError($errstr); |
250 | 250 | return false; |
251 | 251 | } |
@@ -266,23 +266,23 @@ discard block |
||
266 | 266 | if (!xml_parse($this->parser, $wsdl_string, true)) { |
267 | 267 | // Display an error message. |
268 | 268 | $errstr = sprintf( |
269 | - 'XML error parsing WSDL from %s on line %d: %s', |
|
270 | - $wsdl, |
|
269 | + 'XML error parsing WSDL from %s on line %d: %s', |
|
270 | + $wsdl, |
|
271 | 271 | xml_get_current_line_number($this->parser), |
272 | 272 | xml_error_string(xml_get_error_code($this->parser)) |
273 | 273 | ); |
274 | 274 | $this->debug($errstr); |
275 | - $this->debug("XML payload:\n" . $wsdl_string); |
|
275 | + $this->debug("XML payload:\n" . $wsdl_string); |
|
276 | 276 | $this->setError($errstr); |
277 | 277 | return false; |
278 | 278 | } |
279 | - // free the parser |
|
279 | + // free the parser |
|
280 | 280 | xml_parser_free($this->parser); |
281 | 281 | $this->debug('Parsing WSDL done'); |
282 | - // catch wsdl parse errors |
|
283 | - if($this->getError()){ |
|
284 | - return false; |
|
285 | - } |
|
282 | + // catch wsdl parse errors |
|
283 | + if($this->getError()){ |
|
284 | + return false; |
|
285 | + } |
|
286 | 286 | return true; |
287 | 287 | } |
288 | 288 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $this->appendDebug($this->currentSchema->getDebug()); |
302 | 302 | $this->currentSchema->clearDebug(); |
303 | 303 | } elseif (preg_match('/schema$/', $name)) { |
304 | - $this->debug('Parsing WSDL schema'); |
|
304 | + $this->debug('Parsing WSDL schema'); |
|
305 | 305 | // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")"); |
306 | 306 | $this->status = 'schema'; |
307 | 307 | $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $this->message[$pos] = array('cdata' => ''); |
318 | 318 | // process attributes |
319 | 319 | if (count($attrs) > 0) { |
320 | - // register namespace declarations |
|
320 | + // register namespace declarations |
|
321 | 321 | foreach($attrs as $k => $v) { |
322 | 322 | if (preg_match('/^xmlns/',$k)) { |
323 | 323 | if ($ns_prefix = substr(strrchr($k, ':'), 1)) { |
@@ -352,417 +352,417 @@ discard block |
||
352 | 352 | // get unqualified name |
353 | 353 | $name = substr(strstr($name, ':'), 1); |
354 | 354 | } |
355 | - // process attributes, expanding any prefixes to namespaces |
|
355 | + // process attributes, expanding any prefixes to namespaces |
|
356 | 356 | // find status, register data |
357 | 357 | switch ($this->status) { |
358 | 358 | case 'message': |
359 | 359 | if ($name == 'part') { |
360 | - if (isset($attrs['type'])) { |
|
361 | - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); |
|
362 | - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; |
|
363 | - } |
|
364 | - if (isset($attrs['element'])) { |
|
365 | - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); |
|
366 | - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; |
|
367 | - } |
|
368 | - } |
|
369 | - break; |
|
370 | - case 'portType': |
|
371 | - switch ($name) { |
|
372 | - case 'operation': |
|
373 | - $this->currentPortOperation = $attrs['name']; |
|
374 | - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); |
|
375 | - if (isset($attrs['parameterOrder'])) { |
|
376 | - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; |
|
377 | - } |
|
378 | - break; |
|
379 | - case 'documentation': |
|
380 | - $this->documentation = true; |
|
381 | - break; |
|
382 | - // merge input/output data |
|
383 | - default: |
|
384 | - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; |
|
385 | - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; |
|
386 | - break; |
|
387 | - } |
|
388 | - break; |
|
389 | - case 'binding': |
|
390 | - switch ($name) { |
|
391 | - case 'binding': |
|
392 | - // get ns prefix |
|
393 | - if (isset($attrs['style'])) { |
|
394 | - $this->bindings[$this->currentBinding]['prefix'] = $prefix; |
|
395 | - } |
|
396 | - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); |
|
397 | - break; |
|
398 | - case 'header': |
|
399 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; |
|
400 | - break; |
|
401 | - case 'operation': |
|
402 | - if (isset($attrs['soapAction'])) { |
|
403 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; |
|
404 | - } |
|
405 | - if (isset($attrs['style'])) { |
|
406 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; |
|
407 | - } |
|
408 | - if (isset($attrs['name'])) { |
|
409 | - $this->currentOperation = $attrs['name']; |
|
410 | - $this->debug("current binding operation: $this->currentOperation"); |
|
411 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; |
|
412 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; |
|
413 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; |
|
414 | - } |
|
415 | - break; |
|
416 | - case 'input': |
|
417 | - $this->opStatus = 'input'; |
|
418 | - break; |
|
419 | - case 'output': |
|
420 | - $this->opStatus = 'output'; |
|
421 | - break; |
|
422 | - case 'body': |
|
423 | - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { |
|
424 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); |
|
425 | - } else { |
|
426 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; |
|
427 | - } |
|
428 | - break; |
|
429 | - } |
|
430 | - break; |
|
431 | - case 'service': |
|
432 | - switch ($name) { |
|
433 | - case 'port': |
|
434 | - $this->currentPort = $attrs['name']; |
|
435 | - $this->debug('current port: ' . $this->currentPort); |
|
436 | - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); |
|
360 | + if (isset($attrs['type'])) { |
|
361 | + $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); |
|
362 | + $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; |
|
363 | + } |
|
364 | + if (isset($attrs['element'])) { |
|
365 | + $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); |
|
366 | + $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; |
|
367 | + } |
|
368 | + } |
|
369 | + break; |
|
370 | + case 'portType': |
|
371 | + switch ($name) { |
|
372 | + case 'operation': |
|
373 | + $this->currentPortOperation = $attrs['name']; |
|
374 | + $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); |
|
375 | + if (isset($attrs['parameterOrder'])) { |
|
376 | + $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; |
|
377 | + } |
|
378 | + break; |
|
379 | + case 'documentation': |
|
380 | + $this->documentation = true; |
|
381 | + break; |
|
382 | + // merge input/output data |
|
383 | + default: |
|
384 | + $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; |
|
385 | + $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; |
|
386 | + break; |
|
387 | + } |
|
388 | + break; |
|
389 | + case 'binding': |
|
390 | + switch ($name) { |
|
391 | + case 'binding': |
|
392 | + // get ns prefix |
|
393 | + if (isset($attrs['style'])) { |
|
394 | + $this->bindings[$this->currentBinding]['prefix'] = $prefix; |
|
395 | + } |
|
396 | + $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); |
|
397 | + break; |
|
398 | + case 'header': |
|
399 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; |
|
400 | + break; |
|
401 | + case 'operation': |
|
402 | + if (isset($attrs['soapAction'])) { |
|
403 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; |
|
404 | + } |
|
405 | + if (isset($attrs['style'])) { |
|
406 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; |
|
407 | + } |
|
408 | + if (isset($attrs['name'])) { |
|
409 | + $this->currentOperation = $attrs['name']; |
|
410 | + $this->debug("current binding operation: $this->currentOperation"); |
|
411 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; |
|
412 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; |
|
413 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; |
|
414 | + } |
|
415 | + break; |
|
416 | + case 'input': |
|
417 | + $this->opStatus = 'input'; |
|
418 | + break; |
|
419 | + case 'output': |
|
420 | + $this->opStatus = 'output'; |
|
421 | + break; |
|
422 | + case 'body': |
|
423 | + if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { |
|
424 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); |
|
425 | + } else { |
|
426 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; |
|
427 | + } |
|
428 | + break; |
|
429 | + } |
|
430 | + break; |
|
431 | + case 'service': |
|
432 | + switch ($name) { |
|
433 | + case 'port': |
|
434 | + $this->currentPort = $attrs['name']; |
|
435 | + $this->debug('current port: ' . $this->currentPort); |
|
436 | + $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); |
|
437 | 437 | |
438 | - break; |
|
439 | - case 'address': |
|
440 | - $this->ports[$this->currentPort]['location'] = $attrs['location']; |
|
441 | - $this->ports[$this->currentPort]['bindingType'] = $namespace; |
|
442 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; |
|
443 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; |
|
444 | - break; |
|
445 | - } |
|
446 | - break; |
|
447 | - } |
|
448 | - // set status |
|
449 | - switch ($name) { |
|
450 | - case 'import': |
|
451 | - if (isset($attrs['location'])) { |
|
438 | + break; |
|
439 | + case 'address': |
|
440 | + $this->ports[$this->currentPort]['location'] = $attrs['location']; |
|
441 | + $this->ports[$this->currentPort]['bindingType'] = $namespace; |
|
442 | + $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; |
|
443 | + $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; |
|
444 | + break; |
|
445 | + } |
|
446 | + break; |
|
447 | + } |
|
448 | + // set status |
|
449 | + switch ($name) { |
|
450 | + case 'import': |
|
451 | + if (isset($attrs['location'])) { |
|
452 | 452 | $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); |
453 | 453 | $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); |
454 | - } else { |
|
454 | + } else { |
|
455 | 455 | $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); |
456 | - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { |
|
457 | - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; |
|
458 | - } |
|
456 | + if (! $this->getPrefixFromNamespace($attrs['namespace'])) { |
|
457 | + $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; |
|
458 | + } |
|
459 | 459 | $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); |
460 | - } |
|
461 | - break; |
|
462 | - //wait for schema |
|
463 | - //case 'types': |
|
464 | - // $this->status = 'schema'; |
|
465 | - // break; |
|
466 | - case 'message': |
|
467 | - $this->status = 'message'; |
|
468 | - $this->messages[$attrs['name']] = array(); |
|
469 | - $this->currentMessage = $attrs['name']; |
|
470 | - break; |
|
471 | - case 'portType': |
|
472 | - $this->status = 'portType'; |
|
473 | - $this->portTypes[$attrs['name']] = array(); |
|
474 | - $this->currentPortType = $attrs['name']; |
|
475 | - break; |
|
476 | - case "binding": |
|
477 | - if (isset($attrs['name'])) { |
|
478 | - // get binding name |
|
479 | - if (strpos($attrs['name'], ':')) { |
|
480 | - $this->currentBinding = $this->getLocalPart($attrs['name']); |
|
481 | - } else { |
|
482 | - $this->currentBinding = $attrs['name']; |
|
483 | - } |
|
484 | - $this->status = 'binding'; |
|
485 | - $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); |
|
486 | - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); |
|
487 | - } |
|
488 | - break; |
|
489 | - case 'service': |
|
490 | - $this->serviceName = $attrs['name']; |
|
491 | - $this->status = 'service'; |
|
492 | - $this->debug('current service: ' . $this->serviceName); |
|
493 | - break; |
|
494 | - case 'definitions': |
|
495 | - foreach ($attrs as $name => $value) { |
|
496 | - $this->wsdl_info[$name] = $value; |
|
497 | - } |
|
498 | - break; |
|
499 | - } |
|
500 | - } |
|
501 | - } |
|
460 | + } |
|
461 | + break; |
|
462 | + //wait for schema |
|
463 | + //case 'types': |
|
464 | + // $this->status = 'schema'; |
|
465 | + // break; |
|
466 | + case 'message': |
|
467 | + $this->status = 'message'; |
|
468 | + $this->messages[$attrs['name']] = array(); |
|
469 | + $this->currentMessage = $attrs['name']; |
|
470 | + break; |
|
471 | + case 'portType': |
|
472 | + $this->status = 'portType'; |
|
473 | + $this->portTypes[$attrs['name']] = array(); |
|
474 | + $this->currentPortType = $attrs['name']; |
|
475 | + break; |
|
476 | + case "binding": |
|
477 | + if (isset($attrs['name'])) { |
|
478 | + // get binding name |
|
479 | + if (strpos($attrs['name'], ':')) { |
|
480 | + $this->currentBinding = $this->getLocalPart($attrs['name']); |
|
481 | + } else { |
|
482 | + $this->currentBinding = $attrs['name']; |
|
483 | + } |
|
484 | + $this->status = 'binding'; |
|
485 | + $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); |
|
486 | + $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); |
|
487 | + } |
|
488 | + break; |
|
489 | + case 'service': |
|
490 | + $this->serviceName = $attrs['name']; |
|
491 | + $this->status = 'service'; |
|
492 | + $this->debug('current service: ' . $this->serviceName); |
|
493 | + break; |
|
494 | + case 'definitions': |
|
495 | + foreach ($attrs as $name => $value) { |
|
496 | + $this->wsdl_info[$name] = $value; |
|
497 | + } |
|
498 | + break; |
|
499 | + } |
|
500 | + } |
|
501 | + } |
|
502 | 502 | |
503 | - /** |
|
504 | - * end-element handler |
|
505 | - * |
|
506 | - * @param string $parser XML parser object |
|
507 | - * @param string $name element name |
|
508 | - * @access private |
|
509 | - */ |
|
510 | - function end_element($parser, $name){ |
|
511 | - // unset schema status |
|
512 | - if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { |
|
513 | - $this->status = ""; |
|
503 | + /** |
|
504 | + * end-element handler |
|
505 | + * |
|
506 | + * @param string $parser XML parser object |
|
507 | + * @param string $name element name |
|
508 | + * @access private |
|
509 | + */ |
|
510 | + function end_element($parser, $name){ |
|
511 | + // unset schema status |
|
512 | + if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { |
|
513 | + $this->status = ""; |
|
514 | 514 | $this->appendDebug($this->currentSchema->getDebug()); |
515 | 515 | $this->currentSchema->clearDebug(); |
516 | - $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; |
|
517 | - $this->debug('Parsing WSDL schema done'); |
|
518 | - } |
|
519 | - if ($this->status == 'schema') { |
|
520 | - $this->currentSchema->schemaEndElement($parser, $name); |
|
521 | - } else { |
|
522 | - // bring depth down a notch |
|
523 | - $this->depth--; |
|
524 | - } |
|
525 | - // end documentation |
|
526 | - if ($this->documentation) { |
|
527 | - //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. |
|
528 | - //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; |
|
529 | - $this->documentation = false; |
|
530 | - } |
|
531 | - } |
|
516 | + $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; |
|
517 | + $this->debug('Parsing WSDL schema done'); |
|
518 | + } |
|
519 | + if ($this->status == 'schema') { |
|
520 | + $this->currentSchema->schemaEndElement($parser, $name); |
|
521 | + } else { |
|
522 | + // bring depth down a notch |
|
523 | + $this->depth--; |
|
524 | + } |
|
525 | + // end documentation |
|
526 | + if ($this->documentation) { |
|
527 | + //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. |
|
528 | + //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; |
|
529 | + $this->documentation = false; |
|
530 | + } |
|
531 | + } |
|
532 | 532 | |
533 | - /** |
|
534 | - * element content handler |
|
535 | - * |
|
536 | - * @param string $parser XML parser object |
|
537 | - * @param string $data element content |
|
538 | - * @access private |
|
539 | - */ |
|
540 | - function character_data($parser, $data) |
|
541 | - { |
|
542 | - $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; |
|
543 | - if (isset($this->message[$pos]['cdata'])) { |
|
544 | - $this->message[$pos]['cdata'] .= $data; |
|
545 | - } |
|
546 | - if ($this->documentation) { |
|
547 | - $this->documentation .= $data; |
|
548 | - } |
|
549 | - } |
|
533 | + /** |
|
534 | + * element content handler |
|
535 | + * |
|
536 | + * @param string $parser XML parser object |
|
537 | + * @param string $data element content |
|
538 | + * @access private |
|
539 | + */ |
|
540 | + function character_data($parser, $data) |
|
541 | + { |
|
542 | + $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; |
|
543 | + if (isset($this->message[$pos]['cdata'])) { |
|
544 | + $this->message[$pos]['cdata'] .= $data; |
|
545 | + } |
|
546 | + if ($this->documentation) { |
|
547 | + $this->documentation .= $data; |
|
548 | + } |
|
549 | + } |
|
550 | 550 | |
551 | - /** |
|
552 | - * if authenticating, set user credentials here |
|
553 | - * |
|
554 | - * @param string $username |
|
555 | - * @param string $password |
|
556 | - * @param string $authtype (basic|digest|certificate|ntlm) |
|
557 | - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) |
|
558 | - * @access public |
|
559 | - */ |
|
560 | - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { |
|
561 | - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); |
|
562 | - $this->appendDebug($this->varDump($certRequest)); |
|
563 | - $this->username = $username; |
|
564 | - $this->password = $password; |
|
565 | - $this->authtype = $authtype; |
|
566 | - $this->certRequest = $certRequest; |
|
567 | - } |
|
551 | + /** |
|
552 | + * if authenticating, set user credentials here |
|
553 | + * |
|
554 | + * @param string $username |
|
555 | + * @param string $password |
|
556 | + * @param string $authtype (basic|digest|certificate|ntlm) |
|
557 | + * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) |
|
558 | + * @access public |
|
559 | + */ |
|
560 | + function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { |
|
561 | + $this->debug("setCredentials username=$username authtype=$authtype certRequest="); |
|
562 | + $this->appendDebug($this->varDump($certRequest)); |
|
563 | + $this->username = $username; |
|
564 | + $this->password = $password; |
|
565 | + $this->authtype = $authtype; |
|
566 | + $this->certRequest = $certRequest; |
|
567 | + } |
|
568 | 568 | |
569 | - function getBindingData($binding) |
|
570 | - { |
|
571 | - if (is_array($this->bindings[$binding])) { |
|
572 | - return $this->bindings[$binding]; |
|
573 | - } |
|
574 | - } |
|
569 | + function getBindingData($binding) |
|
570 | + { |
|
571 | + if (is_array($this->bindings[$binding])) { |
|
572 | + return $this->bindings[$binding]; |
|
573 | + } |
|
574 | + } |
|
575 | 575 | |
576 | - /** |
|
577 | - * returns an assoc array of operation names => operation data |
|
578 | - * |
|
579 | - * @param string $portName WSDL port name |
|
580 | - * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) |
|
581 | - * @return array |
|
582 | - * @access public |
|
583 | - */ |
|
584 | - function getOperations($portName = '', $bindingType = 'soap') { |
|
585 | - $ops = array(); |
|
586 | - if ($bindingType == 'soap') { |
|
587 | - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; |
|
588 | - } elseif ($bindingType == 'soap12') { |
|
589 | - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
|
590 | - } else { |
|
591 | - $this->debug("getOperations bindingType $bindingType may not be supported"); |
|
592 | - } |
|
593 | - $this->debug("getOperations for port '$portName' bindingType $bindingType"); |
|
594 | - // loop thru ports |
|
595 | - foreach($this->ports as $port => $portData) { |
|
596 | - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); |
|
597 | - if ($portName == '' || $port == $portName) { |
|
598 | - // binding type of port matches parameter |
|
599 | - if ($portData['bindingType'] == $bindingType) { |
|
600 | - $this->debug("getOperations found port $port bindingType $bindingType"); |
|
601 | - //$this->debug("port data: " . $this->varDump($portData)); |
|
602 | - //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); |
|
603 | - // merge bindings |
|
604 | - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { |
|
605 | - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); |
|
606 | - } |
|
607 | - } |
|
608 | - } |
|
609 | - } |
|
610 | - if (count($ops) == 0) { |
|
611 | - $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); |
|
612 | - } |
|
613 | - return $ops; |
|
614 | - } |
|
576 | + /** |
|
577 | + * returns an assoc array of operation names => operation data |
|
578 | + * |
|
579 | + * @param string $portName WSDL port name |
|
580 | + * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) |
|
581 | + * @return array |
|
582 | + * @access public |
|
583 | + */ |
|
584 | + function getOperations($portName = '', $bindingType = 'soap') { |
|
585 | + $ops = array(); |
|
586 | + if ($bindingType == 'soap') { |
|
587 | + $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; |
|
588 | + } elseif ($bindingType == 'soap12') { |
|
589 | + $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
|
590 | + } else { |
|
591 | + $this->debug("getOperations bindingType $bindingType may not be supported"); |
|
592 | + } |
|
593 | + $this->debug("getOperations for port '$portName' bindingType $bindingType"); |
|
594 | + // loop thru ports |
|
595 | + foreach($this->ports as $port => $portData) { |
|
596 | + $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); |
|
597 | + if ($portName == '' || $port == $portName) { |
|
598 | + // binding type of port matches parameter |
|
599 | + if ($portData['bindingType'] == $bindingType) { |
|
600 | + $this->debug("getOperations found port $port bindingType $bindingType"); |
|
601 | + //$this->debug("port data: " . $this->varDump($portData)); |
|
602 | + //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); |
|
603 | + // merge bindings |
|
604 | + if (isset($this->bindings[ $portData['binding'] ]['operations'])) { |
|
605 | + $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); |
|
606 | + } |
|
607 | + } |
|
608 | + } |
|
609 | + } |
|
610 | + if (count($ops) == 0) { |
|
611 | + $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); |
|
612 | + } |
|
613 | + return $ops; |
|
614 | + } |
|
615 | 615 | |
616 | - /** |
|
617 | - * returns an associative array of data necessary for calling an operation |
|
618 | - * |
|
619 | - * @param string $operation name of operation |
|
620 | - * @param string $bindingType type of binding eg: soap, soap12 |
|
621 | - * @return array |
|
622 | - * @access public |
|
623 | - */ |
|
624 | - function getOperationData($operation, $bindingType = 'soap') |
|
625 | - { |
|
626 | - if ($bindingType == 'soap') { |
|
627 | - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; |
|
628 | - } elseif ($bindingType == 'soap12') { |
|
629 | - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
|
630 | - } |
|
631 | - // loop thru ports |
|
632 | - foreach($this->ports as $port => $portData) { |
|
633 | - // binding type of port matches parameter |
|
634 | - if ($portData['bindingType'] == $bindingType) { |
|
635 | - // get binding |
|
636 | - //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
|
637 | - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { |
|
638 | - // note that we could/should also check the namespace here |
|
639 | - if ($operation == $bOperation) { |
|
640 | - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; |
|
641 | - return $opData; |
|
642 | - } |
|
643 | - } |
|
644 | - } |
|
645 | - } |
|
646 | - } |
|
616 | + /** |
|
617 | + * returns an associative array of data necessary for calling an operation |
|
618 | + * |
|
619 | + * @param string $operation name of operation |
|
620 | + * @param string $bindingType type of binding eg: soap, soap12 |
|
621 | + * @return array |
|
622 | + * @access public |
|
623 | + */ |
|
624 | + function getOperationData($operation, $bindingType = 'soap') |
|
625 | + { |
|
626 | + if ($bindingType == 'soap') { |
|
627 | + $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; |
|
628 | + } elseif ($bindingType == 'soap12') { |
|
629 | + $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
|
630 | + } |
|
631 | + // loop thru ports |
|
632 | + foreach($this->ports as $port => $portData) { |
|
633 | + // binding type of port matches parameter |
|
634 | + if ($portData['bindingType'] == $bindingType) { |
|
635 | + // get binding |
|
636 | + //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
|
637 | + foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { |
|
638 | + // note that we could/should also check the namespace here |
|
639 | + if ($operation == $bOperation) { |
|
640 | + $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; |
|
641 | + return $opData; |
|
642 | + } |
|
643 | + } |
|
644 | + } |
|
645 | + } |
|
646 | + } |
|
647 | 647 | |
648 | - /** |
|
649 | - * returns an associative array of data necessary for calling an operation |
|
650 | - * |
|
651 | - * @param string $soapAction soapAction for operation |
|
652 | - * @param string $bindingType type of binding eg: soap, soap12 |
|
653 | - * @return array |
|
654 | - * @access public |
|
655 | - */ |
|
656 | - function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { |
|
657 | - if ($bindingType == 'soap') { |
|
658 | - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; |
|
659 | - } elseif ($bindingType == 'soap12') { |
|
660 | - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
|
661 | - } |
|
662 | - // loop thru ports |
|
663 | - foreach($this->ports as $port => $portData) { |
|
664 | - // binding type of port matches parameter |
|
665 | - if ($portData['bindingType'] == $bindingType) { |
|
666 | - // loop through operations for the binding |
|
667 | - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
|
668 | - if ($opData['soapAction'] == $soapAction) { |
|
669 | - return $opData; |
|
670 | - } |
|
671 | - } |
|
672 | - } |
|
673 | - } |
|
674 | - } |
|
648 | + /** |
|
649 | + * returns an associative array of data necessary for calling an operation |
|
650 | + * |
|
651 | + * @param string $soapAction soapAction for operation |
|
652 | + * @param string $bindingType type of binding eg: soap, soap12 |
|
653 | + * @return array |
|
654 | + * @access public |
|
655 | + */ |
|
656 | + function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { |
|
657 | + if ($bindingType == 'soap') { |
|
658 | + $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; |
|
659 | + } elseif ($bindingType == 'soap12') { |
|
660 | + $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
|
661 | + } |
|
662 | + // loop thru ports |
|
663 | + foreach($this->ports as $port => $portData) { |
|
664 | + // binding type of port matches parameter |
|
665 | + if ($portData['bindingType'] == $bindingType) { |
|
666 | + // loop through operations for the binding |
|
667 | + foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
|
668 | + if ($opData['soapAction'] == $soapAction) { |
|
669 | + return $opData; |
|
670 | + } |
|
671 | + } |
|
672 | + } |
|
673 | + } |
|
674 | + } |
|
675 | 675 | |
676 | - /** |
|
677 | - * returns an array of information about a given type |
|
678 | - * returns false if no type exists by the given name |
|
679 | - * |
|
680 | - * typeDef = array( |
|
681 | - * 'elements' => array(), // refs to elements array |
|
682 | - * 'restrictionBase' => '', |
|
683 | - * 'phpType' => '', |
|
684 | - * 'order' => '(sequence|all)', |
|
685 | - * 'attrs' => array() // refs to attributes array |
|
686 | - * ) |
|
687 | - * |
|
688 | - * @param string $type the type |
|
689 | - * @param string $ns namespace (not prefix) of the type |
|
690 | - * @return mixed |
|
691 | - * @access public |
|
692 | - * @see nusoap_xmlschema |
|
693 | - */ |
|
694 | - function getTypeDef($type, $ns) { |
|
695 | - $this->debug("in getTypeDef: type=$type, ns=$ns"); |
|
696 | - if ((! $ns) && isset($this->namespaces['tns'])) { |
|
697 | - $ns = $this->namespaces['tns']; |
|
698 | - $this->debug("in getTypeDef: type namespace forced to $ns"); |
|
699 | - } |
|
700 | - if (!isset($this->schemas[$ns])) { |
|
701 | - foreach ($this->schemas as $ns0 => $schema0) { |
|
702 | - if (strcasecmp($ns, $ns0) == 0) { |
|
703 | - $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); |
|
704 | - $ns = $ns0; |
|
705 | - break; |
|
706 | - } |
|
707 | - } |
|
708 | - } |
|
709 | - if (isset($this->schemas[$ns])) { |
|
710 | - $this->debug("in getTypeDef: have schema for namespace $ns"); |
|
711 | - for ($i = 0; $i < count($this->schemas[$ns]); $i++) { |
|
712 | - $xs = &$this->schemas[$ns][$i]; |
|
713 | - $t = $xs->getTypeDef($type); |
|
714 | - $this->appendDebug($xs->getDebug()); |
|
715 | - $xs->clearDebug(); |
|
716 | - if ($t) { |
|
717 | - $this->debug("in getTypeDef: found type $type"); |
|
718 | - if (!isset($t['phpType'])) { |
|
719 | - // get info for type to tack onto the element |
|
720 | - $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); |
|
721 | - $ns = substr($t['type'], 0, strrpos($t['type'], ':')); |
|
722 | - $etype = $this->getTypeDef($uqType, $ns); |
|
723 | - if ($etype) { |
|
724 | - $this->debug("found type for [element] $type:"); |
|
725 | - $this->debug($this->varDump($etype)); |
|
726 | - if (isset($etype['phpType'])) { |
|
727 | - $t['phpType'] = $etype['phpType']; |
|
728 | - } |
|
729 | - if (isset($etype['elements'])) { |
|
730 | - $t['elements'] = $etype['elements']; |
|
731 | - } |
|
732 | - if (isset($etype['attrs'])) { |
|
733 | - $t['attrs'] = $etype['attrs']; |
|
734 | - } |
|
735 | - } else { |
|
736 | - $this->debug("did not find type for [element] $type"); |
|
737 | - } |
|
738 | - } |
|
739 | - return $t; |
|
740 | - } |
|
741 | - } |
|
742 | - $this->debug("in getTypeDef: did not find type $type"); |
|
743 | - } else { |
|
744 | - $this->debug("in getTypeDef: do not have schema for namespace $ns"); |
|
745 | - } |
|
746 | - return false; |
|
747 | - } |
|
676 | + /** |
|
677 | + * returns an array of information about a given type |
|
678 | + * returns false if no type exists by the given name |
|
679 | + * |
|
680 | + * typeDef = array( |
|
681 | + * 'elements' => array(), // refs to elements array |
|
682 | + * 'restrictionBase' => '', |
|
683 | + * 'phpType' => '', |
|
684 | + * 'order' => '(sequence|all)', |
|
685 | + * 'attrs' => array() // refs to attributes array |
|
686 | + * ) |
|
687 | + * |
|
688 | + * @param string $type the type |
|
689 | + * @param string $ns namespace (not prefix) of the type |
|
690 | + * @return mixed |
|
691 | + * @access public |
|
692 | + * @see nusoap_xmlschema |
|
693 | + */ |
|
694 | + function getTypeDef($type, $ns) { |
|
695 | + $this->debug("in getTypeDef: type=$type, ns=$ns"); |
|
696 | + if ((! $ns) && isset($this->namespaces['tns'])) { |
|
697 | + $ns = $this->namespaces['tns']; |
|
698 | + $this->debug("in getTypeDef: type namespace forced to $ns"); |
|
699 | + } |
|
700 | + if (!isset($this->schemas[$ns])) { |
|
701 | + foreach ($this->schemas as $ns0 => $schema0) { |
|
702 | + if (strcasecmp($ns, $ns0) == 0) { |
|
703 | + $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); |
|
704 | + $ns = $ns0; |
|
705 | + break; |
|
706 | + } |
|
707 | + } |
|
708 | + } |
|
709 | + if (isset($this->schemas[$ns])) { |
|
710 | + $this->debug("in getTypeDef: have schema for namespace $ns"); |
|
711 | + for ($i = 0; $i < count($this->schemas[$ns]); $i++) { |
|
712 | + $xs = &$this->schemas[$ns][$i]; |
|
713 | + $t = $xs->getTypeDef($type); |
|
714 | + $this->appendDebug($xs->getDebug()); |
|
715 | + $xs->clearDebug(); |
|
716 | + if ($t) { |
|
717 | + $this->debug("in getTypeDef: found type $type"); |
|
718 | + if (!isset($t['phpType'])) { |
|
719 | + // get info for type to tack onto the element |
|
720 | + $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); |
|
721 | + $ns = substr($t['type'], 0, strrpos($t['type'], ':')); |
|
722 | + $etype = $this->getTypeDef($uqType, $ns); |
|
723 | + if ($etype) { |
|
724 | + $this->debug("found type for [element] $type:"); |
|
725 | + $this->debug($this->varDump($etype)); |
|
726 | + if (isset($etype['phpType'])) { |
|
727 | + $t['phpType'] = $etype['phpType']; |
|
728 | + } |
|
729 | + if (isset($etype['elements'])) { |
|
730 | + $t['elements'] = $etype['elements']; |
|
731 | + } |
|
732 | + if (isset($etype['attrs'])) { |
|
733 | + $t['attrs'] = $etype['attrs']; |
|
734 | + } |
|
735 | + } else { |
|
736 | + $this->debug("did not find type for [element] $type"); |
|
737 | + } |
|
738 | + } |
|
739 | + return $t; |
|
740 | + } |
|
741 | + } |
|
742 | + $this->debug("in getTypeDef: did not find type $type"); |
|
743 | + } else { |
|
744 | + $this->debug("in getTypeDef: do not have schema for namespace $ns"); |
|
745 | + } |
|
746 | + return false; |
|
747 | + } |
|
748 | 748 | |
749 | 749 | /** |
750 | - * prints html description of services |
|
751 | - * |
|
752 | - * @access private |
|
753 | - */ |
|
750 | + * prints html description of services |
|
751 | + * |
|
752 | + * @access private |
|
753 | + */ |
|
754 | 754 | function webDescription(){ |
755 | - global $HTTP_SERVER_VARS; |
|
755 | + global $HTTP_SERVER_VARS; |
|
756 | 756 | |
757 | - if (isset($_SERVER)) { |
|
758 | - $PHP_SELF = $_SERVER['PHP_SELF']; |
|
759 | - } elseif (isset($HTTP_SERVER_VARS)) { |
|
760 | - $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; |
|
761 | - } else { |
|
762 | - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); |
|
763 | - } |
|
757 | + if (isset($_SERVER)) { |
|
758 | + $PHP_SELF = $_SERVER['PHP_SELF']; |
|
759 | + } elseif (isset($HTTP_SERVER_VARS)) { |
|
760 | + $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; |
|
761 | + } else { |
|
762 | + $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); |
|
763 | + } |
|
764 | 764 | |
765 | - $b = ' |
|
765 | + $b = ' |
|
766 | 766 | <html><head><title>NuSOAP: '.$this->serviceName.'</title> |
767 | 767 | <style type="text/css"> |
768 | 768 | body { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; } |
@@ -845,1092 +845,1092 @@ discard block |
||
845 | 845 | <p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service. |
846 | 846 | Click on an operation name to view it's details.</p> |
847 | 847 | <ul>'; |
848 | - foreach($this->getOperations() as $op => $data){ |
|
849 | - $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>"; |
|
850 | - // create hidden div |
|
851 | - $b .= "<div id='$op' class='hidden'> |
|
848 | + foreach($this->getOperations() as $op => $data){ |
|
849 | + $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>"; |
|
850 | + // create hidden div |
|
851 | + $b .= "<div id='$op' class='hidden'> |
|
852 | 852 | <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>"; |
853 | - foreach($data as $donnie => $marie){ // loop through opdata |
|
854 | - if($donnie == 'input' || $donnie == 'output'){ // show input/output data |
|
855 | - $b .= "<font color='white'>".ucfirst($donnie).':</font><br>'; |
|
856 | - foreach($marie as $captain => $tenille){ // loop through data |
|
857 | - if($captain == 'parts'){ // loop thru parts |
|
858 | - $b .= " $captain:<br>"; |
|
859 | - //if(is_array($tenille)){ |
|
860 | - foreach($tenille as $joanie => $chachi){ |
|
861 | - $b .= " $joanie: $chachi<br>"; |
|
862 | - } |
|
863 | - //} |
|
864 | - } else { |
|
865 | - $b .= " $captain: $tenille<br>"; |
|
866 | - } |
|
867 | - } |
|
868 | - } else { |
|
869 | - $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>"; |
|
870 | - } |
|
871 | - } |
|
872 | - $b .= '</div>'; |
|
873 | - } |
|
874 | - $b .= ' |
|
853 | + foreach($data as $donnie => $marie){ // loop through opdata |
|
854 | + if($donnie == 'input' || $donnie == 'output'){ // show input/output data |
|
855 | + $b .= "<font color='white'>".ucfirst($donnie).':</font><br>'; |
|
856 | + foreach($marie as $captain => $tenille){ // loop through data |
|
857 | + if($captain == 'parts'){ // loop thru parts |
|
858 | + $b .= " $captain:<br>"; |
|
859 | + //if(is_array($tenille)){ |
|
860 | + foreach($tenille as $joanie => $chachi){ |
|
861 | + $b .= " $joanie: $chachi<br>"; |
|
862 | + } |
|
863 | + //} |
|
864 | + } else { |
|
865 | + $b .= " $captain: $tenille<br>"; |
|
866 | + } |
|
867 | + } |
|
868 | + } else { |
|
869 | + $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>"; |
|
870 | + } |
|
871 | + } |
|
872 | + $b .= '</div>'; |
|
873 | + } |
|
874 | + $b .= ' |
|
875 | 875 | <ul> |
876 | 876 | </div> |
877 | 877 | </div></body></html>'; |
878 | - return $b; |
|
878 | + return $b; |
|
879 | 879 | } |
880 | 880 | |
881 | - /** |
|
882 | - * serialize the parsed wsdl |
|
883 | - * |
|
884 | - * @param mixed $debug whether to put debug=1 in endpoint URL |
|
885 | - * @return string serialization of WSDL |
|
886 | - * @access public |
|
887 | - */ |
|
888 | - function serialize($debug = 0) |
|
889 | - { |
|
890 | - $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'; |
|
891 | - $xml .= "\n<definitions"; |
|
892 | - foreach($this->namespaces as $k => $v) { |
|
893 | - $xml .= " xmlns:$k=\"$v\""; |
|
894 | - } |
|
895 | - // 10.9.02 - add poulter fix for wsdl and tns declarations |
|
896 | - if (isset($this->namespaces['wsdl'])) { |
|
897 | - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; |
|
898 | - } |
|
899 | - if (isset($this->namespaces['tns'])) { |
|
900 | - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; |
|
901 | - } |
|
902 | - $xml .= '>'; |
|
903 | - // imports |
|
904 | - if (sizeof($this->import) > 0) { |
|
905 | - foreach($this->import as $ns => $list) { |
|
906 | - foreach ($list as $ii) { |
|
907 | - if ($ii['location'] != '') { |
|
908 | - $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />'; |
|
909 | - } else { |
|
910 | - $xml .= '<import namespace="' . $ns . '" />'; |
|
911 | - } |
|
912 | - } |
|
913 | - } |
|
914 | - } |
|
915 | - // types |
|
916 | - if (count($this->schemas)>=1) { |
|
917 | - $xml .= "\n<types>\n"; |
|
918 | - foreach ($this->schemas as $ns => $list) { |
|
919 | - foreach ($list as $xs) { |
|
920 | - $xml .= $xs->serializeSchema(); |
|
921 | - } |
|
922 | - } |
|
923 | - $xml .= '</types>'; |
|
924 | - } |
|
925 | - // messages |
|
926 | - if (count($this->messages) >= 1) { |
|
927 | - foreach($this->messages as $msgName => $msgParts) { |
|
928 | - $xml .= "\n<message name=\"" . $msgName . '">'; |
|
929 | - if(is_array($msgParts)){ |
|
930 | - foreach($msgParts as $partName => $partType) { |
|
931 | - // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>'; |
|
932 | - if (strpos($partType, ':')) { |
|
933 | - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); |
|
934 | - } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { |
|
935 | - // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>'; |
|
936 | - $typePrefix = 'xsd'; |
|
937 | - } else { |
|
938 | - foreach($this->typemap as $ns => $types) { |
|
939 | - if (isset($types[$partType])) { |
|
940 | - $typePrefix = $this->getPrefixFromNamespace($ns); |
|
941 | - } |
|
942 | - } |
|
943 | - if (!isset($typePrefix)) { |
|
944 | - die("$partType has no namespace!"); |
|
945 | - } |
|
946 | - } |
|
947 | - $ns = $this->getNamespaceFromPrefix($typePrefix); |
|
948 | - $localPart = $this->getLocalPart($partType); |
|
949 | - $typeDef = $this->getTypeDef($localPart, $ns); |
|
950 | - if ($typeDef['typeClass'] == 'element') { |
|
951 | - $elementortype = 'element'; |
|
952 | - if (substr($localPart, -1) == '^') { |
|
953 | - $localPart = substr($localPart, 0, -1); |
|
954 | - } |
|
955 | - } else { |
|
956 | - $elementortype = 'type'; |
|
957 | - } |
|
958 | - $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />'; |
|
959 | - } |
|
960 | - } |
|
961 | - $xml .= '</message>'; |
|
962 | - } |
|
963 | - } |
|
964 | - // bindings & porttypes |
|
965 | - if (count($this->bindings) >= 1) { |
|
966 | - $binding_xml = ''; |
|
967 | - $portType_xml = ''; |
|
968 | - foreach($this->bindings as $bindingName => $attrs) { |
|
969 | - $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">'; |
|
970 | - $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>'; |
|
971 | - $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">'; |
|
972 | - foreach($attrs['operations'] as $opName => $opParts) { |
|
973 | - $binding_xml .= "\n" . ' <operation name="' . $opName . '">'; |
|
974 | - $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>'; |
|
975 | - if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { |
|
976 | - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; |
|
977 | - } else { |
|
978 | - $enc_style = ''; |
|
979 | - } |
|
980 | - $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>'; |
|
981 | - if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { |
|
982 | - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; |
|
983 | - } else { |
|
984 | - $enc_style = ''; |
|
985 | - } |
|
986 | - $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>'; |
|
987 | - $binding_xml .= "\n" . ' </operation>'; |
|
988 | - $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"'; |
|
989 | - if (isset($opParts['parameterOrder'])) { |
|
990 | - $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"'; |
|
991 | - } |
|
992 | - $portType_xml .= '>'; |
|
993 | - if(isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
994 | - $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>'; |
|
995 | - } |
|
996 | - $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>'; |
|
997 | - $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>'; |
|
998 | - $portType_xml .= "\n" . ' </operation>'; |
|
999 | - } |
|
1000 | - $portType_xml .= "\n" . '</portType>'; |
|
1001 | - $binding_xml .= "\n" . '</binding>'; |
|
1002 | - } |
|
1003 | - $xml .= $portType_xml . $binding_xml; |
|
1004 | - } |
|
1005 | - // services |
|
1006 | - $xml .= "\n<service name=\"" . $this->serviceName . '">'; |
|
1007 | - if (count($this->ports) >= 1) { |
|
1008 | - foreach($this->ports as $pName => $attrs) { |
|
1009 | - $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">'; |
|
1010 | - $xml .= "\n" . ' <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>'; |
|
1011 | - $xml .= "\n" . ' </port>'; |
|
1012 | - } |
|
1013 | - } |
|
1014 | - $xml .= "\n" . '</service>'; |
|
1015 | - return $xml . "\n</definitions>"; |
|
1016 | - } |
|
881 | + /** |
|
882 | + * serialize the parsed wsdl |
|
883 | + * |
|
884 | + * @param mixed $debug whether to put debug=1 in endpoint URL |
|
885 | + * @return string serialization of WSDL |
|
886 | + * @access public |
|
887 | + */ |
|
888 | + function serialize($debug = 0) |
|
889 | + { |
|
890 | + $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'; |
|
891 | + $xml .= "\n<definitions"; |
|
892 | + foreach($this->namespaces as $k => $v) { |
|
893 | + $xml .= " xmlns:$k=\"$v\""; |
|
894 | + } |
|
895 | + // 10.9.02 - add poulter fix for wsdl and tns declarations |
|
896 | + if (isset($this->namespaces['wsdl'])) { |
|
897 | + $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; |
|
898 | + } |
|
899 | + if (isset($this->namespaces['tns'])) { |
|
900 | + $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; |
|
901 | + } |
|
902 | + $xml .= '>'; |
|
903 | + // imports |
|
904 | + if (sizeof($this->import) > 0) { |
|
905 | + foreach($this->import as $ns => $list) { |
|
906 | + foreach ($list as $ii) { |
|
907 | + if ($ii['location'] != '') { |
|
908 | + $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />'; |
|
909 | + } else { |
|
910 | + $xml .= '<import namespace="' . $ns . '" />'; |
|
911 | + } |
|
912 | + } |
|
913 | + } |
|
914 | + } |
|
915 | + // types |
|
916 | + if (count($this->schemas)>=1) { |
|
917 | + $xml .= "\n<types>\n"; |
|
918 | + foreach ($this->schemas as $ns => $list) { |
|
919 | + foreach ($list as $xs) { |
|
920 | + $xml .= $xs->serializeSchema(); |
|
921 | + } |
|
922 | + } |
|
923 | + $xml .= '</types>'; |
|
924 | + } |
|
925 | + // messages |
|
926 | + if (count($this->messages) >= 1) { |
|
927 | + foreach($this->messages as $msgName => $msgParts) { |
|
928 | + $xml .= "\n<message name=\"" . $msgName . '">'; |
|
929 | + if(is_array($msgParts)){ |
|
930 | + foreach($msgParts as $partName => $partType) { |
|
931 | + // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>'; |
|
932 | + if (strpos($partType, ':')) { |
|
933 | + $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); |
|
934 | + } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { |
|
935 | + // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>'; |
|
936 | + $typePrefix = 'xsd'; |
|
937 | + } else { |
|
938 | + foreach($this->typemap as $ns => $types) { |
|
939 | + if (isset($types[$partType])) { |
|
940 | + $typePrefix = $this->getPrefixFromNamespace($ns); |
|
941 | + } |
|
942 | + } |
|
943 | + if (!isset($typePrefix)) { |
|
944 | + die("$partType has no namespace!"); |
|
945 | + } |
|
946 | + } |
|
947 | + $ns = $this->getNamespaceFromPrefix($typePrefix); |
|
948 | + $localPart = $this->getLocalPart($partType); |
|
949 | + $typeDef = $this->getTypeDef($localPart, $ns); |
|
950 | + if ($typeDef['typeClass'] == 'element') { |
|
951 | + $elementortype = 'element'; |
|
952 | + if (substr($localPart, -1) == '^') { |
|
953 | + $localPart = substr($localPart, 0, -1); |
|
954 | + } |
|
955 | + } else { |
|
956 | + $elementortype = 'type'; |
|
957 | + } |
|
958 | + $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />'; |
|
959 | + } |
|
960 | + } |
|
961 | + $xml .= '</message>'; |
|
962 | + } |
|
963 | + } |
|
964 | + // bindings & porttypes |
|
965 | + if (count($this->bindings) >= 1) { |
|
966 | + $binding_xml = ''; |
|
967 | + $portType_xml = ''; |
|
968 | + foreach($this->bindings as $bindingName => $attrs) { |
|
969 | + $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">'; |
|
970 | + $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>'; |
|
971 | + $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">'; |
|
972 | + foreach($attrs['operations'] as $opName => $opParts) { |
|
973 | + $binding_xml .= "\n" . ' <operation name="' . $opName . '">'; |
|
974 | + $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>'; |
|
975 | + if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { |
|
976 | + $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; |
|
977 | + } else { |
|
978 | + $enc_style = ''; |
|
979 | + } |
|
980 | + $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>'; |
|
981 | + if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { |
|
982 | + $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; |
|
983 | + } else { |
|
984 | + $enc_style = ''; |
|
985 | + } |
|
986 | + $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>'; |
|
987 | + $binding_xml .= "\n" . ' </operation>'; |
|
988 | + $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"'; |
|
989 | + if (isset($opParts['parameterOrder'])) { |
|
990 | + $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"'; |
|
991 | + } |
|
992 | + $portType_xml .= '>'; |
|
993 | + if(isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
994 | + $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>'; |
|
995 | + } |
|
996 | + $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>'; |
|
997 | + $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>'; |
|
998 | + $portType_xml .= "\n" . ' </operation>'; |
|
999 | + } |
|
1000 | + $portType_xml .= "\n" . '</portType>'; |
|
1001 | + $binding_xml .= "\n" . '</binding>'; |
|
1002 | + } |
|
1003 | + $xml .= $portType_xml . $binding_xml; |
|
1004 | + } |
|
1005 | + // services |
|
1006 | + $xml .= "\n<service name=\"" . $this->serviceName . '">'; |
|
1007 | + if (count($this->ports) >= 1) { |
|
1008 | + foreach($this->ports as $pName => $attrs) { |
|
1009 | + $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">'; |
|
1010 | + $xml .= "\n" . ' <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>'; |
|
1011 | + $xml .= "\n" . ' </port>'; |
|
1012 | + } |
|
1013 | + } |
|
1014 | + $xml .= "\n" . '</service>'; |
|
1015 | + return $xml . "\n</definitions>"; |
|
1016 | + } |
|
1017 | 1017 | |
1018 | - /** |
|
1019 | - * determine whether a set of parameters are unwrapped |
|
1020 | - * when they are expect to be wrapped, Microsoft-style. |
|
1021 | - * |
|
1022 | - * @param string $type the type (element name) of the wrapper |
|
1023 | - * @param array $parameters the parameter values for the SOAP call |
|
1024 | - * @return boolean whether they parameters are unwrapped (and should be wrapped) |
|
1025 | - * @access private |
|
1026 | - */ |
|
1027 | - function parametersMatchWrapped($type, &$parameters) { |
|
1028 | - $this->debug("in parametersMatchWrapped type=$type, parameters="); |
|
1029 | - $this->appendDebug($this->varDump($parameters)); |
|
1018 | + /** |
|
1019 | + * determine whether a set of parameters are unwrapped |
|
1020 | + * when they are expect to be wrapped, Microsoft-style. |
|
1021 | + * |
|
1022 | + * @param string $type the type (element name) of the wrapper |
|
1023 | + * @param array $parameters the parameter values for the SOAP call |
|
1024 | + * @return boolean whether they parameters are unwrapped (and should be wrapped) |
|
1025 | + * @access private |
|
1026 | + */ |
|
1027 | + function parametersMatchWrapped($type, &$parameters) { |
|
1028 | + $this->debug("in parametersMatchWrapped type=$type, parameters="); |
|
1029 | + $this->appendDebug($this->varDump($parameters)); |
|
1030 | 1030 | |
1031 | - // split type into namespace:unqualified-type |
|
1032 | - if (strpos($type, ':')) { |
|
1033 | - $uqType = substr($type, strrpos($type, ':') + 1); |
|
1034 | - $ns = substr($type, 0, strrpos($type, ':')); |
|
1035 | - $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); |
|
1036 | - if ($this->getNamespaceFromPrefix($ns)) { |
|
1037 | - $ns = $this->getNamespaceFromPrefix($ns); |
|
1038 | - $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); |
|
1039 | - } |
|
1040 | - } else { |
|
1041 | - // TODO: should the type be compared to types in XSD, and the namespace |
|
1042 | - // set to XSD if the type matches? |
|
1043 | - $this->debug("in parametersMatchWrapped: No namespace for type $type"); |
|
1044 | - $ns = ''; |
|
1045 | - $uqType = $type; |
|
1046 | - } |
|
1031 | + // split type into namespace:unqualified-type |
|
1032 | + if (strpos($type, ':')) { |
|
1033 | + $uqType = substr($type, strrpos($type, ':') + 1); |
|
1034 | + $ns = substr($type, 0, strrpos($type, ':')); |
|
1035 | + $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); |
|
1036 | + if ($this->getNamespaceFromPrefix($ns)) { |
|
1037 | + $ns = $this->getNamespaceFromPrefix($ns); |
|
1038 | + $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); |
|
1039 | + } |
|
1040 | + } else { |
|
1041 | + // TODO: should the type be compared to types in XSD, and the namespace |
|
1042 | + // set to XSD if the type matches? |
|
1043 | + $this->debug("in parametersMatchWrapped: No namespace for type $type"); |
|
1044 | + $ns = ''; |
|
1045 | + $uqType = $type; |
|
1046 | + } |
|
1047 | 1047 | |
1048 | - // get the type information |
|
1049 | - if (!$typeDef = $this->getTypeDef($uqType, $ns)) { |
|
1050 | - $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); |
|
1051 | - return false; |
|
1052 | - } |
|
1053 | - $this->debug("in parametersMatchWrapped: found typeDef="); |
|
1054 | - $this->appendDebug($this->varDump($typeDef)); |
|
1055 | - if (substr($uqType, -1) == '^') { |
|
1056 | - $uqType = substr($uqType, 0, -1); |
|
1057 | - } |
|
1058 | - $phpType = $typeDef['phpType']; |
|
1059 | - $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); |
|
1060 | - $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); |
|
1048 | + // get the type information |
|
1049 | + if (!$typeDef = $this->getTypeDef($uqType, $ns)) { |
|
1050 | + $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); |
|
1051 | + return false; |
|
1052 | + } |
|
1053 | + $this->debug("in parametersMatchWrapped: found typeDef="); |
|
1054 | + $this->appendDebug($this->varDump($typeDef)); |
|
1055 | + if (substr($uqType, -1) == '^') { |
|
1056 | + $uqType = substr($uqType, 0, -1); |
|
1057 | + } |
|
1058 | + $phpType = $typeDef['phpType']; |
|
1059 | + $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); |
|
1060 | + $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); |
|
1061 | 1061 | |
1062 | - // we expect a complexType or element of complexType |
|
1063 | - if ($phpType != 'struct') { |
|
1064 | - $this->debug("in parametersMatchWrapped: not a struct"); |
|
1065 | - return false; |
|
1066 | - } |
|
1062 | + // we expect a complexType or element of complexType |
|
1063 | + if ($phpType != 'struct') { |
|
1064 | + $this->debug("in parametersMatchWrapped: not a struct"); |
|
1065 | + return false; |
|
1066 | + } |
|
1067 | 1067 | |
1068 | - // see whether the parameter names match the elements |
|
1069 | - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { |
|
1070 | - $elements = 0; |
|
1071 | - $matches = 0; |
|
1072 | - foreach ($typeDef['elements'] as $name => $attrs) { |
|
1073 | - if (isset($parameters[$name])) { |
|
1074 | - $this->debug("in parametersMatchWrapped: have parameter named $name"); |
|
1075 | - $matches++; |
|
1076 | - } else { |
|
1077 | - $this->debug("in parametersMatchWrapped: do not have parameter named $name"); |
|
1078 | - } |
|
1079 | - $elements++; |
|
1080 | - } |
|
1068 | + // see whether the parameter names match the elements |
|
1069 | + if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { |
|
1070 | + $elements = 0; |
|
1071 | + $matches = 0; |
|
1072 | + foreach ($typeDef['elements'] as $name => $attrs) { |
|
1073 | + if (isset($parameters[$name])) { |
|
1074 | + $this->debug("in parametersMatchWrapped: have parameter named $name"); |
|
1075 | + $matches++; |
|
1076 | + } else { |
|
1077 | + $this->debug("in parametersMatchWrapped: do not have parameter named $name"); |
|
1078 | + } |
|
1079 | + $elements++; |
|
1080 | + } |
|
1081 | 1081 | |
1082 | - $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); |
|
1083 | - if ($matches == 0) { |
|
1084 | - return false; |
|
1085 | - } |
|
1086 | - return true; |
|
1087 | - } |
|
1082 | + $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); |
|
1083 | + if ($matches == 0) { |
|
1084 | + return false; |
|
1085 | + } |
|
1086 | + return true; |
|
1087 | + } |
|
1088 | 1088 | |
1089 | - // since there are no elements for the type, if the user passed no |
|
1090 | - // parameters, the parameters match wrapped. |
|
1091 | - $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); |
|
1092 | - return count($parameters) == 0; |
|
1093 | - } |
|
1089 | + // since there are no elements for the type, if the user passed no |
|
1090 | + // parameters, the parameters match wrapped. |
|
1091 | + $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); |
|
1092 | + return count($parameters) == 0; |
|
1093 | + } |
|
1094 | 1094 | |
1095 | - /** |
|
1096 | - * serialize PHP values according to a WSDL message definition |
|
1097 | - * contrary to the method name, this is not limited to RPC |
|
1098 | - * |
|
1099 | - * TODO |
|
1100 | - * - multi-ref serialization |
|
1101 | - * - validate PHP values against type definitions, return errors if invalid |
|
1102 | - * |
|
1103 | - * @param string $operation operation name |
|
1104 | - * @param string $direction (input|output) |
|
1105 | - * @param mixed $parameters parameter value(s) |
|
1106 | - * @param string $bindingType (soap|soap12) |
|
1107 | - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) |
|
1108 | - * @access public |
|
1109 | - */ |
|
1110 | - function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { |
|
1111 | - $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); |
|
1112 | - $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1095 | + /** |
|
1096 | + * serialize PHP values according to a WSDL message definition |
|
1097 | + * contrary to the method name, this is not limited to RPC |
|
1098 | + * |
|
1099 | + * TODO |
|
1100 | + * - multi-ref serialization |
|
1101 | + * - validate PHP values against type definitions, return errors if invalid |
|
1102 | + * |
|
1103 | + * @param string $operation operation name |
|
1104 | + * @param string $direction (input|output) |
|
1105 | + * @param mixed $parameters parameter value(s) |
|
1106 | + * @param string $bindingType (soap|soap12) |
|
1107 | + * @return mixed parameters serialized as XML or false on error (e.g. operation not found) |
|
1108 | + * @access public |
|
1109 | + */ |
|
1110 | + function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { |
|
1111 | + $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); |
|
1112 | + $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1113 | 1113 | |
1114 | - if ($direction != 'input' && $direction != 'output') { |
|
1115 | - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1116 | - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1117 | - return false; |
|
1118 | - } |
|
1119 | - if (!$opData = $this->getOperationData($operation, $bindingType)) { |
|
1120 | - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1121 | - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1122 | - return false; |
|
1123 | - } |
|
1124 | - $this->debug('in serializeRPCParameters: opData:'); |
|
1125 | - $this->appendDebug($this->varDump($opData)); |
|
1114 | + if ($direction != 'input' && $direction != 'output') { |
|
1115 | + $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1116 | + $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1117 | + return false; |
|
1118 | + } |
|
1119 | + if (!$opData = $this->getOperationData($operation, $bindingType)) { |
|
1120 | + $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1121 | + $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1122 | + return false; |
|
1123 | + } |
|
1124 | + $this->debug('in serializeRPCParameters: opData:'); |
|
1125 | + $this->appendDebug($this->varDump($opData)); |
|
1126 | 1126 | |
1127 | - // Get encoding style for output and set to current |
|
1128 | - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
|
1129 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1130 | - $encodingStyle = $opData['output']['encodingStyle']; |
|
1131 | - $enc_style = $encodingStyle; |
|
1132 | - } |
|
1127 | + // Get encoding style for output and set to current |
|
1128 | + $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
|
1129 | + if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1130 | + $encodingStyle = $opData['output']['encodingStyle']; |
|
1131 | + $enc_style = $encodingStyle; |
|
1132 | + } |
|
1133 | 1133 | |
1134 | - // set input params |
|
1135 | - $xml = ''; |
|
1136 | - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { |
|
1137 | - $parts = &$opData[$direction]['parts']; |
|
1138 | - $part_count = sizeof($parts); |
|
1139 | - $style = $opData['style']; |
|
1140 | - $use = $opData[$direction]['use']; |
|
1141 | - $this->debug("have $part_count part(s) to serialize using $style/$use"); |
|
1142 | - if (is_array($parameters)) { |
|
1143 | - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); |
|
1144 | - $parameter_count = count($parameters); |
|
1145 | - $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); |
|
1146 | - // check for Microsoft-style wrapped parameters |
|
1147 | - if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { |
|
1148 | - $this->debug('check whether the caller has wrapped the parameters'); |
|
1149 | - if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { |
|
1150 | - // TODO: consider checking here for double-wrapping, when |
|
1151 | - // service function wraps, then NuSOAP wraps again |
|
1152 | - $this->debug("change simple array to associative with 'parameters' element"); |
|
1153 | - $parameters['parameters'] = $parameters[0]; |
|
1154 | - unset($parameters[0]); |
|
1155 | - } |
|
1156 | - if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { |
|
1157 | - $this->debug('check whether caller\'s parameters match the wrapped ones'); |
|
1158 | - if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { |
|
1159 | - $this->debug('wrap the parameters for the caller'); |
|
1160 | - $parameters = array('parameters' => $parameters); |
|
1161 | - $parameter_count = 1; |
|
1162 | - } |
|
1163 | - } |
|
1164 | - } |
|
1165 | - foreach ($parts as $name => $type) { |
|
1166 | - $this->debug("serializing part $name of type $type"); |
|
1167 | - // Track encoding style |
|
1168 | - if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1169 | - $encodingStyle = $opData[$direction]['encodingStyle']; |
|
1170 | - $enc_style = $encodingStyle; |
|
1171 | - } else { |
|
1172 | - $enc_style = false; |
|
1173 | - } |
|
1174 | - // NOTE: add error handling here |
|
1175 | - // if serializeType returns false, then catch global error and fault |
|
1176 | - if ($parametersArrayType == 'arraySimple') { |
|
1177 | - $p = array_shift($parameters); |
|
1178 | - $this->debug('calling serializeType w/indexed param'); |
|
1179 | - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); |
|
1180 | - } elseif (isset($parameters[$name])) { |
|
1181 | - $this->debug('calling serializeType w/named param'); |
|
1182 | - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); |
|
1183 | - } else { |
|
1184 | - // TODO: only send nillable |
|
1185 | - $this->debug('calling serializeType w/null param'); |
|
1186 | - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); |
|
1187 | - } |
|
1188 | - } |
|
1189 | - } else { |
|
1190 | - $this->debug('no parameters passed.'); |
|
1191 | - } |
|
1192 | - } |
|
1193 | - $this->debug("serializeRPCParameters returning: $xml"); |
|
1194 | - return $xml; |
|
1195 | - } |
|
1134 | + // set input params |
|
1135 | + $xml = ''; |
|
1136 | + if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { |
|
1137 | + $parts = &$opData[$direction]['parts']; |
|
1138 | + $part_count = sizeof($parts); |
|
1139 | + $style = $opData['style']; |
|
1140 | + $use = $opData[$direction]['use']; |
|
1141 | + $this->debug("have $part_count part(s) to serialize using $style/$use"); |
|
1142 | + if (is_array($parameters)) { |
|
1143 | + $parametersArrayType = $this->isArraySimpleOrStruct($parameters); |
|
1144 | + $parameter_count = count($parameters); |
|
1145 | + $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); |
|
1146 | + // check for Microsoft-style wrapped parameters |
|
1147 | + if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { |
|
1148 | + $this->debug('check whether the caller has wrapped the parameters'); |
|
1149 | + if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { |
|
1150 | + // TODO: consider checking here for double-wrapping, when |
|
1151 | + // service function wraps, then NuSOAP wraps again |
|
1152 | + $this->debug("change simple array to associative with 'parameters' element"); |
|
1153 | + $parameters['parameters'] = $parameters[0]; |
|
1154 | + unset($parameters[0]); |
|
1155 | + } |
|
1156 | + if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { |
|
1157 | + $this->debug('check whether caller\'s parameters match the wrapped ones'); |
|
1158 | + if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { |
|
1159 | + $this->debug('wrap the parameters for the caller'); |
|
1160 | + $parameters = array('parameters' => $parameters); |
|
1161 | + $parameter_count = 1; |
|
1162 | + } |
|
1163 | + } |
|
1164 | + } |
|
1165 | + foreach ($parts as $name => $type) { |
|
1166 | + $this->debug("serializing part $name of type $type"); |
|
1167 | + // Track encoding style |
|
1168 | + if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1169 | + $encodingStyle = $opData[$direction]['encodingStyle']; |
|
1170 | + $enc_style = $encodingStyle; |
|
1171 | + } else { |
|
1172 | + $enc_style = false; |
|
1173 | + } |
|
1174 | + // NOTE: add error handling here |
|
1175 | + // if serializeType returns false, then catch global error and fault |
|
1176 | + if ($parametersArrayType == 'arraySimple') { |
|
1177 | + $p = array_shift($parameters); |
|
1178 | + $this->debug('calling serializeType w/indexed param'); |
|
1179 | + $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); |
|
1180 | + } elseif (isset($parameters[$name])) { |
|
1181 | + $this->debug('calling serializeType w/named param'); |
|
1182 | + $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); |
|
1183 | + } else { |
|
1184 | + // TODO: only send nillable |
|
1185 | + $this->debug('calling serializeType w/null param'); |
|
1186 | + $xml .= $this->serializeType($name, $type, null, $use, $enc_style); |
|
1187 | + } |
|
1188 | + } |
|
1189 | + } else { |
|
1190 | + $this->debug('no parameters passed.'); |
|
1191 | + } |
|
1192 | + } |
|
1193 | + $this->debug("serializeRPCParameters returning: $xml"); |
|
1194 | + return $xml; |
|
1195 | + } |
|
1196 | 1196 | |
1197 | - /** |
|
1198 | - * serialize a PHP value according to a WSDL message definition |
|
1199 | - * |
|
1200 | - * TODO |
|
1201 | - * - multi-ref serialization |
|
1202 | - * - validate PHP values against type definitions, return errors if invalid |
|
1203 | - * |
|
1204 | - * @param string $operation operation name |
|
1205 | - * @param string $direction (input|output) |
|
1206 | - * @param mixed $parameters parameter value(s) |
|
1207 | - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) |
|
1208 | - * @access public |
|
1209 | - * @deprecated |
|
1210 | - */ |
|
1211 | - function serializeParameters($operation, $direction, $parameters) |
|
1212 | - { |
|
1213 | - $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); |
|
1214 | - $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1197 | + /** |
|
1198 | + * serialize a PHP value according to a WSDL message definition |
|
1199 | + * |
|
1200 | + * TODO |
|
1201 | + * - multi-ref serialization |
|
1202 | + * - validate PHP values against type definitions, return errors if invalid |
|
1203 | + * |
|
1204 | + * @param string $operation operation name |
|
1205 | + * @param string $direction (input|output) |
|
1206 | + * @param mixed $parameters parameter value(s) |
|
1207 | + * @return mixed parameters serialized as XML or false on error (e.g. operation not found) |
|
1208 | + * @access public |
|
1209 | + * @deprecated |
|
1210 | + */ |
|
1211 | + function serializeParameters($operation, $direction, $parameters) |
|
1212 | + { |
|
1213 | + $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); |
|
1214 | + $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1215 | 1215 | |
1216 | - if ($direction != 'input' && $direction != 'output') { |
|
1217 | - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1218 | - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1219 | - return false; |
|
1220 | - } |
|
1221 | - if (!$opData = $this->getOperationData($operation)) { |
|
1222 | - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1223 | - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1224 | - return false; |
|
1225 | - } |
|
1226 | - $this->debug('opData:'); |
|
1227 | - $this->appendDebug($this->varDump($opData)); |
|
1216 | + if ($direction != 'input' && $direction != 'output') { |
|
1217 | + $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1218 | + $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); |
|
1219 | + return false; |
|
1220 | + } |
|
1221 | + if (!$opData = $this->getOperationData($operation)) { |
|
1222 | + $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1223 | + $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1224 | + return false; |
|
1225 | + } |
|
1226 | + $this->debug('opData:'); |
|
1227 | + $this->appendDebug($this->varDump($opData)); |
|
1228 | 1228 | |
1229 | - // Get encoding style for output and set to current |
|
1230 | - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
|
1231 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1232 | - $encodingStyle = $opData['output']['encodingStyle']; |
|
1233 | - $enc_style = $encodingStyle; |
|
1234 | - } |
|
1229 | + // Get encoding style for output and set to current |
|
1230 | + $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
|
1231 | + if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1232 | + $encodingStyle = $opData['output']['encodingStyle']; |
|
1233 | + $enc_style = $encodingStyle; |
|
1234 | + } |
|
1235 | 1235 | |
1236 | - // set input params |
|
1237 | - $xml = ''; |
|
1238 | - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { |
|
1236 | + // set input params |
|
1237 | + $xml = ''; |
|
1238 | + if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { |
|
1239 | 1239 | |
1240 | - $use = $opData[$direction]['use']; |
|
1241 | - $this->debug("use=$use"); |
|
1242 | - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); |
|
1243 | - if (is_array($parameters)) { |
|
1244 | - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); |
|
1245 | - $this->debug('have ' . $parametersArrayType . ' parameters'); |
|
1246 | - foreach($opData[$direction]['parts'] as $name => $type) { |
|
1247 | - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); |
|
1248 | - // Track encoding style |
|
1249 | - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1250 | - $encodingStyle = $opData[$direction]['encodingStyle']; |
|
1251 | - $enc_style = $encodingStyle; |
|
1252 | - } else { |
|
1253 | - $enc_style = false; |
|
1254 | - } |
|
1255 | - // NOTE: add error handling here |
|
1256 | - // if serializeType returns false, then catch global error and fault |
|
1257 | - if ($parametersArrayType == 'arraySimple') { |
|
1258 | - $p = array_shift($parameters); |
|
1259 | - $this->debug('calling serializeType w/indexed param'); |
|
1260 | - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); |
|
1261 | - } elseif (isset($parameters[$name])) { |
|
1262 | - $this->debug('calling serializeType w/named param'); |
|
1263 | - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); |
|
1264 | - } else { |
|
1265 | - // TODO: only send nillable |
|
1266 | - $this->debug('calling serializeType w/null param'); |
|
1267 | - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); |
|
1268 | - } |
|
1269 | - } |
|
1270 | - } else { |
|
1271 | - $this->debug('no parameters passed.'); |
|
1272 | - } |
|
1273 | - } |
|
1274 | - $this->debug("serializeParameters returning: $xml"); |
|
1275 | - return $xml; |
|
1276 | - } |
|
1240 | + $use = $opData[$direction]['use']; |
|
1241 | + $this->debug("use=$use"); |
|
1242 | + $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); |
|
1243 | + if (is_array($parameters)) { |
|
1244 | + $parametersArrayType = $this->isArraySimpleOrStruct($parameters); |
|
1245 | + $this->debug('have ' . $parametersArrayType . ' parameters'); |
|
1246 | + foreach($opData[$direction]['parts'] as $name => $type) { |
|
1247 | + $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); |
|
1248 | + // Track encoding style |
|
1249 | + if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1250 | + $encodingStyle = $opData[$direction]['encodingStyle']; |
|
1251 | + $enc_style = $encodingStyle; |
|
1252 | + } else { |
|
1253 | + $enc_style = false; |
|
1254 | + } |
|
1255 | + // NOTE: add error handling here |
|
1256 | + // if serializeType returns false, then catch global error and fault |
|
1257 | + if ($parametersArrayType == 'arraySimple') { |
|
1258 | + $p = array_shift($parameters); |
|
1259 | + $this->debug('calling serializeType w/indexed param'); |
|
1260 | + $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); |
|
1261 | + } elseif (isset($parameters[$name])) { |
|
1262 | + $this->debug('calling serializeType w/named param'); |
|
1263 | + $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); |
|
1264 | + } else { |
|
1265 | + // TODO: only send nillable |
|
1266 | + $this->debug('calling serializeType w/null param'); |
|
1267 | + $xml .= $this->serializeType($name, $type, null, $use, $enc_style); |
|
1268 | + } |
|
1269 | + } |
|
1270 | + } else { |
|
1271 | + $this->debug('no parameters passed.'); |
|
1272 | + } |
|
1273 | + } |
|
1274 | + $this->debug("serializeParameters returning: $xml"); |
|
1275 | + return $xml; |
|
1276 | + } |
|
1277 | 1277 | |
1278 | - /** |
|
1279 | - * serializes a PHP value according a given type definition |
|
1280 | - * |
|
1281 | - * @param string $name name of value (part or element) |
|
1282 | - * @param string $type XML schema type of value (type or element) |
|
1283 | - * @param mixed $value a native PHP value (parameter value) |
|
1284 | - * @param string $use use for part (encoded|literal) |
|
1285 | - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) |
|
1286 | - * @param boolean $unqualified a kludge for what should be XML namespace form handling |
|
1287 | - * @return string value serialized as an XML string |
|
1288 | - * @access private |
|
1289 | - */ |
|
1290 | - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) |
|
1291 | - { |
|
1292 | - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); |
|
1293 | - $this->appendDebug("value=" . $this->varDump($value)); |
|
1294 | - if($use == 'encoded' && $encodingStyle) { |
|
1295 | - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; |
|
1296 | - } |
|
1278 | + /** |
|
1279 | + * serializes a PHP value according a given type definition |
|
1280 | + * |
|
1281 | + * @param string $name name of value (part or element) |
|
1282 | + * @param string $type XML schema type of value (type or element) |
|
1283 | + * @param mixed $value a native PHP value (parameter value) |
|
1284 | + * @param string $use use for part (encoded|literal) |
|
1285 | + * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) |
|
1286 | + * @param boolean $unqualified a kludge for what should be XML namespace form handling |
|
1287 | + * @return string value serialized as an XML string |
|
1288 | + * @access private |
|
1289 | + */ |
|
1290 | + function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) |
|
1291 | + { |
|
1292 | + $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); |
|
1293 | + $this->appendDebug("value=" . $this->varDump($value)); |
|
1294 | + if($use == 'encoded' && $encodingStyle) { |
|
1295 | + $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; |
|
1296 | + } |
|
1297 | 1297 | |
1298 | - // if a soapval has been supplied, let its type override the WSDL |
|
1299 | - if (is_object($value) && get_class($value) == 'soapval') { |
|
1300 | - if ($value->type_ns) { |
|
1301 | - $type = $value->type_ns . ':' . $value->type; |
|
1302 | - $forceType = true; |
|
1303 | - $this->debug("in serializeType: soapval overrides type to $type"); |
|
1304 | - } elseif ($value->type) { |
|
1305 | - $type = $value->type; |
|
1306 | - $forceType = true; |
|
1307 | - $this->debug("in serializeType: soapval overrides type to $type"); |
|
1308 | - } else { |
|
1309 | - $forceType = false; |
|
1310 | - $this->debug("in serializeType: soapval does not override type"); |
|
1311 | - } |
|
1312 | - $attrs = $value->attributes; |
|
1313 | - $value = $value->value; |
|
1314 | - $this->debug("in serializeType: soapval overrides value to $value"); |
|
1315 | - if ($attrs) { |
|
1316 | - if (!is_array($value)) { |
|
1317 | - $value['!'] = $value; |
|
1318 | - } |
|
1319 | - foreach ($attrs as $n => $v) { |
|
1320 | - $value['!' . $n] = $v; |
|
1321 | - } |
|
1322 | - $this->debug("in serializeType: soapval provides attributes"); |
|
1323 | - } |
|
1298 | + // if a soapval has been supplied, let its type override the WSDL |
|
1299 | + if (is_object($value) && get_class($value) == 'soapval') { |
|
1300 | + if ($value->type_ns) { |
|
1301 | + $type = $value->type_ns . ':' . $value->type; |
|
1302 | + $forceType = true; |
|
1303 | + $this->debug("in serializeType: soapval overrides type to $type"); |
|
1304 | + } elseif ($value->type) { |
|
1305 | + $type = $value->type; |
|
1306 | + $forceType = true; |
|
1307 | + $this->debug("in serializeType: soapval overrides type to $type"); |
|
1308 | + } else { |
|
1309 | + $forceType = false; |
|
1310 | + $this->debug("in serializeType: soapval does not override type"); |
|
1311 | + } |
|
1312 | + $attrs = $value->attributes; |
|
1313 | + $value = $value->value; |
|
1314 | + $this->debug("in serializeType: soapval overrides value to $value"); |
|
1315 | + if ($attrs) { |
|
1316 | + if (!is_array($value)) { |
|
1317 | + $value['!'] = $value; |
|
1318 | + } |
|
1319 | + foreach ($attrs as $n => $v) { |
|
1320 | + $value['!' . $n] = $v; |
|
1321 | + } |
|
1322 | + $this->debug("in serializeType: soapval provides attributes"); |
|
1323 | + } |
|
1324 | 1324 | } else { |
1325 | - $forceType = false; |
|
1325 | + $forceType = false; |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | - $xml = ''; |
|
1329 | - if (strpos($type, ':')) { |
|
1330 | - $uqType = substr($type, strrpos($type, ':') + 1); |
|
1331 | - $ns = substr($type, 0, strrpos($type, ':')); |
|
1332 | - $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); |
|
1333 | - if ($this->getNamespaceFromPrefix($ns)) { |
|
1334 | - $ns = $this->getNamespaceFromPrefix($ns); |
|
1335 | - $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); |
|
1336 | - } |
|
1328 | + $xml = ''; |
|
1329 | + if (strpos($type, ':')) { |
|
1330 | + $uqType = substr($type, strrpos($type, ':') + 1); |
|
1331 | + $ns = substr($type, 0, strrpos($type, ':')); |
|
1332 | + $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); |
|
1333 | + if ($this->getNamespaceFromPrefix($ns)) { |
|
1334 | + $ns = $this->getNamespaceFromPrefix($ns); |
|
1335 | + $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); |
|
1336 | + } |
|
1337 | 1337 | |
1338 | - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ |
|
1339 | - $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); |
|
1340 | - if ($unqualified && $use == 'literal') { |
|
1341 | - $elementNS = " xmlns=\"\""; |
|
1342 | - } else { |
|
1343 | - $elementNS = ''; |
|
1344 | - } |
|
1345 | - if (is_null($value)) { |
|
1346 | - if ($use == 'literal') { |
|
1347 | - // TODO: depends on minOccurs |
|
1348 | - $xml = "<$name$elementNS/>"; |
|
1349 | - } else { |
|
1350 | - // TODO: depends on nillable, which should be checked before calling this method |
|
1351 | - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1352 | - } |
|
1353 | - $this->debug("in serializeType: returning: $xml"); |
|
1354 | - return $xml; |
|
1355 | - } |
|
1356 | - if ($uqType == 'Array') { |
|
1357 | - // JBoss/Axis does this sometimes |
|
1358 | - return $this->serialize_val($value, $name, false, false, false, false, $use); |
|
1359 | - } |
|
1360 | - if ($uqType == 'boolean') { |
|
1361 | - if ((is_string($value) && $value == 'false') || (! $value)) { |
|
1362 | - $value = 'false'; |
|
1363 | - } else { |
|
1364 | - $value = 'true'; |
|
1365 | - } |
|
1366 | - } |
|
1367 | - if ($uqType == 'string' && gettype($value) == 'string') { |
|
1368 | - $value = $this->expandEntities($value); |
|
1369 | - } |
|
1370 | - if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { |
|
1371 | - $value = sprintf("%.0lf", $value); |
|
1372 | - } |
|
1373 | - // it's a scalar |
|
1374 | - // TODO: what about null/nil values? |
|
1375 | - // check type isn't a custom type extending xmlschema namespace |
|
1376 | - if (!$this->getTypeDef($uqType, $ns)) { |
|
1377 | - if ($use == 'literal') { |
|
1378 | - if ($forceType) { |
|
1379 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1380 | - } else { |
|
1381 | - $xml = "<$name$elementNS>$value</$name>"; |
|
1382 | - } |
|
1383 | - } else { |
|
1384 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1385 | - } |
|
1386 | - $this->debug("in serializeType: returning: $xml"); |
|
1387 | - return $xml; |
|
1388 | - } |
|
1389 | - $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); |
|
1390 | - } else if ($ns == 'http://xml.apache.org/xml-soap') { |
|
1391 | - $this->debug('in serializeType: appears to be Apache SOAP type'); |
|
1392 | - if ($uqType == 'Map') { |
|
1393 | - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
|
1394 | - if (! $tt_prefix) { |
|
1395 | - $this->debug('in serializeType: Add namespace for Apache SOAP type'); |
|
1396 | - $tt_prefix = 'ns' . rand(1000, 9999); |
|
1397 | - $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; |
|
1398 | - // force this to be added to usedNamespaces |
|
1399 | - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
|
1400 | - } |
|
1401 | - $contents = ''; |
|
1402 | - foreach($value as $k => $v) { |
|
1403 | - $this->debug("serializing map element: key $k, value $v"); |
|
1404 | - $contents .= '<item>'; |
|
1405 | - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); |
|
1406 | - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); |
|
1407 | - $contents .= '</item>'; |
|
1408 | - } |
|
1409 | - if ($use == 'literal') { |
|
1410 | - if ($forceType) { |
|
1411 | - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>"; |
|
1412 | - } else { |
|
1413 | - $xml = "<$name>$contents</$name>"; |
|
1414 | - } |
|
1415 | - } else { |
|
1416 | - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>"; |
|
1417 | - } |
|
1418 | - $this->debug("in serializeType: returning: $xml"); |
|
1419 | - return $xml; |
|
1420 | - } |
|
1421 | - $this->debug('in serializeType: Apache SOAP type, but only support Map'); |
|
1422 | - } |
|
1423 | - } else { |
|
1424 | - // TODO: should the type be compared to types in XSD, and the namespace |
|
1425 | - // set to XSD if the type matches? |
|
1426 | - $this->debug("in serializeType: No namespace for type $type"); |
|
1427 | - $ns = ''; |
|
1428 | - $uqType = $type; |
|
1429 | - } |
|
1430 | - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ |
|
1431 | - $this->setError("$type ($uqType) is not a supported type."); |
|
1432 | - $this->debug("in serializeType: $type ($uqType) is not a supported type."); |
|
1433 | - return false; |
|
1434 | - } else { |
|
1435 | - $this->debug("in serializeType: found typeDef"); |
|
1436 | - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); |
|
1437 | - if (substr($uqType, -1) == '^') { |
|
1438 | - $uqType = substr($uqType, 0, -1); |
|
1439 | - } |
|
1440 | - } |
|
1441 | - if (!isset($typeDef['phpType'])) { |
|
1442 | - $this->setError("$type ($uqType) has no phpType."); |
|
1443 | - $this->debug("in serializeType: $type ($uqType) has no phpType."); |
|
1444 | - return false; |
|
1445 | - } |
|
1446 | - $phpType = $typeDef['phpType']; |
|
1447 | - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); |
|
1448 | - // if php type == struct, map value to the <all> element names |
|
1449 | - if ($phpType == 'struct') { |
|
1450 | - if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { |
|
1451 | - $elementName = $uqType; |
|
1452 | - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { |
|
1453 | - $elementNS = " xmlns=\"$ns\""; |
|
1454 | - } else { |
|
1455 | - $elementNS = " xmlns=\"\""; |
|
1456 | - } |
|
1457 | - } else { |
|
1458 | - $elementName = $name; |
|
1459 | - if ($unqualified) { |
|
1460 | - $elementNS = " xmlns=\"\""; |
|
1461 | - } else { |
|
1462 | - $elementNS = ''; |
|
1463 | - } |
|
1464 | - } |
|
1465 | - if (is_null($value)) { |
|
1466 | - if ($use == 'literal') { |
|
1467 | - // TODO: depends on minOccurs and nillable |
|
1468 | - $xml = "<$elementName$elementNS/>"; |
|
1469 | - } else { |
|
1470 | - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1471 | - } |
|
1472 | - $this->debug("in serializeType: returning: $xml"); |
|
1473 | - return $xml; |
|
1474 | - } |
|
1475 | - if (is_object($value)) { |
|
1476 | - $value = get_object_vars($value); |
|
1477 | - } |
|
1478 | - if (is_array($value)) { |
|
1479 | - $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); |
|
1480 | - if ($use == 'literal') { |
|
1481 | - if ($forceType) { |
|
1482 | - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; |
|
1483 | - } else { |
|
1484 | - $xml = "<$elementName$elementNS$elementAttrs>"; |
|
1485 | - } |
|
1486 | - } else { |
|
1487 | - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; |
|
1488 | - } |
|
1338 | + if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ |
|
1339 | + $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); |
|
1340 | + if ($unqualified && $use == 'literal') { |
|
1341 | + $elementNS = " xmlns=\"\""; |
|
1342 | + } else { |
|
1343 | + $elementNS = ''; |
|
1344 | + } |
|
1345 | + if (is_null($value)) { |
|
1346 | + if ($use == 'literal') { |
|
1347 | + // TODO: depends on minOccurs |
|
1348 | + $xml = "<$name$elementNS/>"; |
|
1349 | + } else { |
|
1350 | + // TODO: depends on nillable, which should be checked before calling this method |
|
1351 | + $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1352 | + } |
|
1353 | + $this->debug("in serializeType: returning: $xml"); |
|
1354 | + return $xml; |
|
1355 | + } |
|
1356 | + if ($uqType == 'Array') { |
|
1357 | + // JBoss/Axis does this sometimes |
|
1358 | + return $this->serialize_val($value, $name, false, false, false, false, $use); |
|
1359 | + } |
|
1360 | + if ($uqType == 'boolean') { |
|
1361 | + if ((is_string($value) && $value == 'false') || (! $value)) { |
|
1362 | + $value = 'false'; |
|
1363 | + } else { |
|
1364 | + $value = 'true'; |
|
1365 | + } |
|
1366 | + } |
|
1367 | + if ($uqType == 'string' && gettype($value) == 'string') { |
|
1368 | + $value = $this->expandEntities($value); |
|
1369 | + } |
|
1370 | + if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { |
|
1371 | + $value = sprintf("%.0lf", $value); |
|
1372 | + } |
|
1373 | + // it's a scalar |
|
1374 | + // TODO: what about null/nil values? |
|
1375 | + // check type isn't a custom type extending xmlschema namespace |
|
1376 | + if (!$this->getTypeDef($uqType, $ns)) { |
|
1377 | + if ($use == 'literal') { |
|
1378 | + if ($forceType) { |
|
1379 | + $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1380 | + } else { |
|
1381 | + $xml = "<$name$elementNS>$value</$name>"; |
|
1382 | + } |
|
1383 | + } else { |
|
1384 | + $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1385 | + } |
|
1386 | + $this->debug("in serializeType: returning: $xml"); |
|
1387 | + return $xml; |
|
1388 | + } |
|
1389 | + $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); |
|
1390 | + } else if ($ns == 'http://xml.apache.org/xml-soap') { |
|
1391 | + $this->debug('in serializeType: appears to be Apache SOAP type'); |
|
1392 | + if ($uqType == 'Map') { |
|
1393 | + $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
|
1394 | + if (! $tt_prefix) { |
|
1395 | + $this->debug('in serializeType: Add namespace for Apache SOAP type'); |
|
1396 | + $tt_prefix = 'ns' . rand(1000, 9999); |
|
1397 | + $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; |
|
1398 | + // force this to be added to usedNamespaces |
|
1399 | + $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
|
1400 | + } |
|
1401 | + $contents = ''; |
|
1402 | + foreach($value as $k => $v) { |
|
1403 | + $this->debug("serializing map element: key $k, value $v"); |
|
1404 | + $contents .= '<item>'; |
|
1405 | + $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); |
|
1406 | + $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); |
|
1407 | + $contents .= '</item>'; |
|
1408 | + } |
|
1409 | + if ($use == 'literal') { |
|
1410 | + if ($forceType) { |
|
1411 | + $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>"; |
|
1412 | + } else { |
|
1413 | + $xml = "<$name>$contents</$name>"; |
|
1414 | + } |
|
1415 | + } else { |
|
1416 | + $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>"; |
|
1417 | + } |
|
1418 | + $this->debug("in serializeType: returning: $xml"); |
|
1419 | + return $xml; |
|
1420 | + } |
|
1421 | + $this->debug('in serializeType: Apache SOAP type, but only support Map'); |
|
1422 | + } |
|
1423 | + } else { |
|
1424 | + // TODO: should the type be compared to types in XSD, and the namespace |
|
1425 | + // set to XSD if the type matches? |
|
1426 | + $this->debug("in serializeType: No namespace for type $type"); |
|
1427 | + $ns = ''; |
|
1428 | + $uqType = $type; |
|
1429 | + } |
|
1430 | + if(!$typeDef = $this->getTypeDef($uqType, $ns)){ |
|
1431 | + $this->setError("$type ($uqType) is not a supported type."); |
|
1432 | + $this->debug("in serializeType: $type ($uqType) is not a supported type."); |
|
1433 | + return false; |
|
1434 | + } else { |
|
1435 | + $this->debug("in serializeType: found typeDef"); |
|
1436 | + $this->appendDebug('typeDef=' . $this->varDump($typeDef)); |
|
1437 | + if (substr($uqType, -1) == '^') { |
|
1438 | + $uqType = substr($uqType, 0, -1); |
|
1439 | + } |
|
1440 | + } |
|
1441 | + if (!isset($typeDef['phpType'])) { |
|
1442 | + $this->setError("$type ($uqType) has no phpType."); |
|
1443 | + $this->debug("in serializeType: $type ($uqType) has no phpType."); |
|
1444 | + return false; |
|
1445 | + } |
|
1446 | + $phpType = $typeDef['phpType']; |
|
1447 | + $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); |
|
1448 | + // if php type == struct, map value to the <all> element names |
|
1449 | + if ($phpType == 'struct') { |
|
1450 | + if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { |
|
1451 | + $elementName = $uqType; |
|
1452 | + if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { |
|
1453 | + $elementNS = " xmlns=\"$ns\""; |
|
1454 | + } else { |
|
1455 | + $elementNS = " xmlns=\"\""; |
|
1456 | + } |
|
1457 | + } else { |
|
1458 | + $elementName = $name; |
|
1459 | + if ($unqualified) { |
|
1460 | + $elementNS = " xmlns=\"\""; |
|
1461 | + } else { |
|
1462 | + $elementNS = ''; |
|
1463 | + } |
|
1464 | + } |
|
1465 | + if (is_null($value)) { |
|
1466 | + if ($use == 'literal') { |
|
1467 | + // TODO: depends on minOccurs and nillable |
|
1468 | + $xml = "<$elementName$elementNS/>"; |
|
1469 | + } else { |
|
1470 | + $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1471 | + } |
|
1472 | + $this->debug("in serializeType: returning: $xml"); |
|
1473 | + return $xml; |
|
1474 | + } |
|
1475 | + if (is_object($value)) { |
|
1476 | + $value = get_object_vars($value); |
|
1477 | + } |
|
1478 | + if (is_array($value)) { |
|
1479 | + $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); |
|
1480 | + if ($use == 'literal') { |
|
1481 | + if ($forceType) { |
|
1482 | + $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; |
|
1483 | + } else { |
|
1484 | + $xml = "<$elementName$elementNS$elementAttrs>"; |
|
1485 | + } |
|
1486 | + } else { |
|
1487 | + $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; |
|
1488 | + } |
|
1489 | 1489 | |
1490 | - if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { |
|
1491 | - if (isset($value['!'])) { |
|
1492 | - $xml .= $value['!']; |
|
1493 | - $this->debug("in serializeType: serialized simpleContent for type $type"); |
|
1494 | - } else { |
|
1495 | - $this->debug("in serializeType: no simpleContent to serialize for type $type"); |
|
1496 | - } |
|
1497 | - } else { |
|
1498 | - // complexContent |
|
1499 | - $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); |
|
1500 | - } |
|
1501 | - $xml .= "</$elementName>"; |
|
1502 | - } else { |
|
1503 | - $this->debug("in serializeType: phpType is struct, but value is not an array"); |
|
1504 | - $this->setError("phpType is struct, but value is not an array: see debug output for details"); |
|
1505 | - $xml = ''; |
|
1506 | - } |
|
1507 | - } elseif ($phpType == 'array') { |
|
1508 | - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { |
|
1509 | - $elementNS = " xmlns=\"$ns\""; |
|
1510 | - } else { |
|
1511 | - if ($unqualified) { |
|
1512 | - $elementNS = " xmlns=\"\""; |
|
1513 | - } else { |
|
1514 | - $elementNS = ''; |
|
1515 | - } |
|
1516 | - } |
|
1517 | - if (is_null($value)) { |
|
1518 | - if ($use == 'literal') { |
|
1519 | - // TODO: depends on minOccurs |
|
1520 | - $xml = "<$name$elementNS/>"; |
|
1521 | - } else { |
|
1522 | - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . |
|
1523 | - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1524 | - ":Array\" " . |
|
1525 | - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1526 | - ':arrayType="' . |
|
1527 | - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . |
|
1528 | - ':' . |
|
1529 | - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; |
|
1530 | - } |
|
1531 | - $this->debug("in serializeType: returning: $xml"); |
|
1532 | - return $xml; |
|
1533 | - } |
|
1534 | - if (isset($typeDef['multidimensional'])) { |
|
1535 | - $nv = array(); |
|
1536 | - foreach($value as $v) { |
|
1537 | - $cols = ',' . sizeof($v); |
|
1538 | - $nv = array_merge($nv, $v); |
|
1539 | - } |
|
1540 | - $value = $nv; |
|
1541 | - } else { |
|
1542 | - $cols = ''; |
|
1543 | - } |
|
1544 | - if (is_array($value) && sizeof($value) >= 1) { |
|
1545 | - $rows = sizeof($value); |
|
1546 | - $contents = ''; |
|
1547 | - foreach($value as $k => $v) { |
|
1548 | - //$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); |
|
1549 | - //if (strpos($typeDef['arrayType'], ':') ) { |
|
1550 | - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
1551 | - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); |
|
1552 | - } else { |
|
1553 | - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); |
|
1554 | - } |
|
1555 | - } |
|
1556 | - } else { |
|
1557 | - $rows = 0; |
|
1558 | - $contents = null; |
|
1559 | - } |
|
1560 | - // TODO: for now, an empty value will be serialized as a zero element |
|
1561 | - // array. Revisit this when coding the handling of null/nil values. |
|
1562 | - if ($use == 'literal') { |
|
1563 | - $xml = "<$name$elementNS>" |
|
1564 | - .$contents |
|
1565 | - ."</$name>"; |
|
1566 | - } else { |
|
1567 | - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. |
|
1568 | - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') |
|
1569 | - .':arrayType="' |
|
1570 | - .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) |
|
1571 | - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" |
|
1572 | - .$contents |
|
1573 | - ."</$name>"; |
|
1574 | - } |
|
1575 | - } elseif ($phpType == 'scalar') { |
|
1576 | - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { |
|
1577 | - $elementNS = " xmlns=\"$ns\""; |
|
1578 | - } else { |
|
1579 | - if ($unqualified) { |
|
1580 | - $elementNS = " xmlns=\"\""; |
|
1581 | - } else { |
|
1582 | - $elementNS = ''; |
|
1583 | - } |
|
1584 | - } |
|
1585 | - if ($use == 'literal') { |
|
1586 | - if ($forceType) { |
|
1587 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1588 | - } else { |
|
1589 | - $xml = "<$name$elementNS>$value</$name>"; |
|
1590 | - } |
|
1591 | - } else { |
|
1592 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1593 | - } |
|
1594 | - } |
|
1595 | - $this->debug("in serializeType: returning: $xml"); |
|
1596 | - return $xml; |
|
1597 | - } |
|
1490 | + if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { |
|
1491 | + if (isset($value['!'])) { |
|
1492 | + $xml .= $value['!']; |
|
1493 | + $this->debug("in serializeType: serialized simpleContent for type $type"); |
|
1494 | + } else { |
|
1495 | + $this->debug("in serializeType: no simpleContent to serialize for type $type"); |
|
1496 | + } |
|
1497 | + } else { |
|
1498 | + // complexContent |
|
1499 | + $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); |
|
1500 | + } |
|
1501 | + $xml .= "</$elementName>"; |
|
1502 | + } else { |
|
1503 | + $this->debug("in serializeType: phpType is struct, but value is not an array"); |
|
1504 | + $this->setError("phpType is struct, but value is not an array: see debug output for details"); |
|
1505 | + $xml = ''; |
|
1506 | + } |
|
1507 | + } elseif ($phpType == 'array') { |
|
1508 | + if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { |
|
1509 | + $elementNS = " xmlns=\"$ns\""; |
|
1510 | + } else { |
|
1511 | + if ($unqualified) { |
|
1512 | + $elementNS = " xmlns=\"\""; |
|
1513 | + } else { |
|
1514 | + $elementNS = ''; |
|
1515 | + } |
|
1516 | + } |
|
1517 | + if (is_null($value)) { |
|
1518 | + if ($use == 'literal') { |
|
1519 | + // TODO: depends on minOccurs |
|
1520 | + $xml = "<$name$elementNS/>"; |
|
1521 | + } else { |
|
1522 | + $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . |
|
1523 | + $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1524 | + ":Array\" " . |
|
1525 | + $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1526 | + ':arrayType="' . |
|
1527 | + $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . |
|
1528 | + ':' . |
|
1529 | + $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; |
|
1530 | + } |
|
1531 | + $this->debug("in serializeType: returning: $xml"); |
|
1532 | + return $xml; |
|
1533 | + } |
|
1534 | + if (isset($typeDef['multidimensional'])) { |
|
1535 | + $nv = array(); |
|
1536 | + foreach($value as $v) { |
|
1537 | + $cols = ',' . sizeof($v); |
|
1538 | + $nv = array_merge($nv, $v); |
|
1539 | + } |
|
1540 | + $value = $nv; |
|
1541 | + } else { |
|
1542 | + $cols = ''; |
|
1543 | + } |
|
1544 | + if (is_array($value) && sizeof($value) >= 1) { |
|
1545 | + $rows = sizeof($value); |
|
1546 | + $contents = ''; |
|
1547 | + foreach($value as $k => $v) { |
|
1548 | + //$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); |
|
1549 | + //if (strpos($typeDef['arrayType'], ':') ) { |
|
1550 | + if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
1551 | + $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); |
|
1552 | + } else { |
|
1553 | + $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); |
|
1554 | + } |
|
1555 | + } |
|
1556 | + } else { |
|
1557 | + $rows = 0; |
|
1558 | + $contents = null; |
|
1559 | + } |
|
1560 | + // TODO: for now, an empty value will be serialized as a zero element |
|
1561 | + // array. Revisit this when coding the handling of null/nil values. |
|
1562 | + if ($use == 'literal') { |
|
1563 | + $xml = "<$name$elementNS>" |
|
1564 | + .$contents |
|
1565 | + ."</$name>"; |
|
1566 | + } else { |
|
1567 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. |
|
1568 | + $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') |
|
1569 | + .':arrayType="' |
|
1570 | + .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) |
|
1571 | + .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" |
|
1572 | + .$contents |
|
1573 | + ."</$name>"; |
|
1574 | + } |
|
1575 | + } elseif ($phpType == 'scalar') { |
|
1576 | + if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { |
|
1577 | + $elementNS = " xmlns=\"$ns\""; |
|
1578 | + } else { |
|
1579 | + if ($unqualified) { |
|
1580 | + $elementNS = " xmlns=\"\""; |
|
1581 | + } else { |
|
1582 | + $elementNS = ''; |
|
1583 | + } |
|
1584 | + } |
|
1585 | + if ($use == 'literal') { |
|
1586 | + if ($forceType) { |
|
1587 | + $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1588 | + } else { |
|
1589 | + $xml = "<$name$elementNS>$value</$name>"; |
|
1590 | + } |
|
1591 | + } else { |
|
1592 | + $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1593 | + } |
|
1594 | + } |
|
1595 | + $this->debug("in serializeType: returning: $xml"); |
|
1596 | + return $xml; |
|
1597 | + } |
|
1598 | 1598 | |
1599 | - /** |
|
1600 | - * serializes the attributes for a complexType |
|
1601 | - * |
|
1602 | - * @param array $typeDef our internal representation of an XML schema type (or element) |
|
1603 | - * @param mixed $value a native PHP value (parameter value) |
|
1604 | - * @param string $ns the namespace of the type |
|
1605 | - * @param string $uqType the local part of the type |
|
1606 | - * @return string value serialized as an XML string |
|
1607 | - * @access private |
|
1608 | - */ |
|
1609 | - function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { |
|
1610 | - $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); |
|
1611 | - $xml = ''; |
|
1612 | - if (isset($typeDef['extensionBase'])) { |
|
1613 | - $nsx = $this->getPrefix($typeDef['extensionBase']); |
|
1614 | - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); |
|
1615 | - if ($this->getNamespaceFromPrefix($nsx)) { |
|
1616 | - $nsx = $this->getNamespaceFromPrefix($nsx); |
|
1617 | - } |
|
1618 | - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { |
|
1619 | - $this->debug("serialize attributes for extension base $nsx:$uqTypex"); |
|
1620 | - $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); |
|
1621 | - } else { |
|
1622 | - $this->debug("extension base $nsx:$uqTypex is not a supported type"); |
|
1623 | - } |
|
1624 | - } |
|
1625 | - if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { |
|
1626 | - $this->debug("serialize attributes for XML Schema type $ns:$uqType"); |
|
1627 | - if (is_array($value)) { |
|
1628 | - $xvalue = $value; |
|
1629 | - } elseif (is_object($value)) { |
|
1630 | - $xvalue = get_object_vars($value); |
|
1631 | - } else { |
|
1632 | - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); |
|
1633 | - $xvalue = array(); |
|
1634 | - } |
|
1635 | - foreach ($typeDef['attrs'] as $aName => $attrs) { |
|
1636 | - if (isset($xvalue['!' . $aName])) { |
|
1637 | - $xname = '!' . $aName; |
|
1638 | - $this->debug("value provided for attribute $aName with key $xname"); |
|
1639 | - } elseif (isset($xvalue[$aName])) { |
|
1640 | - $xname = $aName; |
|
1641 | - $this->debug("value provided for attribute $aName with key $xname"); |
|
1642 | - } elseif (isset($attrs['default'])) { |
|
1643 | - $xname = '!' . $aName; |
|
1644 | - $xvalue[$xname] = $attrs['default']; |
|
1645 | - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); |
|
1646 | - } else { |
|
1647 | - $xname = ''; |
|
1648 | - $this->debug("no value provided for attribute $aName"); |
|
1649 | - } |
|
1650 | - if ($xname) { |
|
1651 | - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; |
|
1652 | - } |
|
1653 | - } |
|
1654 | - } else { |
|
1655 | - $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); |
|
1656 | - } |
|
1657 | - return $xml; |
|
1658 | - } |
|
1599 | + /** |
|
1600 | + * serializes the attributes for a complexType |
|
1601 | + * |
|
1602 | + * @param array $typeDef our internal representation of an XML schema type (or element) |
|
1603 | + * @param mixed $value a native PHP value (parameter value) |
|
1604 | + * @param string $ns the namespace of the type |
|
1605 | + * @param string $uqType the local part of the type |
|
1606 | + * @return string value serialized as an XML string |
|
1607 | + * @access private |
|
1608 | + */ |
|
1609 | + function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { |
|
1610 | + $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); |
|
1611 | + $xml = ''; |
|
1612 | + if (isset($typeDef['extensionBase'])) { |
|
1613 | + $nsx = $this->getPrefix($typeDef['extensionBase']); |
|
1614 | + $uqTypex = $this->getLocalPart($typeDef['extensionBase']); |
|
1615 | + if ($this->getNamespaceFromPrefix($nsx)) { |
|
1616 | + $nsx = $this->getNamespaceFromPrefix($nsx); |
|
1617 | + } |
|
1618 | + if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { |
|
1619 | + $this->debug("serialize attributes for extension base $nsx:$uqTypex"); |
|
1620 | + $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); |
|
1621 | + } else { |
|
1622 | + $this->debug("extension base $nsx:$uqTypex is not a supported type"); |
|
1623 | + } |
|
1624 | + } |
|
1625 | + if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { |
|
1626 | + $this->debug("serialize attributes for XML Schema type $ns:$uqType"); |
|
1627 | + if (is_array($value)) { |
|
1628 | + $xvalue = $value; |
|
1629 | + } elseif (is_object($value)) { |
|
1630 | + $xvalue = get_object_vars($value); |
|
1631 | + } else { |
|
1632 | + $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); |
|
1633 | + $xvalue = array(); |
|
1634 | + } |
|
1635 | + foreach ($typeDef['attrs'] as $aName => $attrs) { |
|
1636 | + if (isset($xvalue['!' . $aName])) { |
|
1637 | + $xname = '!' . $aName; |
|
1638 | + $this->debug("value provided for attribute $aName with key $xname"); |
|
1639 | + } elseif (isset($xvalue[$aName])) { |
|
1640 | + $xname = $aName; |
|
1641 | + $this->debug("value provided for attribute $aName with key $xname"); |
|
1642 | + } elseif (isset($attrs['default'])) { |
|
1643 | + $xname = '!' . $aName; |
|
1644 | + $xvalue[$xname] = $attrs['default']; |
|
1645 | + $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); |
|
1646 | + } else { |
|
1647 | + $xname = ''; |
|
1648 | + $this->debug("no value provided for attribute $aName"); |
|
1649 | + } |
|
1650 | + if ($xname) { |
|
1651 | + $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; |
|
1652 | + } |
|
1653 | + } |
|
1654 | + } else { |
|
1655 | + $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); |
|
1656 | + } |
|
1657 | + return $xml; |
|
1658 | + } |
|
1659 | 1659 | |
1660 | - /** |
|
1661 | - * serializes the elements for a complexType |
|
1662 | - * |
|
1663 | - * @param array $typeDef our internal representation of an XML schema type (or element) |
|
1664 | - * @param mixed $value a native PHP value (parameter value) |
|
1665 | - * @param string $ns the namespace of the type |
|
1666 | - * @param string $uqType the local part of the type |
|
1667 | - * @param string $use use for part (encoded|literal) |
|
1668 | - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) |
|
1669 | - * @return string value serialized as an XML string |
|
1670 | - * @access private |
|
1671 | - */ |
|
1672 | - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { |
|
1673 | - $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); |
|
1674 | - $xml = ''; |
|
1675 | - if (isset($typeDef['extensionBase'])) { |
|
1676 | - $nsx = $this->getPrefix($typeDef['extensionBase']); |
|
1677 | - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); |
|
1678 | - if ($this->getNamespaceFromPrefix($nsx)) { |
|
1679 | - $nsx = $this->getNamespaceFromPrefix($nsx); |
|
1680 | - } |
|
1681 | - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { |
|
1682 | - $this->debug("serialize elements for extension base $nsx:$uqTypex"); |
|
1683 | - $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); |
|
1684 | - } else { |
|
1685 | - $this->debug("extension base $nsx:$uqTypex is not a supported type"); |
|
1686 | - } |
|
1687 | - } |
|
1688 | - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { |
|
1689 | - $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); |
|
1690 | - if (is_array($value)) { |
|
1691 | - $xvalue = $value; |
|
1692 | - } elseif (is_object($value)) { |
|
1693 | - $xvalue = get_object_vars($value); |
|
1694 | - } else { |
|
1695 | - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); |
|
1696 | - $xvalue = array(); |
|
1697 | - } |
|
1698 | - // toggle whether all elements are present - ideally should validate against schema |
|
1699 | - if (count($typeDef['elements']) != count($xvalue)){ |
|
1700 | - $optionals = true; |
|
1701 | - } |
|
1702 | - foreach ($typeDef['elements'] as $eName => $attrs) { |
|
1703 | - if (!isset($xvalue[$eName])) { |
|
1704 | - if (isset($attrs['default'])) { |
|
1705 | - $xvalue[$eName] = $attrs['default']; |
|
1706 | - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); |
|
1707 | - } |
|
1708 | - } |
|
1709 | - // if user took advantage of a minOccurs=0, then only serialize named parameters |
|
1710 | - if (isset($optionals) |
|
1711 | - && (!isset($xvalue[$eName])) |
|
1712 | - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
1713 | - ){ |
|
1714 | - if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { |
|
1715 | - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); |
|
1716 | - } |
|
1717 | - // do nothing |
|
1718 | - $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); |
|
1719 | - } else { |
|
1720 | - // get value |
|
1721 | - if (isset($xvalue[$eName])) { |
|
1722 | - $v = $xvalue[$eName]; |
|
1723 | - } else { |
|
1724 | - $v = null; |
|
1725 | - } |
|
1726 | - if (isset($attrs['form'])) { |
|
1727 | - $unqualified = ($attrs['form'] == 'unqualified'); |
|
1728 | - } else { |
|
1729 | - $unqualified = false; |
|
1730 | - } |
|
1731 | - if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { |
|
1732 | - $vv = $v; |
|
1733 | - foreach ($vv as $k => $v) { |
|
1734 | - if (isset($attrs['type']) || isset($attrs['ref'])) { |
|
1735 | - // serialize schema-defined type |
|
1736 | - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
1737 | - } else { |
|
1738 | - // serialize generic type (can this ever really happen?) |
|
1739 | - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
1740 | - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
1741 | - } |
|
1742 | - } |
|
1743 | - } else { |
|
1744 | - if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { |
|
1745 | - // do nothing |
|
1746 | - } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { |
|
1747 | - // TODO: serialize a nil correctly, but for now serialize schema-defined type |
|
1748 | - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
1749 | - } elseif (isset($attrs['type']) || isset($attrs['ref'])) { |
|
1750 | - // serialize schema-defined type |
|
1751 | - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
1752 | - } else { |
|
1753 | - // serialize generic type (can this ever really happen?) |
|
1754 | - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
1755 | - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
1756 | - } |
|
1757 | - } |
|
1758 | - } |
|
1759 | - } |
|
1760 | - } else { |
|
1761 | - $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); |
|
1762 | - } |
|
1763 | - return $xml; |
|
1764 | - } |
|
1660 | + /** |
|
1661 | + * serializes the elements for a complexType |
|
1662 | + * |
|
1663 | + * @param array $typeDef our internal representation of an XML schema type (or element) |
|
1664 | + * @param mixed $value a native PHP value (parameter value) |
|
1665 | + * @param string $ns the namespace of the type |
|
1666 | + * @param string $uqType the local part of the type |
|
1667 | + * @param string $use use for part (encoded|literal) |
|
1668 | + * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) |
|
1669 | + * @return string value serialized as an XML string |
|
1670 | + * @access private |
|
1671 | + */ |
|
1672 | + function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { |
|
1673 | + $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); |
|
1674 | + $xml = ''; |
|
1675 | + if (isset($typeDef['extensionBase'])) { |
|
1676 | + $nsx = $this->getPrefix($typeDef['extensionBase']); |
|
1677 | + $uqTypex = $this->getLocalPart($typeDef['extensionBase']); |
|
1678 | + if ($this->getNamespaceFromPrefix($nsx)) { |
|
1679 | + $nsx = $this->getNamespaceFromPrefix($nsx); |
|
1680 | + } |
|
1681 | + if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { |
|
1682 | + $this->debug("serialize elements for extension base $nsx:$uqTypex"); |
|
1683 | + $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); |
|
1684 | + } else { |
|
1685 | + $this->debug("extension base $nsx:$uqTypex is not a supported type"); |
|
1686 | + } |
|
1687 | + } |
|
1688 | + if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { |
|
1689 | + $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); |
|
1690 | + if (is_array($value)) { |
|
1691 | + $xvalue = $value; |
|
1692 | + } elseif (is_object($value)) { |
|
1693 | + $xvalue = get_object_vars($value); |
|
1694 | + } else { |
|
1695 | + $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); |
|
1696 | + $xvalue = array(); |
|
1697 | + } |
|
1698 | + // toggle whether all elements are present - ideally should validate against schema |
|
1699 | + if (count($typeDef['elements']) != count($xvalue)){ |
|
1700 | + $optionals = true; |
|
1701 | + } |
|
1702 | + foreach ($typeDef['elements'] as $eName => $attrs) { |
|
1703 | + if (!isset($xvalue[$eName])) { |
|
1704 | + if (isset($attrs['default'])) { |
|
1705 | + $xvalue[$eName] = $attrs['default']; |
|
1706 | + $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); |
|
1707 | + } |
|
1708 | + } |
|
1709 | + // if user took advantage of a minOccurs=0, then only serialize named parameters |
|
1710 | + if (isset($optionals) |
|
1711 | + && (!isset($xvalue[$eName])) |
|
1712 | + && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
1713 | + ){ |
|
1714 | + if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { |
|
1715 | + $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); |
|
1716 | + } |
|
1717 | + // do nothing |
|
1718 | + $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); |
|
1719 | + } else { |
|
1720 | + // get value |
|
1721 | + if (isset($xvalue[$eName])) { |
|
1722 | + $v = $xvalue[$eName]; |
|
1723 | + } else { |
|
1724 | + $v = null; |
|
1725 | + } |
|
1726 | + if (isset($attrs['form'])) { |
|
1727 | + $unqualified = ($attrs['form'] == 'unqualified'); |
|
1728 | + } else { |
|
1729 | + $unqualified = false; |
|
1730 | + } |
|
1731 | + if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { |
|
1732 | + $vv = $v; |
|
1733 | + foreach ($vv as $k => $v) { |
|
1734 | + if (isset($attrs['type']) || isset($attrs['ref'])) { |
|
1735 | + // serialize schema-defined type |
|
1736 | + $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
1737 | + } else { |
|
1738 | + // serialize generic type (can this ever really happen?) |
|
1739 | + $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
1740 | + $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
1741 | + } |
|
1742 | + } |
|
1743 | + } else { |
|
1744 | + if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { |
|
1745 | + // do nothing |
|
1746 | + } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { |
|
1747 | + // TODO: serialize a nil correctly, but for now serialize schema-defined type |
|
1748 | + $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
1749 | + } elseif (isset($attrs['type']) || isset($attrs['ref'])) { |
|
1750 | + // serialize schema-defined type |
|
1751 | + $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
1752 | + } else { |
|
1753 | + // serialize generic type (can this ever really happen?) |
|
1754 | + $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
1755 | + $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
1756 | + } |
|
1757 | + } |
|
1758 | + } |
|
1759 | + } |
|
1760 | + } else { |
|
1761 | + $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); |
|
1762 | + } |
|
1763 | + return $xml; |
|
1764 | + } |
|
1765 | 1765 | |
1766 | - /** |
|
1767 | - * adds an XML Schema complex type to the WSDL types |
|
1768 | - * |
|
1769 | - * @param string $name |
|
1770 | - * @param string $typeClass (complexType|simpleType|attribute) |
|
1771 | - * @param string $phpType currently supported are array and struct (php assoc array) |
|
1772 | - * @param string $compositor (all|sequence|choice) |
|
1773 | - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
1774 | - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) |
|
1775 | - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) |
|
1776 | - * @param string $arrayType as namespace:name (xsd:string) |
|
1777 | - * @see nusoap_xmlschema |
|
1778 | - * @access public |
|
1779 | - */ |
|
1780 | - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { |
|
1781 | - if (count($elements) > 0) { |
|
1782 | - $eElements = array(); |
|
1783 | - foreach($elements as $n => $e){ |
|
1784 | - // expand each element |
|
1785 | - $ee = array(); |
|
1786 | - foreach ($e as $k => $v) { |
|
1787 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1788 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1789 | - $ee[$k] = $v; |
|
1790 | - } |
|
1791 | - $eElements[$n] = $ee; |
|
1792 | - } |
|
1793 | - $elements = $eElements; |
|
1794 | - } |
|
1766 | + /** |
|
1767 | + * adds an XML Schema complex type to the WSDL types |
|
1768 | + * |
|
1769 | + * @param string $name |
|
1770 | + * @param string $typeClass (complexType|simpleType|attribute) |
|
1771 | + * @param string $phpType currently supported are array and struct (php assoc array) |
|
1772 | + * @param string $compositor (all|sequence|choice) |
|
1773 | + * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
1774 | + * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) |
|
1775 | + * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) |
|
1776 | + * @param string $arrayType as namespace:name (xsd:string) |
|
1777 | + * @see nusoap_xmlschema |
|
1778 | + * @access public |
|
1779 | + */ |
|
1780 | + function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { |
|
1781 | + if (count($elements) > 0) { |
|
1782 | + $eElements = array(); |
|
1783 | + foreach($elements as $n => $e){ |
|
1784 | + // expand each element |
|
1785 | + $ee = array(); |
|
1786 | + foreach ($e as $k => $v) { |
|
1787 | + $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1788 | + $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1789 | + $ee[$k] = $v; |
|
1790 | + } |
|
1791 | + $eElements[$n] = $ee; |
|
1792 | + } |
|
1793 | + $elements = $eElements; |
|
1794 | + } |
|
1795 | 1795 | |
1796 | - if (count($attrs) > 0) { |
|
1797 | - foreach($attrs as $n => $a){ |
|
1798 | - // expand each attribute |
|
1799 | - foreach ($a as $k => $v) { |
|
1800 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1801 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1802 | - $aa[$k] = $v; |
|
1803 | - } |
|
1804 | - $eAttrs[$n] = $aa; |
|
1805 | - } |
|
1806 | - $attrs = $eAttrs; |
|
1807 | - } |
|
1796 | + if (count($attrs) > 0) { |
|
1797 | + foreach($attrs as $n => $a){ |
|
1798 | + // expand each attribute |
|
1799 | + foreach ($a as $k => $v) { |
|
1800 | + $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1801 | + $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1802 | + $aa[$k] = $v; |
|
1803 | + } |
|
1804 | + $eAttrs[$n] = $aa; |
|
1805 | + } |
|
1806 | + $attrs = $eAttrs; |
|
1807 | + } |
|
1808 | 1808 | |
1809 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1810 | - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; |
|
1809 | + $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1810 | + $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; |
|
1811 | 1811 | |
1812 | - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
|
1813 | - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); |
|
1814 | - } |
|
1812 | + $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
|
1813 | + $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); |
|
1814 | + } |
|
1815 | 1815 | |
1816 | - /** |
|
1817 | - * adds an XML Schema simple type to the WSDL types |
|
1818 | - * |
|
1819 | - * @param string $name |
|
1820 | - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
1821 | - * @param string $typeClass (should always be simpleType) |
|
1822 | - * @param string $phpType (should always be scalar) |
|
1823 | - * @param array $enumeration array of values |
|
1824 | - * @see nusoap_xmlschema |
|
1825 | - * @access public |
|
1826 | - */ |
|
1827 | - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { |
|
1828 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1816 | + /** |
|
1817 | + * adds an XML Schema simple type to the WSDL types |
|
1818 | + * |
|
1819 | + * @param string $name |
|
1820 | + * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
1821 | + * @param string $typeClass (should always be simpleType) |
|
1822 | + * @param string $phpType (should always be scalar) |
|
1823 | + * @param array $enumeration array of values |
|
1824 | + * @see nusoap_xmlschema |
|
1825 | + * @access public |
|
1826 | + */ |
|
1827 | + function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { |
|
1828 | + $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1829 | 1829 | |
1830 | - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
|
1831 | - $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); |
|
1832 | - } |
|
1830 | + $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
|
1831 | + $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); |
|
1832 | + } |
|
1833 | 1833 | |
1834 | - /** |
|
1835 | - * adds an element to the WSDL types |
|
1836 | - * |
|
1837 | - * @param array $attrs attributes that must include name and type |
|
1838 | - * @see nusoap_xmlschema |
|
1839 | - * @access public |
|
1840 | - */ |
|
1841 | - function addElement($attrs) { |
|
1842 | - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
|
1843 | - $this->schemas[$typens][0]->addElement($attrs); |
|
1844 | - } |
|
1834 | + /** |
|
1835 | + * adds an element to the WSDL types |
|
1836 | + * |
|
1837 | + * @param array $attrs attributes that must include name and type |
|
1838 | + * @see nusoap_xmlschema |
|
1839 | + * @access public |
|
1840 | + */ |
|
1841 | + function addElement($attrs) { |
|
1842 | + $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
|
1843 | + $this->schemas[$typens][0]->addElement($attrs); |
|
1844 | + } |
|
1845 | 1845 | |
1846 | - /** |
|
1847 | - * register an operation with the server |
|
1848 | - * |
|
1849 | - * @param string $name operation (method) name |
|
1850 | - * @param array $in assoc array of input values: key = param name, value = param type |
|
1851 | - * @param array $out assoc array of output values: key = param name, value = param type |
|
1852 | - * @param string $namespace optional The namespace for the operation |
|
1853 | - * @param string $soapaction optional The soapaction for the operation |
|
1854 | - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically |
|
1855 | - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) |
|
1856 | - * @param string $documentation optional The description to include in the WSDL |
|
1857 | - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
|
1858 | - * @access public |
|
1859 | - */ |
|
1860 | - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ |
|
1861 | - if ($use == 'encoded' && $encodingStyle == '') { |
|
1862 | - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
|
1863 | - } |
|
1846 | + /** |
|
1847 | + * register an operation with the server |
|
1848 | + * |
|
1849 | + * @param string $name operation (method) name |
|
1850 | + * @param array $in assoc array of input values: key = param name, value = param type |
|
1851 | + * @param array $out assoc array of output values: key = param name, value = param type |
|
1852 | + * @param string $namespace optional The namespace for the operation |
|
1853 | + * @param string $soapaction optional The soapaction for the operation |
|
1854 | + * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically |
|
1855 | + * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) |
|
1856 | + * @param string $documentation optional The description to include in the WSDL |
|
1857 | + * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
|
1858 | + * @access public |
|
1859 | + */ |
|
1860 | + function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ |
|
1861 | + if ($use == 'encoded' && $encodingStyle == '') { |
|
1862 | + $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
|
1863 | + } |
|
1864 | 1864 | |
1865 | - if ($style == 'document') { |
|
1866 | - $elements = array(); |
|
1867 | - foreach ($in as $n => $t) { |
|
1868 | - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
|
1869 | - } |
|
1870 | - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); |
|
1871 | - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); |
|
1872 | - $in = array('parameters' => 'tns:' . $name . '^'); |
|
1865 | + if ($style == 'document') { |
|
1866 | + $elements = array(); |
|
1867 | + foreach ($in as $n => $t) { |
|
1868 | + $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
|
1869 | + } |
|
1870 | + $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); |
|
1871 | + $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); |
|
1872 | + $in = array('parameters' => 'tns:' . $name . '^'); |
|
1873 | 1873 | |
1874 | - $elements = array(); |
|
1875 | - foreach ($out as $n => $t) { |
|
1876 | - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
|
1877 | - } |
|
1878 | - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); |
|
1879 | - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); |
|
1880 | - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); |
|
1881 | - } |
|
1874 | + $elements = array(); |
|
1875 | + foreach ($out as $n => $t) { |
|
1876 | + $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
|
1877 | + } |
|
1878 | + $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); |
|
1879 | + $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); |
|
1880 | + $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); |
|
1881 | + } |
|
1882 | 1882 | |
1883 | - // get binding |
|
1884 | - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = |
|
1885 | - array( |
|
1886 | - 'name' => $name, |
|
1887 | - 'binding' => $this->serviceName . 'Binding', |
|
1888 | - 'endpoint' => $this->endpoint, |
|
1889 | - 'soapAction' => $soapaction, |
|
1890 | - 'style' => $style, |
|
1891 | - 'input' => array( |
|
1892 | - 'use' => $use, |
|
1893 | - 'namespace' => $namespace, |
|
1894 | - 'encodingStyle' => $encodingStyle, |
|
1895 | - 'message' => $name . 'Request', |
|
1896 | - 'parts' => $in), |
|
1897 | - 'output' => array( |
|
1898 | - 'use' => $use, |
|
1899 | - 'namespace' => $namespace, |
|
1900 | - 'encodingStyle' => $encodingStyle, |
|
1901 | - 'message' => $name . 'Response', |
|
1902 | - 'parts' => $out), |
|
1903 | - 'namespace' => $namespace, |
|
1904 | - 'transport' => 'http://schemas.xmlsoap.org/soap/http', |
|
1905 | - 'documentation' => $documentation); |
|
1906 | - // add portTypes |
|
1907 | - // add messages |
|
1908 | - if($in) |
|
1909 | - { |
|
1910 | - foreach($in as $pName => $pType) |
|
1911 | - { |
|
1912 | - if(strpos($pType,':')) { |
|
1913 | - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
|
1914 | - } |
|
1915 | - $this->messages[$name.'Request'][$pName] = $pType; |
|
1916 | - } |
|
1917 | - } else { |
|
1883 | + // get binding |
|
1884 | + $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = |
|
1885 | + array( |
|
1886 | + 'name' => $name, |
|
1887 | + 'binding' => $this->serviceName . 'Binding', |
|
1888 | + 'endpoint' => $this->endpoint, |
|
1889 | + 'soapAction' => $soapaction, |
|
1890 | + 'style' => $style, |
|
1891 | + 'input' => array( |
|
1892 | + 'use' => $use, |
|
1893 | + 'namespace' => $namespace, |
|
1894 | + 'encodingStyle' => $encodingStyle, |
|
1895 | + 'message' => $name . 'Request', |
|
1896 | + 'parts' => $in), |
|
1897 | + 'output' => array( |
|
1898 | + 'use' => $use, |
|
1899 | + 'namespace' => $namespace, |
|
1900 | + 'encodingStyle' => $encodingStyle, |
|
1901 | + 'message' => $name . 'Response', |
|
1902 | + 'parts' => $out), |
|
1903 | + 'namespace' => $namespace, |
|
1904 | + 'transport' => 'http://schemas.xmlsoap.org/soap/http', |
|
1905 | + 'documentation' => $documentation); |
|
1906 | + // add portTypes |
|
1907 | + // add messages |
|
1908 | + if($in) |
|
1909 | + { |
|
1910 | + foreach($in as $pName => $pType) |
|
1911 | + { |
|
1912 | + if(strpos($pType,':')) { |
|
1913 | + $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
|
1914 | + } |
|
1915 | + $this->messages[$name.'Request'][$pName] = $pType; |
|
1916 | + } |
|
1917 | + } else { |
|
1918 | 1918 | $this->messages[$name.'Request']= '0'; |
1919 | 1919 | } |
1920 | - if($out) |
|
1921 | - { |
|
1922 | - foreach($out as $pName => $pType) |
|
1923 | - { |
|
1924 | - if(strpos($pType,':')) { |
|
1925 | - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
|
1926 | - } |
|
1927 | - $this->messages[$name.'Response'][$pName] = $pType; |
|
1928 | - } |
|
1929 | - } else { |
|
1920 | + if($out) |
|
1921 | + { |
|
1922 | + foreach($out as $pName => $pType) |
|
1923 | + { |
|
1924 | + if(strpos($pType,':')) { |
|
1925 | + $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
|
1926 | + } |
|
1927 | + $this->messages[$name.'Response'][$pName] = $pType; |
|
1928 | + } |
|
1929 | + } else { |
|
1930 | 1930 | $this->messages[$name.'Response']= '0'; |
1931 | 1931 | } |
1932 | - return true; |
|
1933 | - } |
|
1932 | + return true; |
|
1933 | + } |
|
1934 | 1934 | } |
1935 | 1935 | |
1936 | 1936 | ?> |