87    #var $soap_defencoding = 'ISO-8859-1'; 
   96                'SOAP-ENV' => 
'http://schemas.xmlsoap.org/soap/envelope/',
 
   97                'xsd' => 
'http://www.w3.org/2001/XMLSchema',
 
   98                'xsi' => 
'http://www.w3.org/2001/XMLSchema-instance',
 
   99                'SOAP-ENC' => 
'http://schemas.xmlsoap.org/soap/encoding/',
 
  100                'si' => 
'http://soapinterop.org/xsd');
 
  111        'http://www.w3.org/2001/XMLSchema' => array(
 
  112                'string'=>
'string',
'boolean'=>
'boolean',
'float'=>
'double',
'double'=>
'double',
'decimal'=>
'double',
 
  113                'duration'=>
'',
'dateTime'=>
'string',
'time'=>
'string',
'date'=>
'string',
'gYearMonth'=>
'',
 
  114                'gYear'=>
'',
'gMonthDay'=>
'',
'gDay'=>
'',
'gMonth'=>
'',
'hexBinary'=>
'string',
'base64Binary'=>
'string',
 
  116                'normalizedString'=>
'string',
'token'=>
'string',
'language'=>
'',
'NMTOKEN'=>
'',
'NMTOKENS'=>
'',
'Name'=>
'',
'NCName'=>
'',
'ID'=>
'',
 
  117                'IDREF'=>
'',
'IDREFS'=>
'',
'ENTITY'=>
'',
'ENTITIES'=>
'',
'integer'=>
'integer',
'nonPositiveInteger'=>
'integer',
 
  118                'negativeInteger'=>
'integer',
'long'=>
'integer',
'int'=>
'integer',
'short'=>
'integer',
'byte'=>
'integer',
'nonNegativeInteger'=>
'integer',
 
  119                'unsignedLong'=>
'',
'unsignedInt'=>
'',
'unsignedShort'=>
'',
'unsignedByte'=>
'',
'positiveInteger'=>
''),
 
  120        'http://www.w3.org/1999/XMLSchema' => array(
 
  121                'i4'=>
'',
'int'=>
'integer',
'boolean'=>
'boolean',
'string'=>
'string',
'double'=>
'double',
 
  122                'float'=>
'double',
'dateTime'=>
'string',
 
  123                'timeInstant'=>
'string',
'base64Binary'=>
'string',
'base64'=>
'string',
'ur-type'=>
'array'),
 
  124        'http://soapinterop.org/xsd' => array(
'SOAPStruct'=>
'struct'),
 
  125        'http://schemas.xmlsoap.org/soap/encoding/' => array(
'base64'=>
'string',
'array'=>
'array',
'Array'=>
'array'),
 
  126    'http://xml.apache.org/xml-soap' => array(
'Map')
 
  136                'lt' => 
'<',
'gt' => 
'>',
'apos' => 
"'");
 
  145                $this->debug_str .= get_class($this).
": $string\n";
 
  155                if ($this->charencoding) {
 
  156                $val = str_replace(
'&', 
'&', $val);
 
  157                $val = str_replace(
"'", 
''', $val);
 
  158                $val = str_replace(
'"', 
'"', $val);
 
  159                $val = str_replace(
'<', 
'<', $val);
 
  160                $val = str_replace(
'>', 
'>', $val);
 
  172                if($this->error_str != 
''){
 
  185                $this->error_str = $str;
 
  196        $keyList = array_keys($val);
 
  197                foreach ($keyList as $keyListValue) {
 
  198                        if (!is_int($keyListValue)) {
 
  199                                return 'arrayStruct';
 
  202                return 'arraySimple';
 
  213        if(is_object($val) && get_class($val) == 
'soapval'){
 
  214                return $val->serialize($use);
 
  216                $this->
debug( 
"in serialize_val: $val, $name, $type, $name_ns, $type_ns, $attributes, $use");
 
  222                        $prefix = 
'nu'.rand(1000,9999);
 
  224                        $xmlns .= 
" xmlns:$prefix=\"$name_ns\"";
 
  227                if($type_ns != 
'' && $type_ns == $this->namespaces[
'xsd']){
 
  230                        $type_prefix = 
'xsd';
 
  232                        $type_prefix = 
'ns'.rand(1000,9999);
 
  233                        $xmlns .= 
" xmlns:$type_prefix=\"$type_ns\"";
 
  239                                $atts .= 
" $k=\"$v\"";
 
  243        if(
$type != 
'' && isset($this->typemap[$this->XMLSchemaVersion][
$type])){
 
  245                        if (
$type == 
'boolean') {
 
  246                                $val = $val ? 
'true' : 
'false';
 
  250                        } 
else if (is_string($val)) {
 
  253                        if ($use == 
'literal') {
 
  254                        return "<$name$xmlns>$val</$name>";
 
  256                        return "<$name$xmlns xsi:type=\"xsd:$type\">$val</$name>";
 
  262                        case (
$type == 
'' && is_null($val)):
 
  263                                if ($use == 
'literal') {
 
  265                                        $xml .= 
"<$name$xmlns/>";
 
  267                                        $xml .= 
"<$name$xmlns xsi:nil=\"true\"/>";
 
  270                        case (is_bool($val) || 
$type == 
'boolean'):
 
  271                        if (
$type == 
'boolean') {
 
  272                                $val = $val ? 
'true' : 
'false';
 
  276                                if ($use == 
'literal') {
 
  277                                        $xml .= 
"<$name$xmlns $atts>$val</$name>";
 
  279                                        $xml .= 
"<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
 
  282                        case (is_int($val) || is_long($val) || 
$type == 
'int'):
 
  283                                if ($use == 
'literal') {
 
  284                                        $xml .= 
"<$name$xmlns $atts>$val</$name>";
 
  286                                        $xml .= 
"<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
 
  289                        case (is_float($val)|| is_double($val) || 
$type == 
'float'):
 
  290                                if ($use == 
'literal') {
 
  291                                        $xml .= 
"<$name$xmlns $atts>$val</$name>";
 
  293                                        $xml .= 
"<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
 
  296                        case (is_string($val) || 
$type == 
'string'):
 
  298                                if ($use == 
'literal') {
 
  299                                        $xml .= 
"<$name$xmlns $atts>$val</$name>";
 
  301                                        $xml .= 
"<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
 
  304                        case is_object($val):
 
  305                                $name = get_class($val);
 
  306                                foreach(get_object_vars($val) as $k => $v){
 
  307                                        $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,
false,
false,
false,
false,$use) : $this->
serialize_val($v,$k,
false,
false,
false,
false,$use);
 
  309                                $xml .= 
'<'.$name.
'>'.$pXml.
'</'.
$name.
'>';
 
  312                        case (is_array($val) || 
$type):
 
  315                if($valueType==
'arraySimple' || ereg(
'^ArrayOf',
$type)){
 
  317                                        if(is_array($val) && count($val)> 0){
 
  319                                if(is_object($v) && get_class($v) ==  
'soapval'){
 
  320                                                                $tt_ns = $v->type_ns;
 
  322                                                        } elseif (is_array($v)) {
 
  327                                                        $array_types[$tt] = 1;
 
  331                                                if(count($array_types) > 1){
 
  332                                                        $array_typename = 
'xsd:ur-type';
 
  333                                                } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
 
  334                                                        if ($tt == 
'integer') {
 
  337                                                        $array_typename = 
'xsd:'.$tt;
 
  338                                                } elseif(isset($tt) && $tt == 
'arraySimple'){
 
  339                                                        $array_typename = 
'SOAP-ENC:Array';
 
  340                                                } elseif(isset($tt) && $tt == 
'arrayStruct'){
 
  341                                                        $array_typename = 
'unnamed_struct_use_soapval';
 
  344                                                        if ($tt_ns != 
'' && $tt_ns == $this->namespaces[
'xsd']){
 
  345                                                                 $array_typename = 
'xsd:' . $tt;
 
  347                                                                $tt_prefix = 
'ns' . rand(1000, 9999);
 
  348                                                                $array_typename = 
"$tt_prefix:$tt";
 
  349                                                                $xmlns .= 
" xmlns:$tt_prefix=\"$tt_ns\"";
 
  351                                                                $array_typename = $tt;
 
  355                                                if ($use == 
'literal') {
 
  357                                                } 
else if (isset(
$type) && isset($type_prefix)) {
 
  358                                                        $type_str = 
" xsi:type=\"$type_prefix:$type\"";
 
  360                                                        $type_str = 
" xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename.
"[$array_type]\"";
 
  364                                                if ($use == 
'literal') {
 
  366                                                } 
else if (isset(
$type) && isset($type_prefix)) {
 
  367                                                        $type_str = 
" xsi:type=\"$type_prefix:$type\"";
 
  369                                                        $type_str = 
" xsi:type=\"SOAP-ENC:Array\"";
 
  372                                        $xml = 
"<$name$xmlns$type_str$atts>".$xml.
"</$name>";
 
  375                                        if(isset(
$type) && isset($type_prefix)){
 
  376                                                $type_str = 
" xsi:type=\"$type_prefix:$type\"";
 
  380                                        if ($use == 
'literal') {
 
  381                                                $xml .= 
"<$name$xmlns $atts>";
 
  383                                                $xml .= 
"<$name$xmlns$type_str$atts>";
 
  385                                        foreach($val as $k => $v){
 
  387                                                if (
$type == 
'Map' && $type_ns == 
'http://xml.apache.org/xml-soap') {
 
  400                                $xml .= 
'not detected, got '.gettype($val).
' for '.$val;
 
  424        foreach(array_merge($this->namespaces,
$namespaces) as $k => $v){
 
  425                $ns_string .= 
" xmlns:$k=\"$v\"";
 
  427        if($style == 
'rpc' && $use == 
'encoded') {
 
  428                $ns_string = 
' SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ns_string;
 
  433                $headers = 
"<SOAP-ENV:Header>".$headers.
"</SOAP-ENV:Header>";
 
  437        '<?xml version="1.0" encoding="'.$this->soap_defencoding .
'"?'.
">".
 
  438        '<SOAP-ENV:Envelope'.$ns_string.
">".
 
  443        "</SOAP-ENV:Envelope>";
 
  447                $str = htmlspecialchars($str);
 
  461                if (strrpos($qname, 
':')) {
 
  463                        $name = substr($qname, strrpos($qname, 
':') + 1);
 
  465                        $ns = substr($qname, 0, strrpos($qname, 
':'));
 
  468                                return $p . 
':' . 
$name;
 
  485                if(strpos($qname,
':') && !ereg(
'^http://',$qname)){
 
  487                        $name = substr(strstr($qname,
':'),1);
 
  489                        $prefix = substr($qname,0,strpos($qname,
':'));
 
  490                        if(isset($this->namespaces[$prefix])){
 
  491                                return $this->namespaces[$prefix].
':'.
$name;
 
  509                if($sstr = strrchr($str,
':')){
 
  511                        return substr( $sstr, 1 );
 
  526                if($pos = strrpos($str,
':')){
 
  528                        return substr($str,0,$pos);
 
  542                if (isset($this->namespaces[$prefix])) {
 
  543                        return $this->namespaces[$prefix];
 
  558                foreach ($this->namespaces as $p => 
$n) {
 
  559                        if ($ns == 
$n || $ns == $p) {
 
  560                            $this->usedNamespaces[$p] = 
$n;
 
  570                $ret_val = ob_get_contents();
 
  596                '([0-9]{2})(\.[0-9]*)?'. 
 
  597                '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; 
 
  599                if(ereg($eregStr,$datestr,$regs)){
 
  600                        return sprintf(
'%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
 
  622        '([0-9]{2})(\.[0-9]+)?'. 
 
  623        '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; 
 
  624        if(ereg($eregStr,$datestr,$regs)){
 
  627                        $op = substr($regs[8],0,1);
 
  628                        $h = substr($regs[8],1,2);
 
  629                        $m = substr($regs[8],strlen($regs[8])-2,2);
 
  631                                $regs[4] = $regs[4] + $h;
 
  632                                $regs[5] = $regs[5] + $m;
 
  633                        } elseif($op == 
'+'){
 
  634                                $regs[4] = $regs[4] - $h;
 
  635                                $regs[5] = $regs[5] - $m;
 
  638                return strtotime(
"$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z");
 
  646        $start = gettimeofday();
 
  650                $stop = gettimeofday();
 
  651                $timePassed = 1000000 * ($stop[
'sec'] - $start[
'sec'])
 
  652                + $stop[
'usec'] - $start[
'usec'];
 
  654        while ($timePassed < $usec);
 
  698                foreach($this->namespaces as $k => $v){
 
  699                        $ns_string .= 
"\n  xmlns:$k=\"$v\"";
 
  702                        '<?xml version="1.0" encoding="'.$this->soap_defencoding.
'"?>'.
 
  703                        '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.
">\n".
 
  706                                        '<faultcode>'.$this->expandEntities($this->faultcode).
'</faultcode>'.
 
  707                                        '<faultactor>'.$this->expandEntities($this->faultactor).
'</faultactor>'.
 
  708                                        '<faultstring>'.$this->expandEntities($this->faultstring).
'</faultstring>'.
 
  709                                        '<detail>'.$this->serialize_val($this->faultdetail).
'</detail>'.
 
  712                        '</SOAP-ENV:Envelope>';
 
  772                $this->
debug(
'xmlschema class instantiated, inside constructor');
 
  779                $this->namespaces = array_merge($this->namespaces, 
$namespaces);
 
  783                        $this->
debug(
'initial schema file: '.$schema);
 
  789                        $this->
debug(
'initial xml file: '.$xml);
 
  806                        $xmlStr = @join(
"",@file(
$xml));
 
  808                                $msg = 
'Error reading XML from '.$xml;
 
  813                                $this->
debug(
"parsing $xml");
 
  815                                $this->
debug(
"done parsing $xml");
 
  834                $this->parser = xml_parser_create();
 
  836                xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
 
  839                xml_set_object($this->parser, $this);
 
  842                        if(
$type == 
"schema"){
 
  843                        xml_set_element_handler($this->parser, 
'schemaStartElement',
'schemaEndElement');
 
  844                        xml_set_character_data_handler($this->parser,
'schemaCharacterData');
 
  845                        } elseif(
$type == 
"xml"){
 
  846                                xml_set_element_handler($this->parser, 
'xmlStartElement',
'xmlEndElement');
 
  847                        xml_set_character_data_handler($this->parser,
'xmlCharacterData');
 
  851                    if(!xml_parse($this->parser,
$xml,
true)){
 
  853                                $errstr = sprintf(
'XML error parsing XML schema on line %d: %s',
 
  854                                xml_get_current_line_number($this->parser),
 
  855                                xml_error_string(xml_get_error_code($this->parser))
 
  857                                $this->
debug($errstr);
 
  858                                $this->
debug(
"XML payload:\n" . $xml);
 
  862                        xml_parser_free($this->parser);
 
  864                        $this->
debug(
'no xml passed to parseString()!!');
 
  865                        $this->
setError(
'no xml passed to parseString()!!');
 
  880                $pos = $this->position++;
 
  883                $this->depth_array[
$depth] = $pos;
 
  884                $this->message[$pos] = array(
'cdata' => 
''); 
 
  886                        $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[
$depth - 1]];
 
  888                        $this->defaultNamespace[$pos] = 
false;
 
  900        if(count($attrs) > 0){
 
  901                foreach($attrs as $k => $v){
 
  903                                if(ereg(
"^xmlns",$k)){
 
  906                        if($ns_prefix = substr(strrchr($k,
':'),1)){
 
  908                                                $this->namespaces[$ns_prefix] = $v;
 
  910                                                $this->defaultNamespace[$pos] = $v;
 
  912                                                        $this->namespaces[
'ns'.(count($this->namespaces)+1)] = $v;
 
  915                                        if($v == 
'http://www.w3.org/2001/XMLSchema' || $v == 
'http://www.w3.org/1999/XMLSchema'){
 
  916                                                $this->XMLSchemaVersion = $v;
 
  917                                                $this->namespaces[
'xsi'] = $v.
'-instance';
 
  921                foreach($attrs as $k => $v){
 
  944                $this->
xdebug(
"parsing attribute " . $this->
varDump($attrs));
 
  945                if (isset($attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
 
  946                                        $v = $attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'];
 
  947                                        if (!strpos($v, 
':')) {
 
  949                                                if ($this->defaultNamespace[$pos]) {
 
  951                                                        $attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . 
':' . $attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'];
 
  955                if(isset($attrs[
'name'])){
 
  956                                        $this->attributes[$attrs[
'name']] = $attrs;
 
  957                                        $aname = $attrs[
'name'];
 
  958                                } elseif(isset($attrs[
'ref']) && $attrs[
'ref'] == 
'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
 
  959                                        if (isset($attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
 
  960                                $aname = $attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'];
 
  964                                } elseif(isset($attrs[
'ref'])){
 
  965                                        $aname = $attrs[
'ref'];
 
  966                    $this->attributes[$attrs[
'ref']] = $attrs;
 
  969                                if(isset($this->currentComplexType)){
 
  971                                } elseif(isset($this->currentElement)){
 
  975                                if(isset($attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->
getLocalPart($aname) == 
'arrayType'){
 
  978                                        if(isset($attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'])){
 
  979                                                $v = $attrs[
'http://schemas.xmlsoap.org/wsdl/:arrayType'];
 
  983                    if(strpos($v,
'[,]')){
 
  986                    $v = substr($v,0,strpos($v,
'[')); 
 
  987                    if(!strpos($v,
':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
 
  988                        $v = $this->XMLSchemaVersion.
':'.$v;
 
  994                                if(isset($attrs[
'name'])){
 
  995                                        $this->
xdebug(
'processing named complexType '.$attrs[
'name']);
 
  996                                        $this->currentElement = 
false;
 
  997                                        $this->currentComplexType = $attrs[
'name'];
 
 1000                                        if(isset($attrs[
'base']) && ereg(
':Array$',$attrs[
'base'])){
 
 1006                                        $this->
xdebug(
'processing unnamed complexType for element '.$this->currentElement);
 
 1007                                        $this->currentComplexType = $this->currentElement . 
'_ContainedType';
 
 1008                                        $this->currentElement = 
false;
 
 1011                                        if(isset($attrs[
'base']) && ereg(
':Array$',$attrs[
'base'])){
 
 1022                                if(isset($attrs[
'type'])){
 
 1023                                        $this->
xdebug(
"processing typed element ".$attrs[
'name'].
" of type ".$attrs[
'type']);
 
 1024                                        $this->currentElement = $attrs[
'name'];
 
 1025                                        $this->elements[ $attrs[
'name'] ] = $attrs;
 
 1026                                        $this->elements[ $attrs[
'name'] ][
'typeClass'] = 
'element';
 
 1027                                        if (!isset($this->elements[ $attrs[
'name'] ][
'form'])) {
 
 1028                                                $this->elements[ $attrs[
'name'] ][
'form'] = $this->schemaInfo[
'elementFormDefault'];
 
 1030                                        $ename = $attrs[
'name'];
 
 1031                                } elseif(isset($attrs[
'ref'])){
 
 1032                                        $ename = $attrs[
'ref'];
 
 1034                                        $this->
xdebug(
"processing untyped element ".$attrs[
'name']);
 
 1035                                        $this->currentElement = $attrs[
'name'];
 
 1036                                        $this->elements[ $attrs[
'name'] ] = $attrs;
 
 1037                                        $this->elements[ $attrs[
'name'] ][
'typeClass'] = 
'element';
 
 1038                                        $this->elements[ $attrs[
'name'] ][
'type'] = $this->schemaTargetNamespace . 
':' . $attrs[
'name'] . 
'_ContainedType';
 
 1039                                        if (!isset($this->elements[ $attrs[
'name'] ][
'form'])) {
 
 1040                                                $this->elements[ $attrs[
'name'] ][
'form'] = $this->schemaInfo[
'elementFormDefault'];
 
 1043                                if(isset($ename) && $this->currentComplexType){
 
 1051                            if (isset($attrs[
'schemaLocation'])) {
 
 1053                    $this->imports[$attrs[
'namespace']][] = array(
'location' => $attrs[
'schemaLocation'], 
'loaded' => 
false);
 
 1056                    $this->imports[$attrs[
'namespace']][] = array(
'location' => 
'', 
'loaded' => 
true);
 
 1058                                                $this->namespaces[
'ns'.(count($this->namespaces)+1)] = $attrs[
'namespace'];
 
 1064                                if($this->currentElement){
 
 1066                                } elseif($this->currentSimpleType){
 
 1068                                } elseif($this->currentComplexType){
 
 1070                                        if(strstr($attrs[
'base'],
':') == 
':Array'){
 
 1076                                $this->schemaInfo = $attrs;
 
 1078                                if (isset($attrs[
'targetNamespace'])) {
 
 1079                                        $this->schemaTargetNamespace = $attrs[
'targetNamespace'];
 
 1081                                if (!isset($attrs[
'elementFormDefault'])) {
 
 1082                                        $this->schemaInfo[
'elementFormDefault'] = 
'unqualified';
 
 1086                                if(isset($attrs[
'name'])){
 
 1087                                        $this->
xdebug(
"processing simpleType for name " . $attrs[
'name']);
 
 1088                                        $this->currentSimpleType = $attrs[
'name'];
 
 1089                                        $this->simpleTypes[ $attrs[
'name'] ] = $attrs;
 
 1090                                        $this->simpleTypes[ $attrs[
'name'] ][
'typeClass'] = 
'simpleType';
 
 1091                                        $this->simpleTypes[ $attrs[
'name'] ][
'phpType'] = 
'scalar';
 
 1113                if(isset($this->depth_array[$this->depth])){
 
 1117                if(
$name == 
'complexType'){
 
 1118                        $this->currentComplexType = 
false;
 
 1119                        $this->currentElement = 
false;
 
 1121                if(
$name == 
'element'){
 
 1122                        $this->currentElement = 
false;
 
 1124                if(
$name == 
'simpleType'){
 
 1125                        $this->currentSimpleType = 
false;
 
 1137                $pos = $this->depth_array[$this->depth - 1];
 
 1138                $this->message[$pos][
'cdata'] .= 
$data;
 
 1151                if (
sizeof($this->imports) > 0) {
 
 1152                        foreach($this->imports as $ns => $list) {
 
 1153                                foreach ($list as $ii) {
 
 1154                                        if ($ii[
'location'] != 
'') {
 
 1155                                                $xml .= 
" <$schemaPrefix:import location=\"" . $ii[
'location'] . 
'" namespace="' . $ns . 
"\" />\n";
 
 1157                                                $xml .= 
" <$schemaPrefix:import namespace=\"" . $ns . 
"\" />\n";
 
 1163                foreach($this->complexTypes as $typeName => $attrs){
 
 1166                        if(isset($attrs[
'elements']) && (count($attrs[
'elements']) > 0)){
 
 1167                                foreach($attrs[
'elements'] as $element => $eParts){
 
 1168                                        if(isset($eParts[
'ref'])){
 
 1169                                                $contentStr .= 
"   <$schemaPrefix:element ref=\"$element\"/>\n";
 
 1171                                                $contentStr .= 
"   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts[
'type']) . 
"\"/>\n";
 
 1176                        if(isset($attrs[
'attrs']) && (count($attrs[
'attrs']) >= 1)){
 
 1177                                foreach($attrs[
'attrs'] as $attr => $aParts){
 
 1178                                        $contentStr .= 
"    <$schemaPrefix:attribute ref=\"".$this->contractQName($aParts[
'ref']).
'"';
 
 1179                                        if(isset($aParts[
'http://schemas.xmlsoap.org/wsdl/:arrayType'])){
 
 1180                                                $this->usedNamespaces[
'wsdl'] = $this->namespaces[
'wsdl'];
 
 1181                                                $contentStr .= 
' wsdl:arrayType="'.$this->contractQName($aParts[
'http://schemas.xmlsoap.org/wsdl/:arrayType']).
'"';
 
 1183                                        $contentStr .= 
"/>\n";
 
 1187                        if( isset($attrs[
'restrictionBase']) && $attrs[
'restrictionBase'] != 
''){
 
 1188                                $contentStr = 
"   <$schemaPrefix:restriction base=\"".$this->contractQName($attrs[
'restrictionBase']).
"\">\n".$contentStr.
"   </$schemaPrefix:restriction>\n";
 
 1191                        if(isset($attrs[
'compositor']) && ($attrs[
'compositor'] != 
'')){
 
 1192                                $contentStr = 
"  <$schemaPrefix:$attrs[compositor]>\n".$contentStr.
"  </$schemaPrefix:$attrs[compositor]>\n";
 
 1195                        elseif((isset($attrs[
'elements']) && count($attrs[
'elements']) > 0) || (isset($attrs[
'attrs']) && count($attrs[
'attrs']) > 0)){
 
 1196                                $contentStr = 
"  <$schemaPrefix:complexContent>\n".$contentStr.
"  </$schemaPrefix:complexContent>\n";
 
 1199                        if($contentStr != 
''){
 
 1200                                $contentStr = 
" <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr.
" </$schemaPrefix:complexType>\n";
 
 1202                                $contentStr = 
" <$schemaPrefix:complexType name=\"$typeName\"/>\n";
 
 1204                        $xml .= $contentStr;
 
 1207                if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
 
 1208                        foreach($this->simpleTypes as $typeName => $attr){
 
 1209                                $xml .= 
" <$schemaPrefix:simpleType name=\"$typeName\">\n  <restriction base=\"".$this->contractQName($eParts[
'type']).
"\"/>\n </$schemaPrefix:simpleType>";
 
 1213                if(isset($this->elements) && count($this->elements) > 0){
 
 1214                        foreach($this->elements as $element => $eParts){
 
 1215                                $xml .= 
" <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts[
'type']).
"\"/>\n";
 
 1219                if(isset($this->attributes) && count($this->attributes) > 0){
 
 1220                        foreach($this->attributes as $attr => $aParts){
 
 1221                                $xml .= 
" <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts[
'type']).
"\"\n/>";
 
 1225                $el = 
"<$schemaPrefix:schema targetNamespace=\"$this->schemaTargetNamespace\"\n";
 
 1226                foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
 
 1227                        $el .= 
" xmlns:$nsp=\"$ns\"\n";
 
 1229                $xml = $el . 
">\n".$xml.
"</$schemaPrefix:schema>\n";
 
 1240                $this->
debug(
'<' . $this->schemaTargetNamespace . 
'> '.$string);
 
 1255                if(isset($this->typemap[$ns][
$type])){
 
 1257                        return $this->typemap[$ns][
$type];
 
 1258                } elseif(isset($this->complexTypes[
$type])){
 
 1260                        return $this->complexTypes[
$type][
'phpType'];
 
 1283                if(isset($this->complexTypes[
$type])){
 
 1284                        $this->
xdebug(
"in getTypeDef, found complexType $type");
 
 1285                        return $this->complexTypes[
$type];
 
 1286                } elseif(isset($this->simpleTypes[
$type])){
 
 1287                        $this->
xdebug(
"in getTypeDef, found simpleType $type");
 
 1288                        if (!isset($this->simpleTypes[
$type][
'phpType'])) {
 
 1291                                $uqType = substr($this->simpleTypes[
$type][
'type'], strrpos($this->simpleTypes[
$type][
'type'], 
':') + 1);
 
 1292                                $ns = substr($this->simpleTypes[
$type][
'type'], 0, strrpos($this->simpleTypes[
$type][
'type'], 
':'));
 
 1295                                        if (isset($etype[
'phpType'])) {
 
 1296                                                $this->simpleTypes[
$type][
'phpType'] = $etype[
'phpType'];
 
 1298                                        if (isset($etype[
'elements'])) {
 
 1299                                                $this->simpleTypes[
$type][
'elements'] = $etype[
'elements'];
 
 1303                        return $this->simpleTypes[
$type];
 
 1304                } elseif(isset($this->elements[
$type])){
 
 1305                        $this->
xdebug(
"in getTypeDef, found element $type");
 
 1306                        if (!isset($this->elements[
$type][
'phpType'])) {
 
 1308                                $uqType = substr($this->elements[
$type][
'type'], strrpos($this->elements[
$type][
'type'], 
':') + 1);
 
 1309                                $ns = substr($this->elements[
$type][
'type'], 0, strrpos($this->elements[
$type][
'type'], 
':'));
 
 1312                                        if (isset($etype[
'phpType'])) {
 
 1313                                                $this->elements[
$type][
'phpType'] = $etype[
'phpType'];
 
 1315                                        if (isset($etype[
'elements'])) {
 
 1316                                                $this->elements[
$type][
'elements'] = $etype[
'elements'];
 
 1318                                } elseif ($ns == 
'http://www.w3.org/2001/XMLSchema') {
 
 1319                                        $this->elements[
$type][
'phpType'] = 
'scalar';
 
 1322                        return $this->elements[
$type];
 
 1323                } elseif(isset($this->attributes[
$type])){
 
 1324                        $this->
xdebug(
"in getTypeDef, found attribute $type");
 
 1325                        return $this->attributes[
$type];
 
 1327                $this->
xdebug(
"in getTypeDef, did not find $type");
 
 1342            if(is_array($typeDef[
'attrs'])){
 
 1343                foreach($attrs as $attName => 
$data){
 
 1344                    $str .= 
" $attName=\"{type = ".$data[
'type'].
"}\"";
 
 1347            $str .= 
" xmlns=\"".$this->schema[
'targetNamespace'].
"\"";
 
 1348            if(count($typeDef[
'elements']) > 0){
 
 1350                foreach($typeDef[
'elements'] as $element => $eData){
 
 1354            } elseif($typeDef[
'typeClass'] == 
'element') {
 
 1355                $str .= 
"></$type>";
 
 1377                        if($typeDef[
'phpType'] == 
'struct'){
 
 1378                                $buffer .= 
'<table>';
 
 1379                                foreach($typeDef[
'elements'] as $child => $childDef){
 
 1381                                        <tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef[
'type']).
"):</td> 
 1382                                        <td><input type='text' name='parameters[".
$name.
"][$childDef[name]]'></td></tr>";
 
 1384                                $buffer .= 
'</table>';
 
 1386                        } elseif($typeDef[
'phpType'] == 
'array'){
 
 1387                                $buffer .= 
'<table>';
 
 1390                                        <tr><td align='right'>array item (type: $typeDef[arrayType]):</td> 
 1391                                        <td><input type='text' name='parameters[".$name.
"][]'></td></tr>";
 
 1393                                $buffer .= 
'</table>';
 
 1396                                $buffer .= 
"<input type='text' name='parameters[$name]'>";
 
 1399                        $buffer .= 
"<input type='text' name='parameters[$name]'>";
 
 1444        function addComplexType(
$name,$typeClass=
'complexType',$phpType=
'array',$compositor=
'',$restrictionBase=
'',
$elements=array(),$attrs=array(),$arrayType=
''){
 
 1445                $this->complexTypes[
$name] = array(
 
 1447            'typeClass' => $typeClass,
 
 1448            'phpType'   => $phpType,
 
 1449                'compositor'=> $compositor,
 
 1450            'restrictionBase' => $restrictionBase,
 
 1453            'arrayType' => $arrayType
 
 1456                $this->
xdebug(
"addComplexType $name: " . $this->
varDump($this->complexTypes[
$name]));
 
 1470                $this->simpleTypes[
$name] = array(
 
 1472            'typeClass' => $typeClass,
 
 1473            'phpType'   => $phpType,
 
 1474            'type' => $restrictionBase
 
 1508                $this->name = 
$name;
 
 1510                $this->type = 
$type;
 
 1523                return $this->
serialize_val($this->value,$this->name,$this->type,$this->element_ns,$this->type_ns,$this->attributes,$use);
 
 1579                $u = parse_url(
$url);
 
 1580                foreach($u as $k => $v){
 
 1581                        $this->
debug(
"$k = $v");
 
 1586                if(isset($u[
'query']) && $u[
'query'] != 
''){
 
 1587            $this->path .= 
'?' . $u[
'query'];
 
 1591                if(!isset($u[
'port'])){
 
 1592                        if($u[
'scheme'] == 
'https'){
 
 1602                ereg(
'\$Revisio' . 
'n: ([^ ]+)', $this->revision, $rev);
 
 1603                $this->outgoing_headers[
'User-Agent'] = $this->title.
'/'.$this->version.
' ('.$rev[1].
')';
 
 1604                if (!isset($u[
'port'])) {
 
 1607                        $this->outgoing_headers[
'Host'] = $this->host.
':'.
$this->port;
 
 1610                if (isset($u[
'user']) && $u[
'user'] != 
'') {
 
 1611                        $this->
setCredentials($u[
'user'], isset($u[
'pass']) ? $u[
'pass'] : 
'');
 
 1615        function connect($connection_timeout=0,$response_timeout=30){
 
 1628                $this->
debug(
"connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
 
 1629          if ($this->scheme == 
'http' || $this->scheme == 
'ssl') {
 
 1631                if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
 
 1632                        if (!feof($this->fp)) {
 
 1633                                $this->
debug(
'Re-use persistent connection');
 
 1637                        $this->
debug(
'Closed persistent connection at EOF');
 
 1641                if ($this->scheme == 
'ssl') {
 
 1646                $this->
debug(
'calling fsockopen with host ' . $host);
 
 1649                if($connection_timeout > 0){
 
 1650                        $this->fp = @fsockopen( 
$host, $this->port, $this->errno, $this->error_str, $connection_timeout);
 
 1652                        $this->fp = @fsockopen( 
$host, $this->port, $this->errno, $this->error_str);
 
 1657                        $msg = 
'Couldn\'t open socket connection to server ' . 
$this->url;
 
 1661                                $msg .= 
' prior to connect().  This is often a problem looking up the host name.';
 
 1669                socket_set_timeout( $this->fp, $response_timeout);
 
 1671                $this->
debug(
'socket connected');
 
 1673          } 
else if ($this->scheme == 
'https') {
 
 1674                if (!extension_loaded(
'curl')) {
 
 1675                        $this->
setError(
'CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
 
 1678                $this->
debug(
'connect using https');
 
 1680                $this->ch = curl_init();
 
 1682                $hostURL = ($this->port != 
'') ? 
"https://$this->host:$this->port" : 
"https://$this->host";
 
 1685                curl_setopt($this->ch, CURLOPT_URL, $hostURL);
 
 1687                curl_setopt($this->ch, CURLOPT_HEADER, 1);
 
 1689                curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
 
 1696                if ($this->persistentConnection) {
 
 1700                        $this->persistentConnection = 
false;
 
 1701                        $this->outgoing_headers[
'Connection'] = 
'close';
 
 1704                if ($connection_timeout != 0) {
 
 1705                        curl_setopt($this->ch, CURLOPT_TIMEOUT, $connection_timeout);
 
 1712                curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
 
 1713                curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
 
 1723                $this->
debug(
'cURL connection set up');
 
 1726                $this->
setError(
'Unknown scheme ' . $this->scheme);
 
 1727                $this->
debug(
'Unknown scheme ' . $this->scheme);
 
 1743                $this->
debug(
'entered send() with data of length: '.strlen(
$data));
 
 1745                $this->tryagain = 
true;
 
 1747                while ($this->tryagain) {
 
 1748                        $this->tryagain = 
false;
 
 1751                                if (!$this->
connect($timeout, $response_timeout)){
 
 1763                                $this->
setError(
'Too many tries to get an OK response');
 
 1766                $this->
debug(
'end of send()');
 
 1781                return $this->
send(
$data, $timeout, $response_timeout);
 
 1796                $this->
debug(
"Set credentials for authtype $authtype");
 
 1799                        $this->outgoing_headers[
'Authorization'] = 
'Basic '.base64_encode(
$username.
':'.
$password);
 
 1829                                $unhashedDigest = 
'';
 
 1833                                        $unhashedDigest = $HA1 . 
':' . $nonce . 
':' . sprintf(
"%08d", 
$digestRequest[
'nc']) . 
':' . $cnonce . 
':' . 
$digestRequest[
'qop'] . 
':' . $HA2;
 
 1835                                        $unhashedDigest = $HA1 . 
':' . $nonce . 
':' . $HA2;
 
 1838                                $hashedDigest = md5($unhashedDigest);
 
 1840                                $this->outgoing_headers[
'Authorization'] = 
'Digest username="' . 
$username . 
'", realm="' . 
$digestRequest[
'realm'] . 
'", nonce="' . $nonce . 
'", uri="' . $this->uri . 
'", cnonce="' . $cnonce . 
'", nc=' . sprintf(
"%08x", 
$digestRequest[
'nc']) . 
', qop="' . 
$digestRequest[
'qop'] . 
'", response="' . $hashedDigest . 
'"';
 
 1848                if (isset($this->outgoing_headers[
'Authorization'])) {
 
 1849                        $this->
debug(
'Authorization header set: ' . substr($this->outgoing_headers[
'Authorization'], 0, 12) . 
'...');
 
 1851                        $this->
debug(
'Authorization header not set');
 
 1862                $this->outgoing_headers[
'SOAPAction'] = 
'"' . $soapaction . 
'"';
 
 1872                $this->protocol_version = 
'1.1';
 
 1873                $this->outgoing_headers[
'Accept-Encoding'] = $enc;
 
 1874                $this->outgoing_headers[
'Connection'] = 
'close';
 
 1875                $this->persistentConnection = 
false;
 
 1876                #set_magic_quotes_runtime(0); 
 1878                $this->encoding = $enc;
 
 1890        function setProxy($proxyhost, $proxyport, $proxyusername = 
'', $proxypassword = 
'') {
 
 1892                $this->host = $proxyhost;
 
 1893                $this->port = $proxyport;
 
 1894                if ($proxyusername != 
'' && $proxypassword != 
'') {
 
 1895                        $this->outgoing_headers[
'Proxy-Authorization'] = 
' Basic '.base64_encode($proxyusername.
':'.$proxypassword);
 
 1915                $chunkend = strpos($buffer, $lb);
 
 1916                if ($chunkend == FALSE) {
 
 1917                        $this->
debug(
'no linebreak found in decodeChunked');
 
 1920                $temp = substr($buffer,0,$chunkend);
 
 1921                $chunk_size = hexdec( trim($temp) );
 
 1922                $chunkstart = $chunkend + strlen($lb);
 
 1924                while ($chunk_size > 0) {
 
 1925                        $this->
debug(
"chunkstart: $chunkstart chunk_size: $chunk_size");
 
 1926                        $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
 
 1929                        if ($chunkend == FALSE) {
 
 1930                            $chunk = substr($buffer,$chunkstart);
 
 1933                            $length += strlen($chunk);
 
 1938                        $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
 
 1942                        $length += strlen($chunk);
 
 1944                        $chunkstart = $chunkend + strlen($lb);
 
 1946                        $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
 
 1947                        if ($chunkend == FALSE) {
 
 1950                        $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
 
 1951                        $chunk_size = hexdec( trim($temp) );
 
 1952                        $chunkstart = $chunkend;
 
 1962                $this->outgoing_headers[
'Content-Length'] = strlen(
$data);
 
 1965                $this->outgoing_payload = 
"$this->request_method $this->uri HTTP/$this->protocol_version\r\n";
 
 1968                foreach($this->outgoing_headers as $k => $v){
 
 1969                        $this->outgoing_payload .= $k.
': '.$v.
"\r\n";
 
 1973                $this->outgoing_payload .= 
"\r\n";
 
 1976                $this->outgoing_payload .= 
$data;
 
 1983          if ($this->scheme == 
'http' || $this->scheme == 
'ssl') {
 
 1985                if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
 
 1986                        $this->
setError(
'couldn\'t write message data to socket');
 
 1987                        $this->
debug(
'couldn\'t write message data to socket');
 
 1990                $this->
debug(
'wrote data to socket, length = ' . strlen($this->outgoing_payload));
 
 1992          } 
else if ($this->scheme == 
'https') {
 
 1998                foreach($this->outgoing_headers as $k => $v){
 
 1999                        $curl_headers[] = 
"$k: $v";
 
 2001                curl_setopt($this->ch, CURLOPT_HTTPHEADER, $curl_headers);
 
 2002                if ($this->request_method == 
"POST") {
 
 2003                        curl_setopt($this->ch, CURLOPT_POST, 1);
 
 2004                        curl_setopt($this->ch, CURLOPT_POSTFIELDS, 
$data);
 
 2007                $this->
debug(
'set cURL payload');
 
 2013                $this->incoming_payload = 
'';
 
 2015          if ($this->scheme == 
'http' || $this->scheme == 
'ssl') {
 
 2018            while (!isset($lb)){
 
 2021                        if(feof($this->fp)) {
 
 2022                                $this->incoming_payload = 
$data;
 
 2023                                $this->
debug(
'found no headers before EOF after length ' . strlen(
$data));
 
 2024                                $this->
debug(
"received before EOF:\n" . 
$data);
 
 2025                                $this->
setError(
'server failed to send headers');
 
 2029                        $tmp = fgets($this->fp, 256);
 
 2030                        $tmplen = strlen($tmp);
 
 2031                        $this->
debug(
"read line of $tmplen bytes: " . trim($tmp));
 
 2034                                $this->incoming_payload = 
$data;
 
 2035                                $this->
debug(
'socket read of headers timed out after length ' . strlen(
$data));
 
 2036                                $this->
debug(
"read before timeout:\n" . 
$data);
 
 2037                                $this->
setError(
'socket read of headers timed out');
 
 2042                        $pos = strpos(
$data,
"\r\n\r\n");
 
 2046                                $pos = strpos(
$data,
"\n\n");
 
 2052                        if(isset($lb) && ereg(
'^HTTP/1.1 100',
$data)){
 
 2058                $this->incoming_payload .= 
$data;
 
 2059                $this->
debug(
'found end of headers after length ' . strlen(
$data));
 
 2061                $header_data = trim(substr(
$data,0,$pos));
 
 2062                $header_array = explode($lb,$header_data);
 
 2063                $this->incoming_headers = array();
 
 2064                foreach($header_array as $header_line){
 
 2065                        $arr = explode(
':',$header_line, 2);
 
 2066                        if(count($arr) > 1){
 
 2067                                $header_name = strtolower(trim($arr[0]));
 
 2068                                $this->incoming_headers[$header_name] = trim($arr[1]);
 
 2069                        } 
else if (isset($header_name)) {
 
 2070                                $this->incoming_headers[$header_name] .= $lb . 
' ' . $header_line;
 
 2075                if (isset($this->incoming_headers[
'content-length'])) {
 
 2076                        $content_length = $this->incoming_headers[
'content-length'];
 
 2078                        $this->
debug(
"want to read content of length $content_length");
 
 2080                        $content_length =  2147483647;
 
 2081                        if (isset($this->incoming_headers[
'transfer-encoding']) && strtolower($this->incoming_headers[
'transfer-encoding']) == 
'chunked') {
 
 2083                                $this->
debug(
"want to read chunked content");
 
 2086                                $this->
debug(
"want to read content to EOF");
 
 2092                                $tmp = fgets($this->fp, 256);
 
 2093                                $tmplen = strlen($tmp);
 
 2094                                $this->
debug(
"read chunk line of $tmplen bytes");
 
 2096                                        $this->incoming_payload = 
$data;
 
 2097                                        $this->
debug(
'socket read of chunk length timed out after length ' . strlen(
$data));
 
 2098                                        $this->
debug(
"read before timeout:\n" . 
$data);
 
 2099                                        $this->
setError(
'socket read of chunk length timed out');
 
 2102                                $content_length = hexdec(trim($tmp));
 
 2103                                $this->
debug(
"chunk length $content_length");
 
 2106                    while (($strlen < $content_length) && (!feof($this->fp))) {
 
 2107                        $readlen = min(8192, $content_length - $strlen);
 
 2108                                $tmp = fread($this->fp, $readlen);
 
 2109                                $tmplen = strlen($tmp);
 
 2110                                $this->
debug(
"read buffer of $tmplen bytes");
 
 2111                                if (($tmplen == 0) && (!feof($this->fp))) {
 
 2112                                        $this->incoming_payload = 
$data;
 
 2113                                        $this->
debug(
'socket read of body timed out after length ' . strlen(
$data));
 
 2114                                        $this->
debug(
"read before timeout:\n" . 
$data);
 
 2115                                        $this->
setError(
'socket read of body timed out');
 
 2121                        if ($chunked && ($content_length > 0)) {
 
 2122                                $tmp = fgets($this->fp, 256);
 
 2123                                $tmplen = strlen($tmp);
 
 2124                                $this->
debug(
"read chunk terminator of $tmplen bytes");
 
 2126                                        $this->incoming_payload = 
$data;
 
 2127                                        $this->
debug(
'socket read of chunk terminator timed out after length ' . strlen(
$data));
 
 2128                                        $this->
debug(
"read before timeout:\n" . 
$data);
 
 2129                                        $this->
setError(
'socket read of chunk terminator timed out');
 
 2133                } 
while ($chunked && ($content_length > 0) && (!feof($this->fp)));
 
 2134                if (feof($this->fp)) {
 
 2135                        $this->
debug(
'read to EOF');
 
 2137                $this->
debug(
'read body of length ' . strlen(
$data));
 
 2138                $this->incoming_payload .= 
$data;
 
 2139                $this->
debug(
'received a total of '.strlen($this->incoming_payload).
' bytes of data from server');
 
 2143                        (isset($this->incoming_headers[
'connection']) && strtolower($this->incoming_headers[
'connection']) == 
'close') || 
 
 2144                        (! $this->persistentConnection) || feof($this->fp)){
 
 2147                        $this->
debug(
'closed socket');
 
 2151                if($this->incoming_payload == 
''){
 
 2152                        $this->
setError(
'no response from server');
 
 2167          } 
else if ($this->scheme == 
'https') {
 
 2169                $this->
debug(
'send and receive with cURL');
 
 2170                $this->incoming_payload = curl_exec($this->ch);
 
 2173        $cErr = curl_error($this->ch);
 
 2175                $err = 
'cURL ERROR: '.curl_errno($this->ch).
': '.$cErr.
'<br>';
 
 2176                        foreach(curl_getinfo($this->ch) as $k => $v){
 
 2177                                $err .= 
"$k: $v<br>";
 
 2181                        curl_close($this->ch);
 
 2189                $this->
debug(
'No cURL error, closing cURL');
 
 2190                curl_close($this->ch);
 
 2193                if (ereg(
'^HTTP/1.1 100',
$data)) {
 
 2194                        if ($pos = strpos(
$data,
"\r\n\r\n")) {
 
 2196                        } elseif($pos = strpos(
$data,
"\n\n") ) {
 
 2202                if ($pos = strpos(
$data,
"\r\n\r\n")) {
 
 2204                } elseif( $pos = strpos(
$data,
"\n\n")) {
 
 2207                        $this->
debug(
'no proper separation of headers and document');
 
 2208                        $this->
setError(
'no proper separation of headers and document');
 
 2211                $header_data = trim(substr(
$data,0,$pos));
 
 2212                $header_array = explode($lb,$header_data);
 
 2214                $this->
debug(
'found proper separation of headers and document');
 
 2215                $this->
debug(
'cleaned data, stringlen: '.strlen(
$data));
 
 2217                foreach ($header_array as $header_line) {
 
 2218                        $arr = explode(
':',$header_line,2);
 
 2219                        if (count($arr) > 1) {
 
 2220                                $this->incoming_headers[strtolower(trim($arr[0]))] = trim($arr[1]);
 
 2226                if (isset($this->incoming_headers[
'www-authenticate']) && strstr($header_array[0], 
'401 Unauthorized')) {
 
 2227                        $this->
debug(
'Got 401 Unauthorized with WWW-Authenticate: ' . $this->incoming_headers[
'www-authenticate']);
 
 2228                        if (substr(
"Digest ", $this->incoming_headers[
'www-authenticate'])) {
 
 2229                                $this->
debug(
'Server wants digest authentication');
 
 2231                                $digestString = str_replace(
'Digest ', 
'', $this->incoming_headers[
'www-authenticate']);
 
 2234                                $digestElements = explode(
',', $digestString);
 
 2235                                foreach ($digestElements as $val) {
 
 2236                                        $tempElement = explode(
'=', trim($val));
 
 2237                                        $digestRequest[$tempElement[0]] = str_replace(
"\"", 
'', $tempElement[1]);
 
 2243                                        $this->tryagain = 
true;
 
 2247                        $this->
debug(
'HTTP authentication failed');
 
 2248                        $this->
setError(
'HTTP authentication failed');
 
 2253                if(isset($this->incoming_headers[
'content-encoding']) && $this->incoming_headers[
'content-encoding'] != 
''){
 
 2254                        if(strtolower($this->incoming_headers[
'content-encoding']) == 
'deflate' || strtolower($this->incoming_headers[
'content-encoding']) == 
'gzip'){
 
 2256                        if(function_exists(
'gzuncompress')){
 
 2258                                        if($this->incoming_headers[
'content-encoding'] == 
'deflate' && $degzdata = @gzuncompress(
$data)){
 
 2260                                        } elseif($this->incoming_headers[
'content-encoding'] == 
'gzip' && $degzdata = gzinflate(substr(
$data, 10))){    
 
 2263                                                $this->
setError(
'Errors occurred when trying to decode the data');
 
 2268                                        $this->incoming_payload = $header_data.$lb.$lb.$data;
 
 2270                                        $this->
setError(
'The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
 
 2275                if(strlen(
$data) == 0){
 
 2276                        $this->
debug(
'no data after headers!');
 
 2277                        $this->
setError(
'no data present after HTTP headers');
 
 2285                $this->outgoing_headers[
'Content-Type'] = 
$type . ($charset ? 
'; charset=' . $charset : 
'');
 
 2289                if (isset($this->outgoing_headers[
'Accept-Encoding'])) {
 
 2292                $this->protocol_version = 
'1.1';
 
 2293                $this->persistentConnection = 
true;
 
 2294                $this->outgoing_headers[
'Connection'] = 
'Keep-Alive';
 
 2352                global $HTTP_SERVER_VARS;
 
 2354                if (isset($debug)) {
 
 2355                        $this->debug_flag = $debug;
 
 2356                } 
else if (isset($_REQUEST[
'debug'])) {
 
 2357                        $this->debug_flag = $_REQUEST[
'debug'];
 
 2358                } 
else if (isset(
$_SERVER[
'QUERY_STRING'])) {
 
 2359                        $qs = explode(
'&', 
$_SERVER[
'QUERY_STRING']);
 
 2360                        foreach ($qs as $v) {
 
 2361                                if (substr($v, 0, 6) == 
'debug=') {
 
 2362                                        $this->debug_flag = substr($v, 6);
 
 2365                } 
else if (isset($HTTP_SERVER_VARS[
'QUERY_STRING'])) {
 
 2366                        $qs = explode(
'&', $HTTP_SERVER_VARS[
'QUERY_STRING']);
 
 2367                        foreach ($qs as $v) {
 
 2368                                if (substr($v, 0, 6) == 
'debug=') {
 
 2369                                        $this->debug_flag = substr($v, 6);
 
 2376                        if (is_object(
$wsdl) && is_a(
$wsdl, 
'wsdl')) {
 
 2378                                $this->externalWSDLURL = $this->
wsdl->
wsdl;
 
 2379                                $this->
debug(
'Use existing wsdl instance from ' . $this->externalWSDLURL);
 
 2381                                $this->
debug(
'Create wsdl from ' . $wsdl);
 
 2383                                $this->externalWSDLURL = 
$wsdl;
 
 2385                        $this->
debug(
"wsdl...\n" . $this->
wsdl->debug_str);
 
 2386                        $this->
wsdl->debug_str = 
'';
 
 2388                                die(
'WSDL ERROR: '.$err);
 
 2400                global $QUERY_STRING;
 
 2401                if(isset(
$_SERVER[
'QUERY_STRING'])){
 
 2403                } elseif(isset(
$GLOBALS[
'QUERY_STRING'])){
 
 2405 } elseif(isset($QUERY_STRING) && $QUERY_STRING != 
''){
 
 2406                        $qs = $QUERY_STRING;
 
 2409                if(isset($qs) && ereg(
'wsdl', $qs) ){
 
 2411                        if($this->externalWSDLURL){
 
 2412              if (strpos($this->externalWSDLURL,
"://")!==
false) { 
 
 2413                                header(
'Location: '.$this->externalWSDLURL);
 
 2415                header(
"Content-Type: text/xml\r\n");
 
 2416                $fp = fopen($this->externalWSDLURL, 
'r');
 
 2420                                header(
"Content-Type: text/xml; charset=ISO-8859-1\r\n");
 
 2429                        if (! $this->
fault) {
 
 2432                        if (! $this->
fault) {
 
 2452                global $HTTP_SERVER_VARS;
 
 2455                $this->request = 
'';
 
 2456                if(function_exists(
'getallheaders')){
 
 2457                        $this->headers = getallheaders();
 
 2458                        foreach($this->headers as $k=>$v){
 
 2459                                $this->request .= 
"$k: $v\r\n";
 
 2460                                $this->
debug(
"$k: $v");
 
 2463                        if(isset($this->headers[
'SOAPAction'])){
 
 2464                                $this->SOAPAction = str_replace(
'"',
'',$this->headers[
'SOAPAction']);
 
 2467                        if(strpos($this->headers[
'Content-Type'],
'=')){
 
 2468                                $enc = str_replace(
'"',
'',substr(strstr($this->headers[
"Content-Type"],
'='),1));
 
 2469                                if(eregi(
'^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
 
 2470                                        $this->xml_encoding = strtoupper($enc);
 
 2472                                        $this->xml_encoding = 
'US-ASCII';
 
 2476                                $this->xml_encoding = 
'UTF-8';
 
 2480                                if (substr($k, 0, 5) == 
'HTTP_') {
 
 2481                                        $k = str_replace(
' ', 
'-', ucwords(strtolower(str_replace(
'_', 
' ', substr($k, 5)))));
 
 2483                                        $k = str_replace(
' ', 
'-', ucwords(strtolower(str_replace(
'_', 
' ', $k))));
 
 2485                                if ($k == 
'Soapaction') {
 
 2488                                        $v = str_replace(
'"', 
'', $v);
 
 2489                                        $v = str_replace(
'\\', 
'', $v);
 
 2490                                        $this->SOAPAction = $v;
 
 2491                                } 
else if ($k == 
'Content-Type') {
 
 2493                                        if (strpos($v, 
'=')) {
 
 2494                                                $enc = substr(strstr($v, 
'='), 1);
 
 2495                                                $enc = str_replace(
'"', 
'', $enc);
 
 2496                                                $enc = str_replace(
'\\', 
'', $enc);
 
 2497                                                if (eregi(
'^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
 
 2498                                                        $this->xml_encoding = strtoupper($enc);
 
 2500                                                        $this->xml_encoding = 
'US-ASCII';
 
 2504                                                $this->xml_encoding = 
'UTF-8';
 
 2507                                $this->headers[$k] = $v;
 
 2508                                $this->request .= 
"$k: $v\r\n";
 
 2509                                $this->
debug(
"$k: $v");
 
 2511                } elseif (is_array($HTTP_SERVER_VARS)) {
 
 2512                        foreach ($HTTP_SERVER_VARS as $k => $v) {
 
 2513                                if (substr($k, 0, 5) == 
'HTTP_') {
 
 2514                                        $k = str_replace(
' ', 
'-', ucwords(strtolower(str_replace(
'_', 
' ', substr($k, 5)))));
 
 2515                                        if ($k == 
'Soapaction') {
 
 2518                                                $v = str_replace(
'"', 
'', $v);
 
 2519                                                $v = str_replace(
'\\', 
'', $v);
 
 2520                                                $this->SOAPAction = $v;
 
 2521                                        } 
else if ($k == 
'Content-Type') {
 
 2523                                                if (strpos($v, 
'=')) {
 
 2524                                                        $enc = substr(strstr($v, 
'='), 1);
 
 2525                                                        $enc = str_replace(
'"', 
'', $enc);
 
 2526                                                        $enc = str_replace(
'\\', 
'', $enc);
 
 2527                                                        if (eregi(
'^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
 
 2528                                                                $this->xml_encoding = strtoupper($enc);
 
 2530                                                                $this->xml_encoding = 
'US-ASCII';
 
 2534                                                        $this->xml_encoding = 
'UTF-8';
 
 2537                                        $this->headers[$k] = $v;
 
 2538                                        $this->request .= 
"$k: $v\r\n";
 
 2539                                        $this->
debug(
"$k: $v");
 
 2568                $this->
debug(
'entering parse_request() on '.date(
'H:i Y-m-d'));
 
 2570                $this->
debug(
'got character encoding: '.$this->xml_encoding);
 
 2572                if (isset($this->headers[
'Content-Encoding']) && $this->headers[
'Content-Encoding'] != 
'') {
 
 2573                        $this->
debug(
'got content encoding: ' . $this->headers[
'Content-Encoding']);
 
 2574                        if ($this->headers[
'Content-Encoding'] == 
'deflate' || $this->headers[
'Content-Encoding'] == 
'gzip') {
 
 2576                                if (function_exists(
'gzuncompress')) {
 
 2577                                        if ($this->headers[
'Content-Encoding'] == 
'deflate' && $degzdata = @gzuncompress(
$data)) {
 
 2579                                        } elseif ($this->headers[
'Content-Encoding'] == 
'gzip' && $degzdata = gzinflate(substr(
$data, 10))) {
 
 2582                                                $this->
fault(
'Server', 
'Errors occurred when trying to decode the data');
 
 2586                                        $this->
fault(
'Server', 
'This Server does not support compressed data');
 
 2591                $this->request .= 
"\r\n".$data;
 
 2592                $this->requestSOAP = 
$data;
 
 2596                $this->
debug(
"parser debug: \n".$parser->debug_str);
 
 2598                if($err = 
$parser->getError()){
 
 2599                        $this->result = 
'fault: error in msg parsing: '.$err;
 
 2600                        $this->
fault(
'Server',
"error in msg parsing:\n".$err);
 
 2604                        $this->methodURI = 
$parser->root_struct_namespace;
 
 2605                        $this->methodname = 
$parser->root_struct_name;
 
 2606                        $this->
debug(
'method name: '.$this->methodname);
 
 2607                        $this->
debug(
'calling parser->get_response()');
 
 2608                        $this->methodparams = 
$parser->get_response();
 
 2610                        $this->requestHeaders = 
$parser->getHeaders();
 
 2612            $this->document = 
$parser->document;
 
 2614                $this->
debug(
'leaving parse_request() on '.date(
'H:i Y-m-d'));
 
 2635                $this->
debug(
'entering invoke_method');
 
 2637                if(!function_exists($this->methodname)){
 
 2639                        $this->
debug(
"method '$this->methodname' not found!");
 
 2640                        $this->result = 
'fault: method not found';
 
 2641                        $this->
fault(
'Server',
"method '$this->methodname' not defined in service");
 
 2647                        $this->
fault(
'Server',
"Operation '$this->methodname' is not defined in the WSDL for this service");
 
 2650                    $this->
debug(
'opData is ' . $this->
varDump($this->opData));
 
 2652                $this->
debug(
"method '$this->methodname' exists");
 
 2655                if(! $this->
verify_method($this->methodname,$this->methodparams)){
 
 2657                        $this->
debug(
'ERROR: request not verified against method signature');
 
 2658                        $this->result = 
'fault: request failed validation against method signature';
 
 2660                        $this->
fault(
'Server',
"Operation '$this->methodname' not defined in service.");
 
 2665        $this->
debug(
'params var dump '.$this->
varDump($this->methodparams));
 
 2666                if($this->methodparams){
 
 2667                        $this->
debug(
"calling '$this->methodname' with params");
 
 2668                        if (! function_exists(
'call_user_func_array')) {
 
 2669                                $this->
debug(
'calling method using eval()');
 
 2670                                $funcCall = $this->methodname.
'(';
 
 2671                                foreach($this->methodparams as 
$param) {
 
 2672                                        $funcCall .= 
"\"$param\",";
 
 2674                                $funcCall = substr($funcCall, 0, -1).
')';
 
 2675                                $this->
debug(
'function call:<br>'.$funcCall);
 
 2676                                @eval(
"\$this->methodreturn = $funcCall;");
 
 2678                                $this->
debug(
'calling method using call_user_func_array()');
 
 2679                                $this->methodreturn = call_user_func_array(
"$this->methodname",$this->methodparams);
 
 2683                        $this->
debug(
"calling $this->methodname w/ no params");
 
 2685                        $this->methodreturn = @$m();
 
 2687        $this->
debug(
'methodreturn var dump'.$this->
varDump($this->methodreturn));
 
 2688                $this->
debug(
"leaving invoke_method: called method $this->methodname, received $this->methodreturn of type ".gettype($this->methodreturn));
 
 2703                $this->
debug(
"Entering serialize_return");
 
 2705                if(isset($this->methodreturn) && ($this->methodreturn != 
'' || is_bool($this->methodreturn))) {
 
 2707                        if(get_class($this->methodreturn) == 
'soap_fault'){
 
 2708                                $this->
debug(
'got a fault object from method');
 
 2711                        } elseif ($this->methodreturnisliteralxml) {
 
 2715                                $this->
debug(
'got a(n) '.gettype($this->methodreturn).
' from method');
 
 2716                                $this->
debug(
'serializing return value');
 
 2719                                        if(
sizeof($this->opData[
'output'][
'parts']) > 1){
 
 2723                                        $opParams = array($this->methodreturn);
 
 2727                                                $this->
debug(
'got wsdl error: '.$errstr);
 
 2728                                                $this->
fault(
'Server', 
'got wsdl error: '.$errstr);
 
 2732                                    $return_val = $this->
serialize_val($this->methodreturn, 
'return');
 
 2735                        $this->
debug(
'return val: '.$this->
varDump($return_val));
 
 2738                        $this->
debug(
'got no response from method');
 
 2740                $this->
debug(
'serializing response');
 
 2742                        if ($this->opData[
'style'] == 
'rpc') {
 
 2743                                $payload = 
'<ns1:'.$this->methodname.
'Response xmlns:ns1="'.$this->methodURI.
'">'.$return_val.
'</ns1:'.$this->methodname.
"Response>";
 
 2745                                $payload = $return_val;
 
 2748                        $payload = 
'<ns1:'.$this->methodname.
'Response xmlns:ns1="'.$this->methodURI.
'">'.$return_val.
'</ns1:'.$this->methodname.
"Response>";
 
 2750                $this->result = 
'successful';
 
 2753                $this->
debug(
"WSDL debug data:\n".$this->
wsdl->debug_str);
 
 2756                        $this->responseSOAP = $this->
serializeEnvelope($payload,$this->responseHeaders,$this->
wsdl->usedNamespaces,$this->opData[
'style']);
 
 2758                        $this->responseSOAP = $this->
serializeEnvelope($payload,$this->responseHeaders);
 
 2760                $this->
debug(
"Leaving serialize_return");
 
 2774                $this->
debug(
'Enter send_response');
 
 2776                        $payload = $this->
fault->serialize();
 
 2777                        $this->outgoing_headers[] = 
"HTTP/1.0 500 Internal Server Error";
 
 2778                        $this->outgoing_headers[] = 
"Status: 500 Internal Server Error";
 
 2788                if(isset($this->debug_flag) && $this->debug_flag){
 
 2789                        while (strpos($this->debug_str, 
'--')) {
 
 2790                                $this->debug_str = str_replace(
'--', 
'- -', $this->debug_str);
 
 2792                $payload .= 
"<!--\n" . $this->debug_str . 
"\n-->";
 
 2794                $this->outgoing_headers[] = 
"Server: $this->title Server v$this->version";
 
 2795                ereg(
'\$Revisio' . 
'n: ([^ ]+)', $this->revision, $rev);
 
 2796                $this->outgoing_headers[] = 
"X-SOAP-Server: $this->title/$this->version (".$rev[1].
")";
 
 2799                $this->outgoing_headers[] = 
"Content-Type: text/xml; charset=$this->soap_defencoding";
 
 2801                if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers[
'Accept-Encoding'])) {     
 
 2802                   if (strstr($this->headers[
'Accept-Encoding'], 
'deflate')) {
 
 2803                                if (function_exists(
'gzcompress')) {
 
 2804                                        if (isset($this->debug_flag) && $this->debug_flag) {
 
 2805                                                $payload .= 
"<!-- Content being deflated -->";
 
 2807                                        $this->outgoing_headers[] = 
"Content-Encoding: deflate";
 
 2808                                        $payload = gzcompress($payload);
 
 2810                                        if (isset($this->debug_flag) && $this->debug_flag) {
 
 2811                                                $payload .= 
"<!-- Content will not be deflated: no gzcompress -->";
 
 2814                   } 
else if (strstr($this->headers[
'Accept-Encoding'], 
'gzip')) {
 
 2815                                if (function_exists(
'gzencode')) {
 
 2816                                        if (isset($this->debug_flag) && $this->debug_flag) {
 
 2817                                                $payload .= 
"<!-- Content being gzipped -->";
 
 2819                                        $this->outgoing_headers[] = 
"Content-Encoding: gzip";
 
 2820                                        $payload = gzencode($payload);
 
 2822                                        if (isset($this->debug_flag) && $this->debug_flag) {
 
 2823                                                $payload .= 
"<!-- Content will not be gzipped: no gzencode -->";
 
 2829                $this->outgoing_headers[] = 
"Content-Length: ".strlen($payload);
 
 2830                reset($this->outgoing_headers);
 
 2831                foreach($this->outgoing_headers as $hdr){
 
 2832                        header($hdr, 
false);
 
 2834                $this->response = join(
"\r\n",$this->outgoing_headers).
"\r\n".$payload;
 
 2847                if(isset($this->
wsdl) && is_object($this->
wsdl)){
 
 2851            } elseif(isset($this->operations[$operation])){
 
 2883                if($this->externalWSDLURL){
 
 2884                        die(
'You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
 
 2892                if(
false == $soapaction) {
 
 2895                        $soapaction = 
"http://$SERVER_NAME$SCRIPT_NAME/$name";
 
 2897                if(
false == $style) {
 
 2904                $this->operations[
$name] = array(
 
 2909            'soapaction' => $soapaction,
 
 2926        function fault($faultcode,$faultstring,$faultactor=
'',$faultdetail=
''){
 
 2927                $this->
fault = 
new soap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
 
 2937                <html><head><title>NuSOAP: '.$this->wsdl->serviceName.
'</title> 
 2938                <style type="text/css"> 
 2939                    body    { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; } 
 2940                    p       { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; } 
 2941                    pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;} 
 2942                    ul      { margin-top: 10px; margin-left: 20px; } 
 2943                    li      { list-style-type: none; margin-top: 10px; color: #000000; } 
 2945                        margin-left: 0px; padding-bottom: 2em; } 
 2947                        padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em; 
 2948                        margin-top: 10px; margin-left: 0px; color: #000000; 
 2949                        background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; } 
 2951                        font-family: arial; font-size: 26px; color: #ffffff; 
 2952                        background-color: #999999; width: 105%; margin-left: 0px; 
 2953                        padding-top: 10px; padding-bottom: 10px; padding-left: 15px;} 
 2955                        position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px; 
 2956                        font-family: arial; overflow: hidden; width: 600; 
 2957                        padding: 20px; font-size: 10px; background-color: #999999; 
 2958                        layer-background-color:#FFFFFF; } 
 2959                    a,a:active  { color: charcoal; font-weight: bold; } 
 2960                    a:visited   { color: #666666; font-weight: bold; } 
 2961                    a:hover     { color: cc3300; font-weight: bold; } 
 2963                <script language="JavaScript" type="text/javascript"> 
 2965                // POP-UP CAPTIONS... 
 2966                function lib_bwcheck(){ //Browsercheck (needed) 
 2967                    this.ver=navigator.appVersion 
 2968                    this.agent=navigator.userAgent 
 2969                    this.dom=document.getElementById?1:0 
 2970                    this.opera5=this.agent.indexOf("Opera 5")>-1 
 2971                    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
 2972                    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0; 
 2973                    this.ie4=(document.all && !this.dom && !this.opera5)?1:0; 
 2974                    this.ie=this.ie4||this.ie5||this.ie6 
 2975                    this.mac=this.agent.indexOf("Mac")>-1 
 2976                    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 2977                    this.ns4=(document.layers && !this.dom)?1:0; 
 2978                    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5) 
 2981                var bw = new lib_bwcheck() 
 2982                //Makes crossbrowser object. 
 2983                function makeObj(obj){ 
 2984                    this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0; 
 2985                    if(!this.evnt) return false 
 2986                    this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0; 
 2987                    this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0; 
 2988                    this.writeIt=b_writeIt; 
 2991                // A unit of measure that will be added when setting the position of a layer. 
 2992                //var px = bw.ns4||window.opera?"":"px"; 
 2993                function b_writeIt(text){ 
 2994                    if (bw.ns4){this.wref.write(text);this.wref.close()} 
 2995                    else this.wref.innerHTML = text 
 2997                //Shows the messages 
 2999                function popup(divid){ 
 3000                    if(oDesc = new makeObj(divid)){ 
 3001                        oDesc.css.visibility = "visible" 
 3004                function popout(){ // Hides message 
 3005                    if(oDesc) oDesc.css.visibility = "hidden" 
 3013                        <div class=title>'.$this->
wsdl->serviceName.
'</div> 
 3015                                <p>View the <a href="'.(isset(
$GLOBALS[
'PHP_SELF']) ? 
$GLOBALS[
'PHP_SELF'] : 
$_SERVER[
'PHP_SELF']).
'?wsdl">WSDL</a> for the service. 
 3016                                Click on an operation name to view it's details.</p> 
 3019                                    $b .= 
"<li><a href='#' onclick=\"popup('$op')\">$op</a></li>";
 
 3021                                    $b .= 
"<div id='$op' class='hidden'> 
 3022                                    <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
 
 3023                                    foreach(
$data as $donnie => $marie){ 
 
 3024                                                if($donnie == 
'input' || $donnie == 
'output'){ 
 
 3025                                                    $b .= 
"<font color='white'>".ucfirst($donnie).
':</font><br>';
 
 3026                                                    foreach($marie as $captain => $tenille){ 
 
 3027                                                                if($captain == 
'parts'){ 
 
 3028                                                                    $b .= 
"  $captain:<br>";
 
 3030                                                                        foreach($tenille as $joanie => $chachi){
 
 3031                                                                                        $b .= 
"    $joanie: $chachi<br>";
 
 3035                                                                    $b .= 
"  $captain: $tenille<br>";
 
 3039                                                    $b .= 
"<font color='white'>".ucfirst($donnie).
":</font> $marie<br>";
 
 3047                </div></body></html>';
 
 3062    function configureWSDL($serviceName,
$namespace = 
false,$endpoint = 
false,$style=
'rpc', $transport = 
'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = 
false)
 
 3066                if ($SERVER_PORT == 80) {
 
 3069                        $SERVER_PORT = 
':' . $SERVER_PORT;
 
 3073            $namespace = 
"http://$SERVER_NAME/soap/$serviceName";
 
 3076        if(
false == $endpoint) {
 
 3079                } elseif (isset(
$GLOBALS[
'HTTPS'])) {
 
 3084                if ($HTTPS == 
'1' || $HTTPS == 
'on') {
 
 3089            $endpoint = 
"$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
 
 3092        if(
false == $schemaTargetNamespace) {
 
 3097                $this->
wsdl->serviceName = $serviceName;
 
 3098        $this->
wsdl->endpoint = $endpoint;
 
 3100                $this->
wsdl->namespaces[
'soap'] = 
'http://schemas.xmlsoap.org/wsdl/soap/';
 
 3101                $this->
wsdl->namespaces[
'wsdl'] = 
'http://schemas.xmlsoap.org/wsdl/';
 
 3103                        $this->
wsdl->namespaces[
'types'] = $schemaTargetNamespace;
 
 3105        $this->
wsdl->schemas[$schemaTargetNamespace][0] = 
new xmlschema(
'', 
'', $this->
wsdl->namespaces);
 
 3106        $this->
wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
 
 3107        $this->
wsdl->schemas[$schemaTargetNamespace][0]->imports[
'http://schemas.xmlsoap.org/soap/encoding/'][0] = array(
'location' => 
'', 
'loaded' => 
true);
 
 3108        $this->
wsdl->schemas[$schemaTargetNamespace][0]->imports[
'http://schemas.xmlsoap.org/wsdl/'][0] = array(
'location' => 
'', 
'loaded' => 
true);
 
 3109        $this->
wsdl->bindings[$serviceName.
'Binding'] = array(
 
 3110                'name'=>$serviceName.
'Binding',
 
 3112            'transport'=>$transport,
 
 3113            'portType'=>$serviceName.
'PortType');
 
 3114        $this->
wsdl->ports[$serviceName.
'Port'] = array(
 
 3115                'binding'=>$serviceName.
'Binding',
 
 3116            'location'=>$endpoint,
 
 3117            'bindingType'=>
'http://schemas.xmlsoap.org/wsdl/soap/');
 
 3192            $this->
debug(
'initial wsdl URL: ' . $wsdl);
 
 3197                $imported_urls = array();
 
 3199                while ($imported > 0) {
 
 3202                        foreach ($this->schemas as $ns => $list) {
 
 3203                                foreach ($list as $xs) {
 
 3204                                                $wsdlparts = parse_url($this->
wsdl);    
 
 3205                                    foreach ($xs->imports as $ns2 => $list2) {
 
 3206                                        for ($ii = 0; $ii < count($list2); $ii++) {
 
 3207                                                if (! $list2[$ii][
'loaded']) {
 
 3208                                                        $this->schemas[$ns]->imports[$ns2][$ii][
'loaded'] = 
true;
 
 3209                                                        $url = $list2[$ii][
'location'];
 
 3211                                                                                $urlparts = parse_url(
$url);
 
 3212                                                                                if (!isset($urlparts[
'host'])) {
 
 3213                                                                                        $url = $wsdlparts[
'scheme'] . 
'://' . $wsdlparts[
'host'] . 
 
 3214                                                                                                        substr($wsdlparts[
'path'],0,strrpos($wsdlparts[
'path'],
'/') + 1) .$urlparts[
'path'];
 
 3216                                                                                if (! in_array(
$url, $imported_urls)) {
 
 3219                                                                        $imported_urls[] = 
$url;
 
 3222                                                                                $this->
debug(
"Unexpected scenario: empty URL for unloaded import");
 
 3230                                $wsdlparts = parse_url($this->
wsdl);    
 
 3231                    foreach ($this->
import as $ns => $list) {
 
 3232                        for ($ii = 0; $ii < count($list); $ii++) {
 
 3233                                if (! $list[$ii][
'loaded']) {
 
 3234                                        $this->
import[$ns][$ii][
'loaded'] = 
true;
 
 3235                                        $url = $list[$ii][
'location'];
 
 3237                                                                $urlparts = parse_url(
$url);
 
 3238                                                                if (!isset($urlparts[
'host'])) {
 
 3239                                                                        $url = $wsdlparts[
'scheme'] . 
'://' . $wsdlparts[
'host'] . 
 
 3240                                                                                        substr($wsdlparts[
'path'],0,strrpos($wsdlparts[
'path'],
'/') + 1) .$urlparts[
'path'];
 
 3242                                                                if (! in_array(
$url, $imported_urls)) {
 
 3245                                                        $imported_urls[] = 
$url;
 
 3248                                                                $this->
debug(
"Unexpected scenario: empty URL for unloaded import");
 
 3255        foreach($this->bindings as $binding => $bindingData) {
 
 3256            if (isset($bindingData[
'operations']) && is_array($bindingData[
'operations'])) {
 
 3257                foreach($bindingData[
'operations'] as $operation => 
$data) {
 
 3258                    $this->
debug(
'post-parse data gathering for ' . $operation);
 
 3259                    $this->bindings[$binding][
'operations'][$operation][
'input'] = 
 
 3260                                                isset($this->bindings[$binding][
'operations'][$operation][
'input']) ? 
 
 3261                                                array_merge($this->bindings[$binding][
'operations'][$operation][
'input'], $this->portTypes[ $bindingData[
'portType'] ][$operation][
'input']) :
 
 3262                                                $this->portTypes[ $bindingData[
'portType'] ][$operation][
'input'];
 
 3263                    $this->bindings[$binding][
'operations'][$operation][
'output'] = 
 
 3264                                                isset($this->bindings[$binding][
'operations'][$operation][
'output']) ?
 
 3265                                                array_merge($this->bindings[$binding][
'operations'][$operation][
'output'], $this->portTypes[ $bindingData[
'portType'] ][$operation][
'output']) :
 
 3266                                                $this->portTypes[ $bindingData[
'portType'] ][$operation][
'output'];
 
 3267                    if(isset($this->messages[ $this->bindings[$binding][
'operations'][$operation][
'input'][
'message'] ])){
 
 3268                                                $this->bindings[$binding][
'operations'][$operation][
'input'][
'parts'] = $this->messages[ $this->bindings[$binding][
'operations'][$operation][
'input'][
'message'] ];
 
 3270                                        if(isset($this->messages[ $this->bindings[$binding][
'operations'][$operation][
'output'][
'message'] ])){
 
 3271                                $this->bindings[$binding][
'operations'][$operation][
'output'][
'parts'] = $this->messages[ $this->bindings[$binding][
'operations'][$operation][
'output'][
'message'] ];
 
 3273                                        if (isset($bindingData[
'style'])) {
 
 3274                        $this->bindings[$binding][
'operations'][$operation][
'style'] = $bindingData[
'style'];
 
 3276                    $this->bindings[$binding][
'operations'][$operation][
'transport'] = isset($bindingData[
'transport']) ? $bindingData[
'transport'] : 
'';
 
 3277                    $this->bindings[$binding][
'operations'][$operation][
'documentation'] = isset($this->portTypes[ $bindingData[
'portType'] ][$operation][
'documentation']) ? $this->portTypes[ $bindingData[
'portType'] ][$operation][
'documentation'] : 
'';
 
 3278                    $this->bindings[$binding][
'operations'][$operation][
'endpoint'] = isset($bindingData[
'endpoint']) ? $bindingData[
'endpoint'] : 
'';
 
 3293            $this->
debug(
'no wsdl passed to parseWSDL()!!');
 
 3294            $this->
setError(
'no wsdl passed to parseWSDL()!!');
 
 3299        $wsdl_props = parse_url(
$wsdl);
 
 3301        if (isset($wsdl_props[
'scheme']) && ($wsdl_props[
'scheme'] == 
'http' || $wsdl_props[
'scheme'] == 
'https')) {
 
 3302            $this->
debug(
'getting WSDL http(s) URL ' . $wsdl);
 
 3305                        $tr->request_method = 
'GET';
 
 3306                        $tr->useSOAPAction = 
false;
 
 3307                        if($this->proxyhost && $this->proxyport){
 
 3308                                $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
 
 3310                        if (isset($wsdl_props[
'user'])) {
 
 3311                $tr->setCredentials($wsdl_props[
'user'],$wsdl_props[
'pass']);
 
 3313                        $wsdl_string = $tr->send(
'', $this->timeout, $this->response_timeout);
 
 3316                        $this->
debug(
"transport debug data...\n" . $tr->debug_str);
 
 3318                        if($err = $tr->getError() ){
 
 3319                                $errstr = 
'HTTP ERROR: '.$err;
 
 3320                                $this->
debug($errstr);
 
 3328                if (isset($wsdl_props[
'scheme']) && ($wsdl_props[
'scheme'] == 
'file') && isset($wsdl_props[
'path'])) {
 
 3329                        $path = isset($wsdl_props[
'host']) ? ($wsdl_props[
'host'] . 
':' . $wsdl_props[
'path']) : $wsdl_props[
'path'];
 
 3333            $this->
debug(
'getting WSDL file ' . $path);
 
 3334            if ($fp = @fopen($path, 
'r')) {
 
 3336                while (
$data = fread($fp, 32768)) {
 
 3337                    $wsdl_string .= 
$data;
 
 3341                $errstr = 
"Bad path to WSDL file $path";
 
 3342                $this->
debug($errstr);
 
 3349        $this->parser = xml_parser_create(); 
 
 3352        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); 
 
 3354        xml_set_object($this->parser, $this); 
 
 3356        xml_set_element_handler($this->parser, 
'start_element', 
'end_element');
 
 3357        xml_set_character_data_handler($this->parser, 
'character_data');
 
 3359        if (!xml_parse($this->parser, $wsdl_string, 
true)) {
 
 3362                                'XML error parsing WSDL from %s on line %d: %s',
 
 3364                xml_get_current_line_number($this->parser),
 
 3365                xml_error_string(xml_get_error_code($this->parser))
 
 3367            $this->
debug($errstr);
 
 3368                        $this->
debug(
"XML payload:\n" . $wsdl_string);
 
 3373        xml_parser_free($this->parser);
 
 3391        if ($this->status == 
'schema') {
 
 3392            $this->currentSchema->schemaStartElement(
$parser, 
$name, $attrs);
 
 3393            $this->debug_str .= $this->currentSchema->debug_str;
 
 3394            $this->currentSchema->debug_str = 
'';
 
 3395        } elseif (ereg(
'schema$', 
$name)) {
 
 3397            $this->status = 
'schema';
 
 3398            $this->currentSchema = 
new xmlschema(
'', 
'', $this->namespaces);
 
 3399            $this->currentSchema->schemaStartElement(
$parser, 
$name, $attrs);
 
 3400            $this->debug_str .= $this->currentSchema->debug_str;
 
 3401            $this->currentSchema->debug_str = 
'';
 
 3404            $pos = $this->position++;
 
 3407            $this->depth_array[
$depth] = $pos;
 
 3408            $this->message[$pos] = array(
'cdata' => 
''); 
 
 3410            if (ereg(
':', 
$name)) {
 
 3412                $prefix = substr(
$name, 0, strpos(
$name, 
':')); 
 
 3414                $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : 
''; 
 
 3419            if (count($attrs) > 0) {
 
 3420                foreach($attrs as $k => $v) {
 
 3422                    if (ereg(
"^xmlns", $k)) {
 
 3423                        if ($ns_prefix = substr(strrchr($k, 
':'), 1)) {
 
 3424                            $this->namespaces[$ns_prefix] = $v;
 
 3426                            $this->namespaces[
'ns' . (count($this->namespaces) + 1)] = $v;
 
 3428                        if ($v == 
'http://www.w3.org/2001/XMLSchema' || $v == 
'http://www.w3.org/1999/XMLSchema') {
 
 3429                            $this->XMLSchemaVersion = $v;
 
 3430                            $this->namespaces[
'xsi'] = $v . 
'-instance';
 
 3434                    $k = strpos($k, 
':') ? $this->
expandQname($k) : $k;
 
 3435                    if ($k != 
'location' && $k != 
'soapAction' && $k != 
'namespace') {
 
 3436                        $v = strpos($v, 
':') ? $this->
expandQname($v) : $v;
 
 3445            switch ($this->status) {
 
 3447                    if (
$name == 
'part') {
 
 3448                        if (isset($attrs[
'type'])) {
 
 3449                                    $this->
debug(
"msg " . $this->currentMessage . 
": found part $attrs[name]: " . implode(
',', $attrs));
 
 3452                                    if (isset($attrs[
'element'])) {
 
 3460                                        $this->currentPortOperation = $attrs[
'name'];
 
 3461                                        $this->
debug(
"portType $this->currentPortType operation: $this->currentPortOperation");
 
 3462                                        if (isset($attrs[
'parameterOrder'])) {
 
 3466                                            case 'documentation':
 
 3467                                                $this->documentation = 
true;
 
 3471                                                $m = isset($attrs[
'message']) ? $this->
getLocalPart($attrs[
'message']) : 
'';
 
 3480                                            if (isset($attrs[
'style'])) {
 
 3483                                                $this->bindings[
$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
 
 3489                                                    if (isset($attrs[
'soapAction'])) {
 
 3492                                                    if (isset($attrs[
'style'])) {
 
 3495                                                    if (isset($attrs[
'name'])) {
 
 3496                                                        $this->currentOperation = $attrs[
'name'];
 
 3497                                                        $this->
debug(
"current binding operation: $this->currentOperation");
 
 3504                                                    $this->opStatus = 
'input';
 
 3507                                                    $this->opStatus = 
'output';
 
 3510                                                    if (isset($this->bindings[$this->currentBinding][
'operations'][$this->currentOperation][$this->opStatus])) {
 
 3521                                                $this->currentPort = $attrs[
'name'];
 
 3522                                                $this->
debug(
'current port: ' . $this->currentPort);
 
 3530                                                $this->bindings[ $this->ports[
$this->currentPort][
'binding'] ][
'endpoint'] = $attrs[
'location'];
 
 3538                            if (isset($attrs[
'location'])) {
 
 3539                    $this->
import[$attrs[
'namespace']][] = array(
'location' => $attrs[
'location'], 
'loaded' => 
false);
 
 3540                    $this->
debug(
'parsing import ' . $attrs[
'namespace']. 
' - ' . $attrs[
'location'] . 
' (' . count($this->
import[$attrs[
'namespace']]).
')');
 
 3542                    $this->
import[$attrs[
'namespace']][] = array(
'location' => 
'', 
'loaded' => 
true);
 
 3544                                                $this->namespaces[
'ns'.(count($this->namespaces)+1)] = $attrs[
'namespace'];
 
 3546                    $this->
debug(
'parsing import ' . $attrs[
'namespace']. 
' - [no location] (' . count($this->
import[$attrs[
'namespace']]).
')');
 
 3554                                $this->status = 
'message';
 
 3555                                $this->messages[$attrs[
'name']] = array();
 
 3556                                $this->currentMessage = $attrs[
'name'];
 
 3559                                $this->status = 
'portType';
 
 3560                                $this->portTypes[$attrs[
'name']] = array();
 
 3561                                $this->currentPortType = $attrs[
'name'];
 
 3564                                if (isset($attrs[
'name'])) {
 
 3566                                        if (strpos($attrs[
'name'], 
':')) {
 
 3567                                        $this->currentBinding = $this->
getLocalPart($attrs[
'name']);
 
 3569                                        $this->currentBinding = $attrs[
'name'];
 
 3571                                        $this->status = 
'binding';
 
 3573                                        $this->
debug(
"current binding: $this->currentBinding of portType: " . $attrs[
'type']);
 
 3577                                $this->serviceName = $attrs[
'name'];
 
 3578                                $this->status = 
'service';
 
 3579                                $this->
debug(
'current service: ' . $this->serviceName);
 
 3582                                foreach ($attrs as 
$name => $value) {
 
 3583                                        $this->wsdl_info[
$name] = $value;
 
 3599                if ( ereg(
'schema$', 
$name)) {
 
 3603                if ($this->status == 
'schema') {
 
 3604                        $this->currentSchema->schemaEndElement(
$parser, 
$name);
 
 3610                if ($this->documentation) {
 
 3613                        $this->documentation = 
false;
 
 3626                $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[
$this->depth] : 0;
 
 3627                if (isset($this->message[$pos][
'cdata'])) {
 
 3628                        $this->message[$pos][
'cdata'] .= 
$data;
 
 3630                if ($this->documentation) {
 
 3631                        $this->documentation .= 
$data;
 
 3637                if (is_array($this->bindings[$binding])) {
 
 3638                        return $this->bindings[$binding];
 
 3652                if ($bindingType == 
'soap') {
 
 3653                        $bindingType = 
'http://schemas.xmlsoap.org/wsdl/soap/';
 
 3656                foreach($this->ports as $port => $portData) {
 
 3658                        if ($portData[
'bindingType'] == $bindingType) {
 
 3663                                if (isset($this->bindings[ $portData[
'binding'] ][
'operations'])) {
 
 3664                                        $ops = array_merge ($ops, $this->bindings[ $portData[
'binding'] ][
'operations']);
 
 3681                if ($bindingType == 
'soap') {
 
 3682                        $bindingType = 
'http://schemas.xmlsoap.org/wsdl/soap/';
 
 3685                foreach($this->ports as $port => $portData) {
 
 3687                        if ($portData[
'bindingType'] == $bindingType) {
 
 3690                                foreach(array_keys($this->bindings[ $portData[
'binding'] ][
'operations']) as $bOperation) {
 
 3691                                        if ($operation == $bOperation) {
 
 3692                                                $opData = $this->bindings[ $portData[
'binding'] ][
'operations'][$operation];
 
 3719                if ((! $ns) && isset($this->namespaces[
'tns'])) {
 
 3720                        $ns = $this->namespaces[
'tns'];
 
 3722                if (isset($this->schemas[$ns])) {
 
 3723                        foreach ($this->schemas[$ns] as $xs) {
 
 3724                                $t = $xs->getTypeDef(
$type);
 
 3725                                $this->debug_str .= $xs->debug_str;
 
 3726                                $xs->debug_str = 
'';
 
 3743                $xml = 
'<?xml version="1.0" encoding="ISO-8859-1"?><definitions';
 
 3744                foreach($this->namespaces as $k => $v) {
 
 3745                        $xml .= 
" xmlns:$k=\"$v\"";
 
 3748                if (isset($this->namespaces[
'wsdl'])) {
 
 3749                        $xml .= 
" xmlns=\"" . $this->namespaces[
'wsdl'] . 
"\"";
 
 3751                if (isset($this->namespaces[
'tns'])) {
 
 3752                        $xml .= 
" targetNamespace=\"" . $this->namespaces[
'tns'] . 
"\"";
 
 3756                if (
sizeof($this->
import) > 0) {
 
 3757                        foreach($this->
import as $ns => $list) {
 
 3758                                foreach ($list as $ii) {
 
 3759                                        if ($ii[
'location'] != 
'') {
 
 3760                                                $xml .= 
'<import location="' . $ii[
'location'] . 
'" namespace="' . $ns . 
'" />';
 
 3762                                                $xml .= 
'<import namespace="' . $ns . 
'" />';
 
 3768                if (count($this->schemas)>=1) {
 
 3770                        foreach ($this->schemas as $ns => $list) {
 
 3771                                foreach ($list as $xs) {
 
 3772                                        $xml .= $xs->serializeSchema();
 
 3778                if (count($this->messages) >= 1) {
 
 3779                        foreach($this->messages as $msgName => $msgParts) {
 
 3780                                $xml .= 
'<message name="' . $msgName . 
'">';
 
 3781                                if(is_array($msgParts)){
 
 3782                                        foreach($msgParts as $partName => $partType) {
 
 3784                                                if (strpos($partType, 
':')) {
 
 3786                                                } elseif (isset($this->typemap[$this->namespaces[
'xsd']][$partType])) {
 
 3788                                                    $typePrefix = 
'xsd';
 
 3790                                                    foreach($this->typemap as $ns => $types) {
 
 3791                                                        if (isset($types[$partType])) {
 
 3795                                                    if (!isset($typePrefix)) {
 
 3796                                                        die(
"$partType has no namespace!");
 
 3799                                                $xml .= 
'<part name="' . $partName . 
'" type="' . $typePrefix . 
':' . $this->
getLocalPart($partType) . 
'" />';
 
 3802                                $xml .= 
'</message>';
 
 3806                if (count($this->bindings) >= 1) {
 
 3809                        foreach($this->bindings as $bindingName => $attrs) {
 
 3810                                $binding_xml .= 
'<binding name="' . $bindingName . 
'" type="tns:' . $attrs[
'portType'] . 
'">';
 
 3811                                $binding_xml .= 
'<soap:binding style="' . $attrs[
'style'] . 
'" transport="' . $attrs[
'transport'] . 
'"/>';
 
 3812                                $portType_xml .= 
'<portType name="' . $attrs[
'portType'] . 
'">';
 
 3813                                foreach($attrs[
'operations'] as $opName => $opParts) {
 
 3814                                        $binding_xml .= 
'<operation name="' . $opName . 
'">';
 
 3815                                        $binding_xml .= 
'<soap:operation soapAction="' . $opParts[
'soapAction'] . 
'" style="'. $attrs[
'style'] . 
'"/>';
 
 3816                                        if (isset($opParts[
'input'][
'encodingStyle']) && $opParts[
'input'][
'encodingStyle'] != 
'') {
 
 3817                                                $enc_style = 
' encodingStyle="' . $opParts[
'input'][
'encodingStyle'] . 
'"';
 
 3821                                        $binding_xml .= 
'<input><soap:body use="' . $opParts[
'input'][
'use'] . 
'" namespace="' . $opParts[
'input'][
'namespace'] . 
'"' . $enc_style . 
'/></input>';
 
 3822                                        if (isset($opParts[
'output'][
'encodingStyle']) && $opParts[
'output'][
'encodingStyle'] != 
'') {
 
 3823                                                $enc_style = 
' encodingStyle="' . $opParts[
'output'][
'encodingStyle'] . 
'"';
 
 3827                                        $binding_xml .= 
'<output><soap:body use="' . $opParts[
'output'][
'use'] . 
'" namespace="' . $opParts[
'output'][
'namespace'] . 
'"' . $enc_style . 
'/></output>';
 
 3828                                        $binding_xml .= 
'</operation>';
 
 3829                                        $portType_xml .= 
'<operation name="' . $opParts[
'name'] . 
'"';
 
 3830                                        if (isset($opParts[
'parameterOrder'])) {
 
 3831                                            $portType_xml .= 
' parameterOrder="' . $opParts[
'parameterOrder'] . 
'"';
 
 3833                                        $portType_xml .= 
'>';
 
 3834                                        if(isset($opParts[
'documentation']) && $opParts[
'documentation'] != 
'') {
 
 3835                                                $portType_xml .= 
'<documentation>' . htmlspecialchars($opParts[
'documentation']) . 
'</documentation>';
 
 3837                                        $portType_xml .= 
'<input message="tns:' . $opParts[
'input'][
'message'] . 
'"/>';
 
 3838                                        $portType_xml .= 
'<output message="tns:' . $opParts[
'output'][
'message'] . 
'"/>';
 
 3839                                        $portType_xml .= 
'</operation>';
 
 3841                                $portType_xml .= 
'</portType>';
 
 3842                                $binding_xml .= 
'</binding>';
 
 3844                        $xml .= $portType_xml . $binding_xml;
 
 3847                $xml .= 
'<service name="' . $this->serviceName . 
'">';
 
 3848                if (count($this->ports) >= 1) {
 
 3849                        foreach($this->ports as $pName => $attrs) {
 
 3850                                $xml .= 
'<port name="' . $pName . 
'" binding="tns:' . $attrs[
'binding'] . 
'">';
 
 3851                                $xml .= 
'<soap:address location="' . $attrs[
'location'] . 
'"/>';
 
 3855                $xml .= 
'</service>';
 
 3856                return $xml . 
'</definitions>';
 
 3872                $this->
debug(
'in serializeRPCParameters with operation '.$operation.
', direction '.$direction.
' and '.count($parameters).
' param(s), and xml schema version ' . $this->XMLSchemaVersion); 
 
 3874                if ($direction != 
'input' && $direction != 
'output') {
 
 3875                        $this->
debug(
'The value of the \$direction argument needs to be either "input" or "output"');
 
 3876                        $this->
setError(
'The value of the \$direction argument needs to be either "input" or "output"');
 
 3880                        $this->
debug(
'Unable to retrieve WSDL data for operation: ' . $operation);
 
 3881                        $this->
setError(
'Unable to retrieve WSDL data for operation: ' . $operation);
 
 3887                $encodingStyle = 
'http://schemas.xmlsoap.org/soap/encoding/';
 
 3888                if(($direction == 
'input') && isset(
$opData[
'output'][
'encodingStyle']) && (
$opData[
'output'][
'encodingStyle'] != $encodingStyle)) {
 
 3889                        $encodingStyle = 
$opData[
'output'][
'encodingStyle'];
 
 3890                        $enc_style = $encodingStyle;
 
 3895                if (isset(
$opData[$direction][
'parts']) && 
sizeof(
$opData[$direction][
'parts']) > 0) {
 
 3897                        $use = 
$opData[$direction][
'use'];
 
 3898                        $this->
debug(
"use=$use");
 
 3899                        $this->
debug(
'got ' . count(
$opData[$direction][
'parts']) . 
' part(s)');
 
 3900                        if (is_array($parameters)) {
 
 3902                                $this->
debug(
'have ' . $parametersArrayType . 
' parameters');
 
 3906                                        if (isset(
$opData[$direction][
'encodingStyle']) && $encodingStyle != 
$opData[$direction][
'encodingStyle']) {
 
 3907                                                $encodingStyle = 
$opData[$direction][
'encodingStyle'];                  
 
 3908                                                $enc_style = $encodingStyle;
 
 3914                                        if ($parametersArrayType == 
'arraySimple') {
 
 3915                                                $p = array_shift($parameters);
 
 3916                                                $this->
debug(
'calling serializeType w/indexed param');
 
 3918                                        } elseif (isset($parameters[
$name])) {
 
 3919                                                $this->
debug(
'calling serializeType w/named param');
 
 3923                                                $this->
debug(
'calling serializeType w/null param');
 
 3928                                $this->
debug(
'no parameters passed.');
 
 3947                $this->
debug(
'in serializeParameters with operation '.$operation.
', direction '.$direction.
' and '.count($parameters).
' param(s), and xml schema version ' . $this->XMLSchemaVersion); 
 
 3949                if ($direction != 
'input' && $direction != 
'output') {
 
 3950                        $this->
debug(
'The value of the \$direction argument needs to be either "input" or "output"');
 
 3951                        $this->
setError(
'The value of the \$direction argument needs to be either "input" or "output"');
 
 3955                        $this->
debug(
'Unable to retrieve WSDL data for operation: ' . $operation);
 
 3956                        $this->
setError(
'Unable to retrieve WSDL data for operation: ' . $operation);
 
 3962                $encodingStyle = 
'http://schemas.xmlsoap.org/soap/encoding/';
 
 3963                if(($direction == 
'input') && isset(
$opData[
'output'][
'encodingStyle']) && (
$opData[
'output'][
'encodingStyle'] != $encodingStyle)) {
 
 3964                        $encodingStyle = 
$opData[
'output'][
'encodingStyle'];
 
 3965                        $enc_style = $encodingStyle;
 
 3970                if (isset(
$opData[$direction][
'parts']) && 
sizeof(
$opData[$direction][
'parts']) > 0) {
 
 3972                        $use = 
$opData[$direction][
'use'];
 
 3973                        $this->
debug(
"use=$use");
 
 3974                        $this->
debug(
'got ' . count(
$opData[$direction][
'parts']) . 
' part(s)');
 
 3975                        if (is_array($parameters)) {
 
 3977                                $this->
debug(
'have ' . $parametersArrayType . 
' parameters');
 
 3981                                        if(isset(
$opData[$direction][
'encodingStyle']) && $encodingStyle != 
$opData[$direction][
'encodingStyle']) {
 
 3982                                                $encodingStyle = 
$opData[$direction][
'encodingStyle'];                  
 
 3983                                                $enc_style = $encodingStyle;
 
 3989                                        if ($parametersArrayType == 
'arraySimple') {
 
 3990                                                $p = array_shift($parameters);
 
 3991                                                $this->
debug(
'calling serializeType w/indexed param');
 
 3993                                        } elseif (isset($parameters[
$name])) {
 
 3994                                                $this->
debug(
'calling serializeType w/named param');
 
 3998                                                $this->
debug(
'calling serializeType w/null param');
 
 4003                                $this->
debug(
'no parameters passed.');
 
 4022                $this->
debug(
"in serializeType: $name, $type, $value, $use, $encodingStyle");
 
 4023                if($use == 
'encoded' && $encodingStyle) {
 
 4024                        $encodingStyle = 
' SOAP-ENV:encodingStyle="' . $encodingStyle . 
'"';
 
 4028        if (is_object($value) && get_class($value) == 
'soapval') {
 
 4030                if ($value->type_ns) {
 
 4031                        $type = $value->type_ns . 
':' . $value->type;
 
 4033                        $type = $value->type;
 
 4035                $value = $value->value;
 
 4037                $this->
debug(
"in serializeType: soapval overrides type to $type, value to $value");
 
 4043                if (strpos(
$type, 
':')) {
 
 4044                        $uqType = substr(
$type, strrpos(
$type, 
':') + 1);
 
 4046                        $this->
debug(
"got a prefixed type: $uqType, $ns");
 
 4049                                $this->
debug(
"expanded prefixed type: $uqType, $ns");
 
 4052                        if($ns == $this->XMLSchemaVersion){
 
 4054                                if (is_null($value)) {
 
 4055                                        if ($use == 
'literal') {
 
 4059                                                return "<$name xsi:nil=\"true\"/>";
 
 4062                        if ($uqType == 
'boolean' && !$value) {
 
 4064                                } elseif ($uqType == 
'boolean') {
 
 4067                                if ($uqType == 
'string' && gettype($value) == 
'string') {
 
 4074                                        if ($use == 
'literal') {
 
 4076                                                        return "<$name xsi:type=\"" . $this->
getPrefixFromNamespace($this->XMLSchemaVersion) . 
":$uqType\">$value</$name>";
 
 4078                                                        return "<$name>$value</$name>";
 
 4081                                                return "<$name xsi:type=\"" . $this->
getPrefixFromNamespace($this->XMLSchemaVersion) . 
":$uqType\"$encodingStyle>$value</$name>";
 
 4084                        } 
else if ($ns == 
'http://xml.apache.org/xml-soap') {
 
 4085                                if ($uqType == 
'Map') {
 
 4087                                        foreach($value as $k => $v) {
 
 4088                                                $this->
debug(
"serializing map element: key $k, value $v");
 
 4089                                                $contents .= 
'<item>';
 
 4090                                                $contents .= $this->
serialize_val($k,
'key',
false,
false,
false,
false,$use);
 
 4091                                                $contents .= $this->
serialize_val($v,
'value',
false,
false,
false,
false,$use);
 
 4092                                                $contents .= 
'</item>';
 
 4094                                        if ($use == 
'literal') {
 
 4096                                                return "<$name xsi:type=\"" . $this->
getPrefixFromNamespace(
'http://xml.apache.org/xml-soap') . 
":$uqType\">$contents</$name>";
 
 4098                                                        return "<$name>$contents</$name>";
 
 4101                                                return "<$name xsi:type=\"" . $this->
getPrefixFromNamespace(
'http://xml.apache.org/xml-soap') . 
":$uqType\"$encodingStyle>$contents</$name>";
 
 4106                        $this->
debug(
"No namespace for type $type");
 
 4110                if(!$typeDef = $this->
getTypeDef($uqType, $ns)){
 
 4111                        $this->
setError(
"$type ($uqType) is not a supported type.");
 
 4112                        $this->
debug(
"$type ($uqType) is not a supported type.");
 
 4115                        foreach($typeDef as $k => $v) {
 
 4116                                $this->
debug(
"typedef, $k: $v");
 
 4119                $phpType = $typeDef[
'phpType'];
 
 4120                $this->
debug(
"serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef[
'arrayType']) ? $typeDef[
'arrayType'] : 
'') ); 
 
 4122                if ($phpType == 
'struct') {
 
 4123                        if (isset($typeDef[
'typeClass']) && $typeDef[
'typeClass'] == 
'element') {
 
 4124                                $elementName = $uqType;
 
 4125                                if (isset($typeDef[
'form']) && ($typeDef[
'form'] == 
'qualified')) {
 
 4126                                        $elementNS = 
" xmlns=\"$ns\"";
 
 4129                                $elementName = 
$name;
 
 4132                        if (is_null($value)) {
 
 4133                                if ($use == 
'literal') {
 
 4135                                        return "<$elementName$elementNS/>";
 
 4137                                        return "<$elementName$elementNS xsi:nil=\"true\"/>";
 
 4140                        if ($use == 
'literal') {
 
 4144                                        $xml = 
"<$elementName$elementNS>";
 
 4150                        if (isset($typeDef[
'elements']) && is_array($typeDef[
'elements'])) {
 
 4151                                if (is_array($value)) {
 
 4153                                } elseif (is_object($value)) {
 
 4154                                        $xvalue = get_object_vars($value);
 
 4156                                        $this->
debug(
"value is neither an array nor an object for XML Schema type $ns:$uqType");
 
 4160                                if(count($typeDef[
'elements']) != count($xvalue)){
 
 4163                                foreach($typeDef[
'elements'] as $eName => $attrs) {
 
 4165                                        if(isset($optionals) && !isset($xvalue[$eName])){
 
 4169                                                if (isset($xvalue[$eName])) {
 
 4170                                                    $v = $xvalue[$eName];
 
 4175                                                if (isset($attrs[
'maxOccurs']) && $attrs[
'maxOccurs'] == 
'unbounded' && isset($v) && is_array($v) && $this->
isArraySimpleOrStruct($v) == 
'arraySimple') {
 
 4177                                                        foreach ($vv as $k => $v) {
 
 4178                                                                if (isset($attrs[
'type'])) {
 
 4183                                                                    $this->
debug(
"calling serialize_val() for $v, $eName, false, false, false, false, $use");
 
 4184                                                                    $xml .= $this->
serialize_val($v, $eName, 
false, 
false, 
false, 
false, $use);
 
 4188                                                        if (isset($attrs[
'type'])) {
 
 4193                                                            $this->
debug(
"calling serialize_val() for $v, $eName, false, false, false, false, $use");
 
 4194                                                            $xml .= $this->
serialize_val($v, $eName, 
false, 
false, 
false, 
false, $use);
 
 4200                                $this->
debug(
"Expected elements for XML Schema type $ns:$uqType");
 
 4202                        $xml .= 
"</$elementName>";
 
 4203                } elseif ($phpType == 
'array') {
 
 4204                        if (isset($typeDef[
'form']) && ($typeDef[
'form'] == 
'qualified')) {
 
 4205                                $elementNS = 
" xmlns=\"$ns\"";
 
 4209                        if (is_null($value)) {
 
 4210                                if ($use == 
'literal') {
 
 4212                                        return "<$name$elementNS/>";
 
 4214                                        return "<$name$elementNS xsi:nil=\"true\"/>";
 
 4217                        if (isset($typeDef[
'multidimensional'])) {
 
 4219                                foreach($value as $v) {
 
 4220                                        $cols = 
',' . 
sizeof($v);
 
 4221                                        $nv = array_merge($nv, $v);
 
 4227                        if (is_array($value) && 
sizeof($value) >= 1) {
 
 4228                                $rows = 
sizeof($value);
 
 4230                                foreach($value as $k => $v) {
 
 4231                                        $this->
debug(
"serializing array element: $k, $v of type: $typeDef[arrayType]");
 
 4233                                        if (!in_array($typeDef[
'arrayType'],$this->typemap[
'http://www.w3.org/2001/XMLSchema'])) {
 
 4234                                            $contents .= $this->
serializeType(
'item', $typeDef[
'arrayType'], $v, $use);
 
 4236                                            $contents .= $this->
serialize_val($v, 
'item', $typeDef[
'arrayType'], 
null, $this->XMLSchemaVersion, 
false, $use);
 
 4246                        if ($use == 
'literal') {
 
 4247                                $xml = 
"<$name$elementNS>" 
 4251                                $xml = 
"<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace(
'http://schemas.xmlsoap.org/soap/encoding/').
':Array" '.
 
 4254                                        .$this->getPrefixFromNamespace($this->
getPrefix($typeDef[
'arrayType']))
 
 4255                                        .
":".$this->
getLocalPart($typeDef[
'arrayType']).
"[$rows$cols]\">" 
 4259                } elseif ($phpType == 
'scalar') {
 
 4260                        if (isset($typeDef[
'form']) && ($typeDef[
'form'] == 
'qualified')) {
 
 4261                                $elementNS = 
" xmlns=\"$ns\"";
 
 4265                        if ($use == 
'literal') {
 
 4267                                        return "<$name$elementNS xsi:type=\"" . $this->
getPrefixFromNamespace($ns) . 
":$uqType\">$value</$name>";
 
 4269                                        return "<$name$elementNS>$value</$name>";
 
 4272                                return "<$name$elementNS xsi:type=\"" . $this->
getPrefixFromNamespace($ns) . 
":$uqType\"$encodingStyle>$value</$name>";
 
 4298        function addComplexType(
$name,$typeClass=
'complexType',$phpType=
'array',$compositor=
'',$restrictionBase=
'',$elements=array(),$attrs=array(),$arrayType=
'') {
 
 4299                if (count($elements) > 0) {
 
 4300                foreach($elements as 
$n => 
$e){
 
 4302                    foreach (
$e as $k => $v) {
 
 4303                            $k = strpos($k,
':') ? $this->
expandQname($k) : $k;
 
 4304                            $v = strpos($v,
':') ? $this->
expandQname($v) : $v;
 
 4307                        $eElements[
$n] = $ee;
 
 4309                $elements = $eElements;
 
 4312                if (count($attrs) > 0) {
 
 4313                foreach($attrs as 
$n => 
$a){
 
 4315                    foreach (
$a as $k => $v) {
 
 4316                            $k = strpos($k,
':') ? $this->
expandQname($k) : $k;
 
 4317                            $v = strpos($v,
':') ? $this->
expandQname($v) : $v;
 
 4325                $restrictionBase = strpos($restrictionBase,
':') ? $this->
expandQname($restrictionBase) : $restrictionBase;
 
 4326                $arrayType = strpos($arrayType,
':') ? $this->
expandQname($arrayType) : $arrayType;
 
 4328                $typens = isset($this->namespaces[
'types']) ? $this->namespaces[
'types'] : $this->namespaces[
'tns'];
 
 4329                $this->schemas[$typens][0]->addComplexType(
$name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
 
 4343                $restrictionBase = strpos($restrictionBase,
':') ? $this->
expandQname($restrictionBase) : $restrictionBase;
 
 4345                $typens = isset($this->namespaces[
'types']) ? $this->namespaces[
'types'] : $this->namespaces[
'tns'];
 
 4346                $this->schemas[$typens][0]->addSimpleType(
$name, $restrictionBase, $typeClass, $phpType);
 
 4363                if ($style == 
'rpc' && $use == 
'encoded') {
 
 4364                        $encodingStyle = 
'http://schemas.xmlsoap.org/soap/encoding/';
 
 4366                        $encodingStyle = 
'';
 
 4369                $this->bindings[ $this->serviceName . 
'Binding' ][
'operations'][
$name] =
 
 4372                'binding' => $this->serviceName . 
'Binding',
 
 4373                'endpoint' => $this->endpoint,
 
 4374                'soapAction' => $soapaction,
 
 4379                        'encodingStyle' => $encodingStyle,
 
 4380                        'message' => 
$name . 
'Request',
 
 4385                        'encodingStyle' => $encodingStyle,
 
 4386                        'message' => 
$name . 
'Response',
 
 4389                'transport' => 
'http://schemas.xmlsoap.org/soap/http',
 
 4395                        foreach(
$in as $pName => $pType)
 
 4397                                if(strpos($pType,
':')) {
 
 4400                                $this->messages[
$name.
'Request'][$pName] = $pType;
 
 4403            $this->messages[
$name.
'Request']= 
'0';
 
 4407                        foreach(
$out as $pName => $pType)
 
 4409                                if(strpos($pType,
':')) {
 
 4412                                $this->messages[
$name.
'Response'][$pName] = $pType;
 
 4415            $this->messages[
$name.
'Response']= 
'0';
 
 4477                $this->xml_encoding = $encoding;
 
 4483                        $this->
debug(
'Entering soap_parser(), length='.strlen(
$xml).
', encoding='.$encoding);
 
 4485                        $this->parser = xml_parser_create($this->xml_encoding);
 
 4488                        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
 
 4489                        xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
 
 4491                        xml_set_object($this->parser, $this);
 
 4493                        xml_set_element_handler($this->parser, 
'start_element',
'end_element');
 
 4494                        xml_set_character_data_handler($this->parser,
'character_data');
 
 4497                        if(!xml_parse($this->parser,
$xml,
true)){
 
 4499                            $err = sprintf(
'XML error parsing SOAP payload on line %d: %s',
 
 4500                            xml_get_current_line_number($this->parser),
 
 4501                            xml_error_string(xml_get_error_code($this->parser)));
 
 4503                                $this->
debug(
"XML payload:\n" . $xml);
 
 4506                                $this->
debug(
'parsed successfully, found root struct: '.$this->root_struct.
' of name '.$this->root_struct_name);
 
 4514                                if(
sizeof($this->multirefs) > 0){
 
 4515                                        foreach($this->multirefs as $id => $hrefs){
 
 4516                                                $this->
debug(
'resolving multirefs for id: '.$id);
 
 4517                                                $idVal = $this->
buildVal($this->ids[$id]);
 
 4518                                                foreach($hrefs as $refPos => $ref){
 
 4519                                                        $this->
debug(
'resolving href at pos '.$refPos);
 
 4520                                                        $this->multirefs[$id][$refPos] = $idVal;
 
 4525                        xml_parser_free($this->parser);
 
 4527                        $this->
debug(
'xml was empty, didn\'t parse!');
 
 4528                        $this->
setError(
'xml was empty, didn\'t parse!');
 
 4543                $pos = $this->position++;
 
 4545                $this->message[$pos] = array(
'pos' => $pos,
'children'=>
'',
'cdata'=>
'');
 
 4548                $this->message[$pos][
'depth'] = $this->depth++;
 
 4557                $this->parent = $pos;
 
 4561                if(strpos(
$name,
':')){
 
 4568                if(
$name == 
'Envelope'){
 
 4569                        $this->status = 
'envelope';
 
 4570                } elseif(
$name == 
'Header'){
 
 4571                        $this->root_header = $pos;
 
 4572                        $this->status = 
'header';
 
 4573                } elseif(
$name == 
'Body'){
 
 4574                        $this->status = 
'body';
 
 4575                        $this->body_position = $pos;
 
 4577                } elseif($this->status == 
'body' && $pos == ($this->body_position+1)){
 
 4578                        $this->status = 
'method';
 
 4579                        $this->root_struct_name = 
$name;
 
 4580                        $this->root_struct = $pos;
 
 4581                        $this->message[$pos][
'type'] = 
'struct';
 
 4582                        $this->
debug(
"found root struct $this->root_struct_name, pos $this->root_struct");
 
 4587                $this->message[$pos][
'name'] = htmlspecialchars(
$name);
 
 4589                $this->message[$pos][
'attrs'] = $attrs;
 
 4593                foreach($attrs as $key => $value){
 
 4597            if($key_prefix == 
'xmlns'){
 
 4598                                if(ereg(
'^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
 
 4599                                        $this->XMLSchemaVersion = $value;
 
 4601                                        $this->namespaces[
'xsi'] = $this->XMLSchemaVersion.
'-instance';
 
 4603                $this->namespaces[$key_localpart] = $value;
 
 4605                                if(
$name == $this->root_struct_name){
 
 4606                                        $this->methodNamespace = $value;
 
 4609            } elseif($key_localpart == 
'type'){
 
 4610                $value_prefix = $this->
getPrefix($value);
 
 4612                                $this->message[$pos][
'type'] = $value_localpart;
 
 4613                                $this->message[$pos][
'typePrefix'] = $value_prefix;
 
 4614                if(isset($this->namespaces[$value_prefix])){
 
 4615                        $this->message[$pos][
'type_namespace'] = $this->namespaces[$value_prefix];
 
 4616                } 
else if(isset($attrs[
'xmlns:'.$value_prefix])) {
 
 4617                                        $this->message[$pos][
'type_namespace'] = $attrs[
'xmlns:'.$value_prefix];
 
 4620                        } elseif($key_localpart == 
'arrayType'){
 
 4621                                $this->message[$pos][
'type'] = 
'array';
 
 4630                                $expr = 
'([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
 
 4631                                if(ereg($expr,$value,$regs)){
 
 4632                                        $this->message[$pos][
'typePrefix'] = $regs[1];
 
 4633                                        $this->message[$pos][
'arrayTypePrefix'] = $regs[1];
 
 4634                        if (isset($this->namespaces[$regs[1]])) {
 
 4635                                $this->message[$pos][
'arrayTypeNamespace'] = $this->namespaces[$regs[1]];
 
 4636                        } 
else if (isset($attrs[
'xmlns:'.$regs[1]])) {
 
 4637                                                $this->message[$pos][
'arrayTypeNamespace'] = $attrs[
'xmlns:'.$regs[1]];
 
 4639                                        $this->message[$pos][
'arrayType'] = $regs[2];
 
 4640                                        $this->message[$pos][
'arraySize'] = $regs[3];
 
 4641                                        $this->message[$pos][
'arrayCols'] = $regs[4];
 
 4646                                $this->ids[$value] = $pos;
 
 4649                        if($key_localpart == 
'root' && $value == 1){
 
 4650                                $this->status = 
'method';
 
 4651                                $this->root_struct_name = 
$name;
 
 4652                                $this->root_struct = $pos;
 
 4653                                $this->
debug(
"found root struct $this->root_struct_name, pos $pos");
 
 4656            $attstr .= 
" $key=\"$value\"";
 
 4660                        $this->message[$pos][
'namespace'] = $this->namespaces[$prefix];
 
 4661                        $this->default_namespace = $this->namespaces[$prefix];
 
 4665        if($this->status == 
'header'){
 
 4666                if ($this->root_header != $pos) {
 
 4667                        $this->responseHeaders .= 
"<" . (isset($prefix) ? $prefix . 
':' : 
'') . 
"$name$attstr>";
 
 4669        } elseif($this->root_struct_name != 
''){
 
 4670                $this->document .= 
"<" . (isset($prefix) ? $prefix . 
':' : 
'') . 
"$name$attstr>";
 
 4683                $pos = $this->depth_array[$this->depth--];
 
 4686                if(strpos(
$name,
':')){
 
 4694                if(isset($this->body_position) && $pos > $this->body_position){
 
 4696                        if(isset($this->message[$pos][
'attrs'][
'href'])){
 
 4698                                $id = substr($this->message[$pos][
'attrs'][
'href'],1);
 
 4700                                $this->multirefs[$id][$pos] = 
'placeholder';
 
 4702                                $this->message[$pos][
'result'] =& $this->multirefs[$id][$pos];
 
 4704                        } elseif($this->message[$pos][
'children'] != 
''){
 
 4707                                if(!isset($this->message[$pos][
'result'])){
 
 4708                                        $this->message[$pos][
'result'] = $this->
buildVal($pos);
 
 4714                if (isset($this->message[$pos][
'type'])) {
 
 4715                                        $this->message[$pos][
'result'] = $this->
decodeSimple($this->message[$pos][
'cdata'], $this->message[$pos][
'type'], isset($this->message[$pos][
'type_namespace']) ? $this->message[$pos][
'type_namespace'] : 
'');
 
 4717                                        $parent = $this->message[$pos][
'parent'];
 
 4718                                        if (isset($this->message[
$parent][
'type']) && ($this->message[
$parent][
'type'] == 
'array') && isset($this->message[
$parent][
'arrayType'])) {
 
 4719                                                $this->message[$pos][
'result'] = $this->
decodeSimple($this->message[$pos][
'cdata'], $this->message[
$parent][
'arrayType'], isset($this->message[
$parent][
'arrayTypeNamespace']) ? $this->message[
$parent][
'arrayTypeNamespace'] : 
'');
 
 4721                                                $this->message[$pos][
'result'] = $this->message[$pos][
'cdata'];
 
 4739        if($this->status == 
'header'){
 
 4740                if ($this->root_header != $pos) {
 
 4741                        $this->responseHeaders .= 
"</" . (isset($prefix) ? $prefix . 
':' : 
'') . 
"$name>";
 
 4743        } elseif($pos >= $this->root_struct){
 
 4744                $this->document .= 
"</" . (isset($prefix) ? $prefix . 
':' : 
'') . 
"$name>";
 
 4747                if($pos == $this->root_struct){
 
 4748                        $this->status = 
'body';
 
 4749                        $this->root_struct_namespace = $this->message[$pos][
'namespace'];
 
 4750                } elseif(
$name == 
'Body'){
 
 4751                        $this->status = 
'envelope';
 
 4752                 } elseif(
$name == 
'Header'){
 
 4753                        $this->status = 
'envelope';
 
 4754                } elseif(
$name == 
'Envelope'){
 
 4758                $this->parent = $this->message[$pos][
'parent'];
 
 4770                if ($this->xml_encoding==
'UTF-8'){
 
 4774                        if($this->decode_utf8){
 
 4778        $this->message[$pos][
'cdata'] .= 
$data;
 
 4780        if($this->status == 
'header'){
 
 4781                $this->responseHeaders .= 
$data;
 
 4783                $this->document .= 
$data;
 
 4814                foreach($this->entities as $entity => $encoded){
 
 4815                        $text = str_replace($encoded,$entity,$text);
 
 4831                        return (
string) $value;
 
 4834                        return (
int) $value;
 
 4837                        return (
double) $value;
 
 4839                if (
$type == 
'boolean') {
 
 4840                        if (strtolower($value) == 
'false' || strtolower($value) == 
'f') {
 
 4843                        return (
boolean) $value;
 
 4845                if (
$type == 
'base64' || 
$type == 
'base64Binary') {
 
 4846                        return base64_decode($value);
 
 4849                if (
$type == 
'nonPositiveInteger' || 
$type == 
'negativeInteger' 
 4850                        || 
$type == 
'nonNegativeInteger' || 
$type == 
'positiveInteger' 
 4851                        || 
$type == 
'unsignedInt' 
 4852                        || 
$type == 
'unsignedShort' || 
$type == 
'unsignedByte') {
 
 4853                        return (
int) $value;
 
 4856                return (
string) $value;
 
 4866                if(!isset($this->message[$pos][
'type'])){
 
 4867                        $this->message[$pos][
'type'] = 
'';
 
 4869                $this->
debug(
'inside buildVal() for '.$this->message[$pos][
'name'].
"(pos $pos) of type ".$this->message[$pos][
'type']);
 
 4871                if($this->message[$pos][
'children'] != 
''){
 
 4872                        $children = explode(
'|',$this->message[$pos][
'children']);
 
 4873                        array_shift($children); 
 
 4875                        if(isset($this->message[$pos][
'arrayCols']) && $this->message[$pos][
'arrayCols'] != 
''){
 
 4878                foreach($children as $child_pos){
 
 4879                                        $this->
debug(
"got an MD array element: $r, $c");
 
 4880                                        $params[$r][] = $this->message[$child_pos][
'result'];
 
 4882                                    if(
$c == $this->message[$pos][
'arrayCols']){
 
 4888                        } elseif($this->message[$pos][
'type'] == 
'array' || $this->message[$pos][
'type'] == 
'Array'){
 
 4889                $this->
debug(
'adding array '.$this->message[$pos][
'name']);
 
 4890                foreach($children as $child_pos){
 
 4891                        $params[] = &$this->message[$child_pos][
'result'];
 
 4894            } elseif($this->message[$pos][
'type'] == 
'Map' && $this->message[$pos][
'type_namespace'] == 
'http://xml.apache.org/xml-soap'){
 
 4895                foreach($children as $child_pos){
 
 4896                        $kv = explode(
"|",$this->message[$child_pos][
'children']);
 
 4897                        $params[$this->message[$kv[1]][
'result']] = &$this->message[$kv[2]][
'result'];
 
 4903                                if ($this->message[$pos][
'type'] == 
'Vector' && $this->message[$pos][
'type_namespace'] == 
'http://xml.apache.org/xml-soap') {
 
 4907                        foreach($children as $child_pos){
 
 4908                                if(isset(
$keys) && isset(
$keys[$this->message[$child_pos][
'name']])){
 
 4912                                $keys[$this->message[$child_pos][
'name']] = 1;
 
 4916                foreach($children as $child_pos){
 
 4917                        if(isset($notstruct)){
 
 4918                                $params[] = &$this->message[$child_pos][
'result'];
 
 4920                                if (isset($params[$this->message[$child_pos][
'name']])) {
 
 4922                                        if (!is_array($params[$this->message[$child_pos][
'name']])) {
 
 4923                                                $params[$this->message[$child_pos][
'name']] = array($params[$this->message[$child_pos][
'name']]);
 
 4925                                        $params[$this->message[$child_pos][
'name']][] = &$this->message[$child_pos][
'result'];
 
 4927                                                $params[$this->message[$child_pos][
'name']] = &$this->message[$child_pos][
'result'];
 
 4932                        return is_array($params) ? $params : array();
 
 4934                $this->
debug(
'no children');
 
 4935            if(strpos($this->message[$pos][
'cdata'],
'&')){
 
 4936                        return  strtr($this->message[$pos][
'cdata'],array_flip($this->entities));
 
 4938                return $this->message[$pos][
'cdata'];
 
 5031                        $this->endpointType = 
'wsdl';
 
 5034                                $this->endpoint = $this->
wsdl->
wsdl;
 
 5036                                $this->
debug(
'existing wsdl instance created from ' . $this->endpoint);
 
 5041                                $this->
debug(
'instantiating wsdl class with doc: '.$endpoint);
 
 5042                                $this->
wsdl =& 
new wsdl($this->wsdlFile,$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout);
 
 5044                        $this->
debug(
"wsdl debug...\n".$this->
wsdl->debug_str);
 
 5045                        $this->
wsdl->debug_str = 
'';
 
 5048                                $this->
debug(
'got wsdl error: '.$errstr);
 
 5049                                $this->
setError(
'wsdl error: '.$errstr);
 
 5051                                $this->
debug( 
'got '.count($this->operations).
' operations from wsdl '.$this->wsdlFile);
 
 5053                                $this->
debug( 
'getOperations returned false');
 
 5054                                $this->
setError(
'no operations defined in the WSDL document!');
 
 5084        function call($operation,$params=array(),
$namespace=
'',$soapAction=
'',$headers=
false,$rpcParams=
null,$style=
'rpc',$use=
'encoded'){
 
 5085                $this->operation = $operation;
 
 5086                $this->fault = 
false;
 
 5087                $this->error_str = 
'';
 
 5088                $this->request = 
'';
 
 5089                $this->response = 
'';
 
 5090                $this->responseData = 
'';
 
 5091                $this->faultstring = 
'';
 
 5092                $this->faultcode = 
'';
 
 5093                $this->opData = array();
 
 5095                $this->
debug(
"call: $operation, $params, $namespace, $soapAction, $headers, $style, $use; endpointType: $this->endpointType");
 
 5097                        $this->requestHeaders = $headers;
 
 5100                if($this->endpointType == 
'wsdl' && $opData = $this->
getOperationData($operation)){
 
 5102                        $this->opData = $opData;
 
 5103                        foreach($opData as $key => $value){
 
 5104                                $this->
debug(
"$key -> $value");
 
 5106                        if (isset($opData[
'soapAction'])) {
 
 5107                                $soapAction = $opData[
'soapAction'];
 
 5109                        $this->endpoint = $opData[
'endpoint'];
 
 5111                        $style = $opData[
'style'];
 
 5112                        $use = $opData[
'input'][
'use'];
 
 5119                        if (is_string($params)) {
 
 5120                                $this->
debug(
"serializing param string for WSDL operation $operation");
 
 5122                        } elseif (is_array($params)) {
 
 5123                                $this->
debug(
"serializing param array for WSDL operation $operation");
 
 5126                                $this->
debug(
'params must be array or string');
 
 5127                                $this->
setError(
'params must be array or string');
 
 5130            $usedNamespaces = $this->
wsdl->usedNamespaces;
 
 5132                        $encodingStyle = 
'http://schemas.xmlsoap.org/soap/encoding/';
 
 5133                        if (isset($opData[
'output'][
'encodingStyle']) && $encodingStyle != $opData[
'output'][
'encodingStyle']) {
 
 5134                                $methodEncodingStyle = 
' SOAP-ENV:encodingStyle="' . $opData[
'output'][
'encodingStyle'] . 
'"';
 
 5136                                $methodEncodingStyle = 
'';
 
 5138                        $this->
debug(
"wsdl debug: \n".$this->
wsdl->debug_str);
 
 5139                        $this->
wsdl->debug_str = 
'';
 
 5141                                $this->
debug(
'got wsdl error: '.$errstr);
 
 5142                                $this->
setError(
'wsdl error: '.$errstr);
 
 5145                } elseif($this->endpointType == 
'wsdl') {
 
 5147                        $this->
setError( 
'operation '.$operation.
' not present.');
 
 5148                        $this->
debug(
"operation '$operation' not present.");
 
 5149                        $this->
debug(
"wsdl debug: \n".$this->
wsdl->debug_str);
 
 5150                        $this->
wsdl->debug_str = 
'';
 
 5161                        if (is_string($params)) {
 
 5162                                $this->
debug(
"serializing param string for operation $operation");
 
 5164                        } elseif (is_array($params)) {
 
 5165                                $this->
debug(
"serializing param array for operation $operation");
 
 5166                                foreach($params as $k => $v){
 
 5167                                        $payload .= $this->
serialize_val($v,$k,
false,
false,
false,
false,$use);
 
 5170                                $this->
debug(
'params must be array or string');
 
 5171                                $this->
setError(
'params must be array or string');
 
 5174                        $usedNamespaces = array();
 
 5175                        $methodEncodingStyle = 
'';
 
 5178                if ($style == 
'rpc') {
 
 5179                        if ($use == 
'literal') {
 
 5180                                $this->
debug(
"wrapping RPC request with literal method element");
 
 5181                                $payload = 
"<$operation xmlns=\"$namespace\">" . $payload . 
"</$operation>";
 
 5183                                $this->
debug(
"wrapping RPC request with encoded method element");
 
 5184                                $payload = 
"<$nsPrefix:$operation$methodEncodingStyle xmlns:$nsPrefix=\"$namespace\">" .
 
 5186                                                        "</$nsPrefix:$operation>";
 
 5192                $this->
debug(
"endpoint: $this->endpoint, soapAction: $soapAction, namespace: $namespace, style: $style, use: $use");
 
 5193                $this->
debug(
'SOAP message length: ' . strlen($soapmsg) . 
' contents: ' . substr($soapmsg, 0, 1000));
 
 5195                $return = $this->
send($this->
getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
 
 5197                        $this->
debug(
'Error: '.$errstr);
 
 5200                        $this->
return = $return;
 
 5201                        $this->
debug(
'sent message successfully and got a(n) '.gettype($return).
' back');
 
 5204                        if(is_array($return) && isset($return[
'faultcode'])){
 
 5205                                $this->
debug(
'got fault');
 
 5206                                $this->
setError($return[
'faultcode'].
': '.$return[
'faultstring']);
 
 5207                                $this->fault = 
true;
 
 5208                                foreach($return as $k => $v){
 
 5210                                        $this->
debug(
"$k = $v<br>");
 
 5215                                if(is_array($return)){
 
 5217                                        if(
sizeof($return) > 1){
 
 5221                                        return array_shift($return);
 
 5238                if(isset($this->operations[$operation])){
 
 5239                        return $this->operations[$operation];
 
 5241                $this->
debug(
"No data for operation: $operation");
 
 5262                        case ereg(
'^http',$this->endpoint):
 
 5263                                $this->
debug(
'transporting via HTTP');
 
 5264                                if($this->persistentConnection == 
true && is_object($this->persistentConnection)){
 
 5268                                        if ($this->persistentConnection) {
 
 5269                                                $http->usePersistentConnection();
 
 5273                                $http->setSOAPAction($soapaction);
 
 5274                                if($this->proxyhost && $this->proxyport){
 
 5275                                        $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
 
 5277                if($this->username != 
'' && $this->password != 
'') {
 
 5278                                        $http->setCredentials($this->username, $this->password, $this->authtype);
 
 5280                                if($this->http_encoding != 
''){
 
 5281                                        $http->setEncoding($this->http_encoding);
 
 5283                                $this->
debug(
'sending message, length: '.strlen($msg));
 
 5284                                if(ereg(
'^http:',$this->endpoint)){
 
 5287                                } elseif(ereg(
'^https',$this->endpoint)){
 
 5294                                        if (extension_loaded(
'curl')) {
 
 5297                                                $this->
setError(
'CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
 
 5300                                        $this->
setError(
'no http/s in endpoint url');
 
 5302                                $this->request = 
$http->outgoing_payload;
 
 5303                                $this->response = 
$http->incoming_payload;
 
 5304                                $this->
debug(
"transport debug data...\n".
$http->debug_str);
 
 5307                                if ($this->persistentConnection) {
 
 5308                                        $http->debug_str = 
'';
 
 5309                                        if (!is_object($this->persistentConnection)) {
 
 5310                                                $this->persistentConnection = 
$http;
 
 5314                                if($err = 
$http->getError()){
 
 5315                                        $this->
setError(
'HTTP Error: '.$err);
 
 5320                                        $this->
debug(
'got response, length: '. strlen($this->responseData).
' type: '.
$http->incoming_headers[
'content-type']);
 
 5325                                $this->
setError(
'no transport found, or selected transport is not yet supported!');
 
 5340                $this->
debug(
'Entering parseResponse() for data of length ' . strlen(
$data) . 
' and type ' . $headers[
'content-type']);
 
 5341                if (!strstr($headers[
'content-type'], 
'text/xml')) {
 
 5342echo 
"-".$data.
"<br /><br />".htmlentities(
$data).
"-";
 
 5343                        $this->
setError(
'Response not of type text/xml');
 
 5346                if (strpos($headers[
'content-type'], 
'=')) {
 
 5347                        $enc = str_replace(
'"', 
'', substr(strstr($headers[
"content-type"], 
'='), 1));
 
 5348                        $this->
debug(
'Got response encoding: ' . $enc);
 
 5349                        if(eregi(
'^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
 
 5350                                $this->xml_encoding = strtoupper($enc);
 
 5352                                $this->xml_encoding = 
'US-ASCII';
 
 5356                        $this->xml_encoding = 
'UTF-8';
 
 5358                $this->
debug(
'Use encoding: ' . $this->xml_encoding . 
' when creating soap_parser');
 
 5361                $this->
debug($parser->debug_str);
 
 5363                if($errstr = 
$parser->getError()){
 
 5370                        $this->responseHeaders = 
$parser->getHeaders();
 
 5372                        $return = 
$parser->get_response();
 
 5374            $this->document = 
$parser->document;
 
 5389                $this->requestHeaders = $headers;
 
 5399            if($this->responseHeaders != 
'') {
 
 5441                $this->http_encoding = $enc;
 
 5450                $this->persistentConnection = 
true;
 
 5476                $this->defaultRpcParams = $rpcParams;
 
 5487                foreach($this->operations as $operation => $opData){
 
 5488                        if($operation != 
''){
 
 5491                                if(
sizeof($opData[
'input'][
'parts']) > 0){
 
 5492                                        foreach($opData[
'input'][
'parts'] as 
$name => 
$type){
 
 5493                                                $paramStr .= 
"\$$name,";
 
 5495                                        $paramStr = substr($paramStr,0,strlen($paramStr)-1);
 
 5497                                $opData[
'namespace'] = !isset($opData[
'namespace']) ? 
'http://testuri.com' : $opData[
'namespace'];
 
 5498                                $evalStr .= 
"function $operation ($paramStr){ 
 5499                                        // load params into array 
 5500                                        \$params = array($paramStr); 
 5501                                        return \$this->call('$operation',\$params,'".$opData[
'namespace'].
"','".(isset($opData[
'soapAction']) ? $opData[
'soapAction'] : 
'').
"'); 
 5507                $evalStr = 
'class soap_proxy_'.$r.
' extends soap_client { 
 5514                eval(
"\$proxy = new soap_proxy_$r('');");
 
 5516                $proxy->endpointType = 
'wsdl';
 
 5517                $proxy->wsdlFile = $this->wsdlFile;
 
 5518                $proxy->wsdl = $this->wsdl;
 
 5519                $proxy->operations = $this->operations;
 
 5578                $this->decode_utf8 = $bool;
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
iso8601_to_timestamp($datestr)
convert ISO 8601 compliant date string to unix timestamp
timestamp_to_iso8601($timestamp, $utc=true)
convert unix timestamp to ISO 8601 compliant date string
if(php_sapi_name() !='cli') $in
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
parses an XML Schema, allows access to it's data, other utility methods no validation....
parseFile($xml, $type)
parse an XML file
addComplexType($name, $typeClass='complexType', $phpType='array', $compositor='', $restrictionBase='', $elements=array(), $attrs=array(), $arrayType='')
adds a complex type to the schema
schemaCharacterData($parser, $data)
element content handler
typeToForm($name, $type)
returns HTML form elements that allow a user to enter values for creating an instance of the given ty...
getPHPType($type, $ns)
get the PHP type of a user defined type in the schema PHP type is kind of a misnomer since it actuall...
addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar')
adds a simple type to the schema
schemaStartElement($parser, $name, $attrs)
start-element handler
getTypeDef($type)
returns an array of information about a given type returns false if no type exists by the given name
xdebug($string)
adds debug data to the clas level debug string
serializeSchema()
serialize the schema
schemaEndElement($parser, $name)
end-element handler
serializeTypeDef($type)
returns a sample serialization of a given type, or false if no type by the given name
XMLSchema($schema='', $xml='', $namespaces=array())
constructor
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
setError($str)
sets error string
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace returns false if no namespace registered with the given pref...
contractQname($qname)
contracts a qualified name
debug($string)
adds debug data to the class level debug string
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
expandEntities($val)
expands entities, e.g.
expandQname($qname)
expands a qualified name
$debug_str
Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
$error_str
Current error string (manipulated by getError/setError)
getError()
returns error string if present
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed
serializeEnvelope($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
serialize message
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
soapclient higher level class for easy usage.
setDefaultRpcParams($rpcParams)
sets the default RPC parameter setting.
getHTTPContentTypeCharset()
gets the HTTP content type charset for the current request.
getOperationData($operation)
get available data pertaining to an operation
getHTTPBody($soapmsg)
gets the HTTP body for the current request.
getHeaders()
get the response headers
soap_client($endpoint, $wsdl=false, $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
constructor
useHTTPPersistentConnection()
use HTTP persistent connections if possible
getHTTPContentType()
gets the HTTP content type for the current request.
getDefaultRpcParams()
gets the default RPC parameter setting.
parseResponse($headers, $data)
processes SOAP message returned from server
setHTTPProxy($proxyhost, $proxyport, $proxyusername='', $proxypassword='')
set proxy info here
setCredentials($username, $password, $authtype='basic')
if authenticating, set user credentials here
getProxy()
dynamically creates proxy class, allowing user to directly call methods from wsdl
call($operation, $params=array(), $namespace='', $soapAction='', $headers=false, $rpcParams=null, $style='rpc', $use='encoded')
calls method, returns PHP native type
setHTTPEncoding($enc='gzip, deflate')
use HTTP encoding
setHeaders($headers)
set the SOAP headers
send($msg, $soapaction='', $timeout=0, $response_timeout=30)
send the SOAP message
soap_fault class, allows for creation of faults mainly used for returning faults from deployed functi...
serialize()
serialize a fault
soap_fault($faultcode, $faultactor='', $faultstring='', $faultdetail='')
soap_parser class parses SOAP XML messages into native PHP values
get_response()
get the parsed message
decode_entities($text)
decodes entities
end_element($parser, $name)
end-element handler
getHeaders()
get the parsed headers
buildVal($pos)
builds response structures for compound values (arrays/structs)
soap_parser($xml, $encoding='UTF-8', $method='', $decode_utf8=false)
constructor
decodeSimple($value, $type, $typens)
decodes simple types into PHP variables
character_data($parser, $data)
element content handler
start_element($parser, $name, $attrs)
start-element handler
soap_server allows the user to create a SOAP server that is capable of receiving messages and returni...
verify_method($operation, $request)
takes the value that was created by parsing the request and compares to the method's signature,...
service($data)
processes request and returns response
serialize_return()
serializes the return value from a PHP function into a full SOAP Envelope
send_response()
sends an HTTP response
add_to_map($methodname, $in, $out)
add a method to the dispatch map
parse_request($data='')
parses a request
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
create a fault.
configureWSDL($serviceName, $namespace=false, $endpoint=false, $style='rpc', $transport='http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace=false)
sets up wsdl object this acts as a flag to enable internal WSDL generation
$methodreturnisliteralxml
webDescription()
prints html description of services
invoke_method()
invokes a PHP function for the requested SOAP method
parse_http_headers()
parses HTTP request headers.
transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CUR...
send($data, $timeout=0, $response_timeout=30)
send the SOAP message via HTTP
soap_transport_http($url)
constructor
setProxy($proxyhost, $proxyport, $proxyusername='', $proxypassword='')
set proxy info here
setContentType($type, $charset=false)
sendHTTPS($data, $timeout=0, $response_timeout=30)
send the SOAP message via HTTPS 1.0 using CURL
setSOAPAction($soapaction)
set the soapaction value
setEncoding($enc='gzip, deflate')
use http encoding
usePersistentConnection()
connect($connection_timeout=0, $response_timeout=30)
decodeChunked($buffer, $lb)
decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19....
setCredentials($username, $password, $authtype='basic', $digestRequest=array())
if authenticating, set user credentials here
for creating serializable abstractions of native PHP types NOTE: this is only really used when WSDL i...
serialize($use='encoded')
return serialized value
soapval($name='soapval', $type=false, $value=-1, $element_ns=false, $type_ns=false, $attributes=false)
constructor
decode()
decodes a soapval object into a PHP native type
parses a WSDL file, allows access to it's data, other utility methods
character_data($parser, $data)
element content handler
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false)
serializes a PHP value according a given type definition
wsdl($wsdl='', $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
constructor
getTypeDef($type, $ns)
returns an array of information about a given type returns false if no type exists by the given name
serialize()
serialize the parsed wsdl
getOperations($bindingType='soap')
returns an assoc array of operation names => operation data
serializeRPCParameters($operation, $direction, $parameters)
serialize a PHP value according to a WSDL message definition
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
serializeParameters($operation, $direction, $parameters)
serialize a PHP value according to a WSDL message definition
addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar')
adds an XML Schema simple type to the WSDL types
parseWSDL($wsdl='')
parses the wsdl document
start_element($parser, $name, $attrs)
start-element handler
end_element($parser, $name)
end-element handler
addOperation($name, $in=false, $out=false, $namespace=false, $soapaction=false, $style='rpc', $use='encoded', $documentation='')
register a service with the server
addComplexType($name, $typeClass='complexType', $phpType='array', $compositor='', $restrictionBase='', $elements=array(), $attrs=array(), $arrayType='')
adds an XML Schema complex type to the WSDL types
if($err=$client->getError()) $namespace
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples