Using the docmail simple api from php ------------------------------------- No doubt apache is best for running PHP but as my webserver is IIS this includes additional instructions on setting php up on IIS (steps 1-5) as well using the docmail api (step 6). I guess on apache you would need to find a way to install NuSoap although possibly later php has SOAP built in. Caveat: I am a .net programmer so make no apologies for breaking probably 101 php rules in the sample - it is an example to get you up and running. 1) No doubt apache is best for php but as my webserver is IIS I have to use it. It can still be installed either manually or the best (simplest) way I found was to use the Microsoft PHP on IIS installer (!). I went for the FastCGI option when installing it. http://blogs.iis.net/bills/archive/2006/09/19/How-to-install-PHP-on-IIS7-_2800_RC1_2900_.aspx 2) Install the NuSoap PHP wrapper from http://sourceforge.net/project/showfiles.php?group_id=57663&package_id=53241&release_id=552239 3) Amend the php include paths to include the nusoap libraries Look here http://www.modwest.com/help/kb5-98.html or I amended c:\program files\php\php.ini to include the following (added the c:\program files\php\ bit) include_path = ".;c:\php\includes;c:\program files\php\" 4) (IIS Only) Amend the fast cgi timeouts to cope with docmail proofing c:\windows\system32\inetsrv\fcgiext.ini and make sure it contains ActivityTimeout=240 RequestTimeout=240 5) PHP should now be up and running. Add something like "test.php" in the webserver path and add something like the following in there, browse to the file and it should process the request correctly. 6) Here is my sample PHP code using the NuSoap SOAP wrapper Undefined or FirstClass or StandardClass - to get the BEST benefit use StandardClass $eAddressNameFormat = "FullName";//How the name appears in the envelope address Undefined or FullName or FirstnameSurname or TitleSurname or TitleFirstnameSurname $NameTitle = "Mr"; //recipient title/saultation $FirstName = "Jim"; //recipient 1st name $LastName = "Smith"; //recipient surname $sAddress1 = "Address1"; // Address line 1 $sAddress2 = "Address2"; // Address line 2 $sAddress3 = "Address3"; // Address line 3 $sAddress4 = "Address4"; // Address line 4 $sPostCode = "PostCode"; // PostCode $file = "./test.doc"; // filename (in this case the file is on the root of the webserver!) $ProofApprovalRequired = false; //false = Automatically approve the order without returning a proof - order is completed by the chosen "Send" method //true = proof approval requried. // GetProof must be called, // then ConfirmOrder to approve the proof & complete the order // Setup nusoap client $client = new nusoap_client($wsdl, true); //PHP5 now has is't own soapclient class, so use nusoap_client to avoid clash // Increase soap client timeout $client->timeout = 240; // Load contents of word file into base-64 array to pass across SOAP // for example the word file is at the root of the webserver $handle = fopen($file, "rb"); $contents = base64_encode(fread($handle, filesize($file))); fclose($handle); if ($debug) { print "file is " .filesize($file) ." bytes
"; print "Contents of file:
"; print_r($contents); print "

"; } error_reporting(E_ALL); // Increase php script server timeout set_time_limit(240); // Setup array to pass into webservice call $arr = array( 'sUsr' => $sUsr, 'sPwd' => $sPwd, 'sMailingName' => $sMailingName, 'sCallingApplicationID' => $sCallingApplicationID, 'bColour' => $bColour, 'bDuplex' => $bDuplex, 'eDeliveryType' => $eDeliveryType, 'sTemplateFileName' => $sTemplateFileName, 'eAddressNameFormat' => $eAddressNameFormat, 'bTemplateData' => $contents, 'sNameTitle' => $NameTitle, 'sFirstName' => $FirstName, 'sLastName' => $LastName, 'sAddress1' => $sAddress1, 'sAddress2' => $sAddress2, 'sAddress3' => $sAddress3, 'sAddress4' => $sAddress4, 'sPostCode' => $sPostCode, 'bProofApprovalRequired' => $ProofApprovalRequired ); if ($debug) print "About to call SendLetterToSingleAddress
"; $result = $client->call('SendLetterToSingleAddress',$arr); print "Checking for errors
"; $err = $client->getError(); if ($err) { print '

There was an error:

' .print_r($err); } else { print "
RESULT WAS :" .print_r($result); } if ($debug) { print "Finished script
"; // Display the request and response echo '

Request

'; echo '
' . htmlspecialchars($client->request, ENT_QUOTES) . '
'; echo '

Response

'; echo '
' . htmlspecialchars($client->response, ENT_QUOTES) . '
'; // Display the debug messages echo '

Debug

'; echo '
' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '
'; } } catch (Exception $e) { print "PROBLEM:" .$e->getMessage() ."
"; var_dump($e->getMessage()); } ?> 7) Some other links I found helpful Make a soap client in nusoap - http://users.skynet.be/pascalbotte/rcx-ws-doc/phpclient.htm#SIMPLETYPENS Consume MapPoint in PHP - http://msdn.microsoft.com/en-us/library/ms980207.aspx Pass complex types in PHP - http://forums.devshed.com/php-development-5/nusoap-how-do-you-pass-in-a-complex-type-to-195622.html Base64 encode in PHP - http://uk3.php.net/base64_encode Call asmx in NuSoap - http://c7y-bb.phparchitect.com/viewtopic.php?f=4&p=2819 FastCGI timeouts - http://forums.iis.net/t/1089753.aspx Docmail API functions - https://www.cfhdocmail.com/Test_SimpleAPI/DocMail.SimpleAPI.asmx