DomusPro / Documentation / Document service

Webservice endpoint for documents

The WDSL file for the document webservice is available here: /service/soap/domuspro.webservice/v/document.wsdl

The methods are briefly described here

addFiles

This methods is called in order to add new files to existing or new associations. The method takes the following parameters:

  • * partnerIdentifier(string, required): The identifier unique to the system calling the webservice
  • * token(string, required): The token generated according to the rules specified on the documentation page
  • * domusProIdentifier(string): The identifier of the association in domusPro system.
  • * externalIdentifier(string, required): The identifier of the association in the client system.
  • * files(array of File objects): An array of Files (se specification below)
  • * advicerEmail(string): An email to whom additional questions can be adressed. DomusPro will use this email if more information is needed to process the file

The following parameters are used in the token generation (in order) externalIdentifier, domusProIdentifer, partnerIdentifier

It returns boolean TRUE if all went well, and will throw exceptions is something went wrong.

fetchFile

This method is used for retrieving a file. This methods is closely related to the association service. When fetching associations which has attached documents, the actual binary data of the file is not included. Instead a one-time fileToken is returned. The fileToken can be used with this service to retrieve the actual binary data. The token is valid only once.
The methods takes the following parameters

  • * partnerIdentifier(string, required): The identifier unique to the system calling the webservice
  • * token(string, required): The token generated according to the rules specified on the documentation page
  • * fileToken(string, required): The fileToken to retrieve the actual binary data.

The following parameters are used in the token generation (in order)fileToken, partnerIdentifier

It returns a File

Examples

Fetching af file. The value of the fileToken is found via a call to the AssociationService->getDataForAssociation
	ini_set('soap.wsdl_cache_enabled', 0);
	$wsdl = 'http://ws.domuspro.dk/service/soap/domuspro.webservice/v/document.wsdl';
	$client = new SoapClient($wsdl);

	$partnerId = '63b74aee-9852-4810-8c5b-98cea0188ebf';
	$fileToken = '430f6b64891af75edd95ec8dcb466aee26eef910';
	$token = generateToken($partnerId, $fileToken);

	try {
		$res = $client->fetchFile($partnerId, $token, $fileToken);
		var_dump($res);
	} catch (SoapFault $e) {
		print 'Error: ' . $e->getMessage();
	}

	/**
	 * @param $partnerId
	 * @param $domusProdId
	 * @param $externalId
	 * @return string
	 */
	function generateToken($partnerId, $fileToken) {
		$sharedSecret = 'YOUR SECRET';
		$string = '';
		$string .= 'fileToken:' . $fileToken . '_';
		$string .= 'partnerIdentifier:' . $partnerId . '_';
		$string .= $sharedSecret;
		return sha1($string);
	}