Okay I've resolved all the issues and would like to post how I did it, incase someone else gets into this mess:
Client Side
1. you need to include the following in your nusoap server/client
require_once('nusoap.php');
require_once('nusoapmime.php'); |
2. for attachments to work and you are using nusoap use the following:
$client = new soapclientmime |
3. I also used the following in my client
$client->setHTTPEncoding('deflate, gzip');
$result = $client->call('Data', $Request); // where Data is a function, see the snippets I posted for the server below for more information
if ($client->fault) {
echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
echo '<h2>Attachments</h2><pre>';
[u]$attachments = $client->getAttachments();[/u]
foreach ($attachments as $a) {
echo 'Filename: ' . $a['filename'] . "\r\n";
echo 'Content-Type: ' . $a['contenttype'] . "\r\n";
echo 'cid: ' . htmlspecialchars($a['cid'], ENT_QUOTES) . "\r\n";
echo htmlspecialchars($a['data'], ENT_QUOTES);
echo "\r\n";
}
echo '</pre>';
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
} |
Server side:
1. same as above
require_once('nusoap.php');
require_once('nusoapmime.php'); |
2. create the server
$server = new nusoapservermime; |
3. register the function you are creating (remember above: "Data")
$server->register('Data',
array('Request' => 'tns:Request') ); |
note that I also create the Request namespace
4. create the function of course
function Data($ID,$Token,$dataArray){
....
} |
5. within the function to return an attachment you need the following:
$cid = $server->addAttachment('', $filename); |
And that's it.
I hope my frustration will help others get past this little hiccup
-Addison