NuSOAP Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaptingavrin
Forum Newbie
Posts: 3
Joined: Tue Jun 10, 2008 2:00 pm

NuSOAP Help

Post by kaptingavrin »

If anyone is familiar with Clearview TSS, that'd be great. Even if you aren't, maybe you can help me!

I received the following example snippets of code with no real instruction as to how to modify them to use them correctly. If anyone can shed some light on this, please do.

Code: Select all

[b]Method[/b]
Remote_candidate
[b]Parameters[/b]
SiteName
AccessCode
[b]Sample XML[/b]
<?xml version="1.0" encoding="UTF-8"?>
<Customer cid="00">         
    <Discipline id="DisciplineMaster-1">
        <CertName>RN</CertName>         
    </Discipline>           
    <Discipline id="DisciplineMaster-2">
        <CertName>LVN/LPN</CertName>        
    </Discipline>           
    <Discipline id="DisciplineMaster-3">
        <CertName>CNA</CertName>        
    </Discipline>           
    <Discipline id="DisciplineMaster-4">
        <CertName>RT</CertName>         
    </Discipline>           
    <Discipline id="DisciplineMaster-5">
        <CertName>ST</CertName>         
    </Discipline>                    
</Customer>
Login Form

Code: Select all

<form action="[FormActionURL]" method="post" name="login">
<input type="hidden" name="ReturnURL" value="[ReturnURL]">
<input type="hidden" name="CustID" value="[CID From XML]">
<input type="text" name="LoginUsername">
<input type="password" name="LoginPassword">
<input type="submit" name="submit" value="Login">
</form>
Contact Form

Code: Select all

<form action="[FormActionURL]" method="post" name="contact">
<input type="hidden" name="ReturnURL" value="[ReturnURL]">
<input type="hidden" name="CustomerID" value="[CID From XML]">
<input type="text" name="CFirstName" size="">
<input type="text" name="CLastName" size="">
<input type="text" name="CZip" size="">
<select name="CState">
<option value="0">-- Select --</option>
</select>
<select name="DisciplineID">
<option value="">-- Select --</option>
<option value="[DisciplineID From XML]">[CertName From XML]</option>
</select>
<input type="text" name="CEmail" size="">
<input type="text" name="CPhone" size="">
<input type="submit" value="submit" name="Submit">
</form>
5. PHP4 with NuSOAP Example

Code: Select all

<?php
//-------------------------------
// Setup some required variables.
//-------------------------------
global $ReturnURL;
global $FormActionURL;
$siteName = "clearview";
$accessCode = "0000000000";
$ReturnURL = "http://www.clearviewtss.com/";
$FormActionURL = "http://rss1.securetss.com/$siteName/remote_login_control.cfm";
$wsdl="http://rss1.securetss.com/com/clearviewtss/rss/remote_candidate.cfc?wsdl";
            
$param=array(
'SiteName'=>$siteName,
'AccessCode'=>$accessCode
);
            
require_once('lib/nusoap.php');         
$rss = new soapclient($wsdl, 'true');
            
$xml = $rss->call('Remote_candidate', $param);
?>
            
<form action="<?php echo $FormActionURL; ?>" method="post" name="contact">
<input type="hidden" name="ReturnURL" value="<?php echo $ReturnURL; ?>">
<?php
if (! ($xmlparser = xml_parser_create()) ) 
{ 
die ("Cannot create parser"); 
}
 
$Current = "";
function start_tag($parser, $name, $attribs) { 
global $current;
global $RCustomerID;
$current = $name;
if($name == 'DISCIPLINE'){echo "<option value=\"";}
   if (is_array($attribs)) { 
      while(list($key,$val) = each($attribs)) { 
     //--------------------
     // Set the customerID
     //--------------------
    if($key == 'CID'){
    $RCustomerID = $val;
    echo "<br>Discipline: <select name=\"DisciplineID\"><option value=\"\">--Select--</option>";
         }
         if($key == 'ID'){echo "$val\">";}   
       } 
    } 
} 
 
function tag_contents($parser, $data) {
global $current; 
if($current == 'CERTNAME') {echo $data;}
}
 
function end_tag($parser, $name) { 
if($name == 'DISCIPLINE'){echo "</option>";}
if($name == 'CUSTOMER'){echo "</select>";}
} 
 
xml_set_element_handler($xmlparser, "start_tag", "end_tag"); 
xml_set_character_data_handler($xmlparser, "tag_contents"); 
xml_parse($xmlparser, $xml);
?>
<input type="hidden" name="CustomerID" value="<?php echo $RCustomerID; ?>">
<input type="submit" value="submit" name="Submit">
</form>

Thanks for any help you can give! This one is really confusing me!
kaptingavrin
Forum Newbie
Posts: 3
Joined: Tue Jun 10, 2008 2:00 pm

Re: NuSOAP Help

Post by kaptingavrin »

Here's the PHP5 example they gave, if it'll help (the server doesn't have PHP5, or I'd be using this):

Code: Select all

<?php
   
    //-------------------------------
    // Setup some required variables.
    //-------------------------------
    $siteName = "clearview";
    $accessCode = "0000000000";
    $returnURL = "http://www.clearviewtss.com/index";
   
    //-----------------------------------------------------------
    // Create a new soap client object. Please note this requires
    // PHP 5 or greater. Execute the Remote_candidate function.
    // This will return a raw XML string. We will pass that
    // to SimpleXMLElement to turn it into a managable XML
    // handling class.
    //-----------------------------------------------------------
    $rss = new
SoapClient("http://rss1.securetss.com/com/clearviewtss/rss/remote_candidate.cfc?wsdl");
    $raw = $rss->Remote_candidate($siteName, $accessCode);
   
    $xml = new SimpleXMLElement($raw);
    $RCustomerID = $xml["cid"];
 
?>
 
Discipline:<br />
<select name="DisciplineID">
    <option value="">-- Select --</option>
    <?php
   
        foreach ($xml->Discipline as $discipline)
            printf("<option value=\"%s\">%s</option>\n", $discipline["id"], $discipline->CertName);
       
    ?>
</select>
kaptingavrin
Forum Newbie
Posts: 3
Joined: Tue Jun 10, 2008 2:00 pm

Re: NuSOAP Help

Post by kaptingavrin »

Anyone?
Post Reply