wsdl->schemaTargetNamespace = $namespace; //Configure our WSDL @$server->configureWSDL("CompoundPowerGateWay"); //Create a complex type $server->wsdl->addComplexType('InFindSpecsId','complexType','struct','all','', array( 'findspecsid' => array('name' => 'findspecsid','type' => 'xsd:string') )); $server->wsdl->addComplexType('InIdnumber','complexType','struct','all','', array( 'idnumber' => array('name' => 'idnumber','type' => 'xsd:string') )); $server->wsdl->addComplexType('OutType1','complexType','struct','all','', array( 'available' => array('name' => 'available','type' => 'xsd:double'), 'molformula' => array('name' => 'molformula','type' => 'xsd:string'), 'molweight' => array('name' => 'molweight','type' => 'xsd:double'), 'saltdata' => array('name' => 'saltdata','type' => 'xsd:string'), 'logp' => array('name' => 'logp','type' => 'xsd:double'), 'logs' => array('name' => 'logs','type' => 'xsd:double'), 'tpsa' => array('name' => 'tpsa','type' => 'xsd:double'), 'chiral' => array('name' => 'chiral','type' => 'xsd:string'), 'hacceptors' => array('name' => 'hacceptors','type' => 'xsd:int'), 'hdonors' => array('name' => 'hdonors','type' => 'xsd:int'), 'rotatablebonds' => array('name' => 'rotatablebonds','type' => 'xsd:int'), 'ratoralld50' => array('name' => 'ratoralld50','type' => 'xsd:double'), 'loael' => array('name' => 'loael','type' => 'xsd:double'), 'ames' => array('name' => 'ames','type' => 'xsd:double'), 'dtp' => array('name' => 'dtp','type' => 'xsd:double'), 'mdlnumber' => array('name' => 'mdlnumber','type' => 'xsd:string'), 'name' => array('name' => 'name','type' => 'xsd:string'), 'inchi' => array('name' => 'inchi','type' => 'xsd:string'), 'inchikey' => array('name' => 'inchikey','type' => 'xsd:string'), 'smiles' => array('name' => 'smiles','type' => 'xsd:string'), 'molfile' => array('name' => 'molfile','type' => 'xsd:string') )); $server->wsdl->addComplexType('OutSpecsIdNumber','complexType','struct','all','', array( 'idnumber' => array('name' => 'idnumber','type' => 'xsd:string') )); //Register our methods using the complex type $server->register( // method name: 'FindSpecsId', // parameter list: array('name'=>'tns:InFindSpecsId'), // return value(s): array('return'=>'tns:OutSpecsIdNumber'), // namespace: $namespace, // soapaction: (use default) false, // style: rpc or document 'rpc', // use: encoded or literal 'encoded', // description: documentation for the method 'Find a Specs ID number by input of a MDL number, InChI or InChIKey string' ); $server->register( // method name: 'GetInfoOnSpecsId', // parameter list: array('name'=>'tns:InIdnumber'), // return value(s): array('return'=>'tns:OutType1'), // namespace: $namespace, // soapaction: (use default) false, // style: rpc or document 'rpc', // use: encoded or literal 'encoded', // description: documentation for the method 'Retrieve compound information and molfile of a Specs ID number' ); //Our complex methods function FindSpecsId($mycomplextype) { global $client_chem, $siteid_soap; $findspecsid =""; $idnumber=""; if (!empty($mycomplextype['findspecsid'])) { $findspecsid = $mycomplextype['findspecsid']; $findspecsid = str_replace('-​', '-', trim($findspecsid)); $findspecsid = str_replace('-​', '-', $findspecsid); $findspecsid = str_replace('?', '', $findspecsid); $findspecsid = str_replace(' ', '', $findspecsid); $findspecsid = substr(strip_tags(trim($mycomplextype['findspecsid'])), 0, 2050); // Find Specs ID from reference $chem_findspecsid_xml = $client_chem->FindSpecsID(array('fromsiteid'=>$siteid_soap,'findspecsid'=>$findspecsid)); if (!empty($chem_findspecsid_xml->result)) { $idnumber=$chem_findspecsid_xml->result; } } return array ( 'idnumber' => $idnumber ); } function GetInfoOnSpecsId($mycomplextype) { global $client_chem; // get batchno $idnumber=''; if (!empty($mycomplextype['idnumber'])) { $idnumber = $mycomplextype['idnumber']; } if (strlen($idnumber) == 15 && preg_match('/[A-Z]{2}\-\d{3}\/\d{8}/', substr(trim($idnumber), 0, 15))) { // Get data from hit compound $chem_compinfo_xml = $client_chem->GetInfoOnSpecsId(array('idnumber'=>$idnumber)); $available =0.0;$molformula="";$molweight=0.0;$saltdata="";$logp=99999.9;$logs=99999.9;$tpsa=0.0;$chiral=""; $hacceptors=0;$hdonors=0; $rotatablebonds=0;$ratoralld50=0; $loael=0;$ames=0;$dtp=0;$mdlnumber=""; $name="";$inchi="";$inchikey="";$smiles=""; $molfile =""; if (!empty($chem_compinfo_xml->idnumber)) { // fill variables if (!empty($chem_compinfo_xml->availability)) { $available = $chem_compinfo_xml->availability; } if (!empty($chem_compinfo_xml->molformula)) { $molformula = $chem_compinfo_xml->molformula; } if (!empty($chem_compinfo_xml->molweight)) { $molweight = $chem_compinfo_xml->molweight; } if (!empty($chem_compinfo_xml->saltdata)) { $saltdata = $chem_compinfo_xml->saltdata; } if (!empty($chem_compinfo_xml->logp)) { $logp = $chem_compinfo_xml->logp; } if (!empty($chem_compinfo_xml->logs)) { $logs = $chem_compinfo_xml->logs; } if (!empty($chem_compinfo_xml->tpsa)) { $tpsa = $chem_compinfo_xml->tpsa; } if (!empty($chem_compinfo_xml->chiral)) { $chiral = $chem_compinfo_xml->chiral; } if (!empty($chem_compinfo_xml->hacceptors)) { $hacceptors = $chem_compinfo_xml->hacceptors; } if (!empty($chem_compinfo_xml->hdonors)) { $hdonors = $chem_compinfo_xml->hdonors; } if (!empty($chem_compinfo_xml->rotatablebonds)) { $rotatablebonds = $chem_compinfo_xml->rotatablebonds; } if (!empty($chem_compinfo_xml->ratoralld50)) { $ratoralld50 = $chem_compinfo_xml->ratoralld50; } if (!empty($chem_compinfo_xml->loael)) { $loael = $chem_compinfo_xml->loael; } if (!empty($chem_compinfo_xml->ames)) { $ames = $chem_compinfo_xml->ames; } if (!empty($chem_compinfo_xml->dtp)) { $dtp = $chem_compinfo_xml->dtp; } if (!empty($chem_compinfo_xml->mdlnumber)) { $mdlnumber = $chem_compinfo_xml->mdlnumber; } if (!empty($chem_compinfo_xml->name)) { $name = $chem_compinfo_xml->name; } if (!empty($chem_compinfo_xml->inchi)) { $inchi = $chem_compinfo_xml->inchi; } if (!empty($chem_compinfo_xml->inchikey)) { $inchikey = $chem_compinfo_xml->inchikey; } if (!empty($chem_compinfo_xml->smiles)) { $smiles = $chem_compinfo_xml->smiles; } if (!empty($chem_compinfo_xml->molfile)) { $molfile = $chem_compinfo_xml->molfile; } } return array ( 'available' => $available, 'molformula' => $molformula, 'molweight' => $molweight, 'saltdata' => $saltdata, 'logp' => $logp, 'logs' => $logs, 'tpsa' => $tpsa, 'chiral' => $chiral, 'hacceptors' => $hacceptors, 'hdonors' => $hdonors, 'rotatablebonds' => $rotatablebonds, 'ratoralld50' => $ratoralld50, 'loael' => $loael, 'ames' => $ames, 'dtp' => $dtp, 'mdlnumber' => $mdlnumber, 'name' => $name, 'inchi' => $inchi, 'inchikey' => $inchikey, 'smiles' => $smiles, 'molfile' => $molfile ); } } // Get our posted data if the service is being consumed // otherwise leave this data blank. $POST_DATA = ""; if (!empty(file_get_contents('php://input'))) { $POST_DATA = file_get_contents('php://input'); } // pass our posted data (or nothing) to the soap service $server->service($POST_DATA); exit(); ?>