src/SoapRequestsGenerator.php
public static function generateRetrieveRequest( $entityType, $entityId, $columnSet ) {
        /* Generate the RetrieveRequest message */
        $retrieveRequestDOM = new DOMDocument();
        $retrieveNode       = $retrieveRequestDOM->appendChild( $retrieveRequestDOM->createElementNS( 'http://schemas.microsoft.com/xrm/2011/Contracts/Services', 'Retrieve' ) );
        $retrieveNode->appendChild( $retrieveRequestDOM->createElement( 'entityName', $entityType ) );
        $retrieveNode->appendChild( $retrieveRequestDOM->createElement( 'id', $entityId ) );
        $columnSetNode = $retrieveNode->appendChild( $retrieveRequestDOM->createElement( 'columnSet' ) );
        $columnSetNode->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:b', 'http://schemas.microsoft.com/xrm/2011/Contracts' );
        $columnSetNode->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:i', 'http://www.w3.org/2001/XMLSchema-instance' );
        /* Add the columns requested, if specified */
        if ( $columnSet != null && count( $columnSet ) > 0 ) {
            $columnSetNode->appendChild( $retrieveRequestDOM->createElement( 'b:AllColumns', 'false' ) );
            $columnsNode = $columnSetNode->appendChild( $retrieveRequestDOM->createElement( 'b:Columns' ) );
            $columnsNode->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:c', 'http://schemas.microsoft.com/2003/10/Serialization/Arrays' );
            foreach ( $columnSet as $columnName ) {
                $columnsNode->appendChild( $retrieveRequestDOM->createElement( 'c:string', strtolower( $columnName ) ) );
            }
        } else {
            /* No columns specified, request all of them */
            $columnSetNode->appendChild( $retrieveRequestDOM->createElement( 'b:AllColumns', 'true' ) );
        }

        /* Return the DOMNode */

        return $retrieveNode;
    }
public static function generateRetrieveRequest( $entityType, $entityId, $columnSet ) {
        /* Generate the RetrieveRequest message */
        $retrieveRequestDOM = new DOMDocument();
        $retrieveNode       = $retrieveRequestDOM->appendChild( $retrieveRequestDOM->createElementNS( 'http://schemas.microsoft.com/xrm/2011/Contracts/Services', 'Retrieve' ) );
        $retrieveNode->appendChild( $retrieveRequestDOM->createElement( 'entityName', $entityType ) );
        $retrieveNode->appendChild( $retrieveRequestDOM->createElement( 'id', $entityId ) );
        $columnSetNode = $retrieveNode->appendChild( $retrieveRequestDOM->createElement( 'columnSet' ) );
        $columnSetNode->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:b', 'http://schemas.microsoft.com/xrm/2011/Contracts' );
        $columnSetNode->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:i', 'http://www.w3.org/2001/XMLSchema-instance' );
        /* Add the columns requested, if specified */
        if ( $columnSet != null && count( $columnSet ) > 0 ) {
            $columnSetNode->appendChild( $retrieveRequestDOM->createElement( 'b:AllColumns', 'false' ) );
            $columnsNode = $columnSetNode->appendChild( $retrieveRequestDOM->createElement( 'b:Columns' ) );
            $columnsNode->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:c', 'http://schemas.microsoft.com/2003/10/Serialization/Arrays' );
            foreach ( $columnSet as $columnName ) {
                $columnsNode->appendChild( $retrieveRequestDOM->createElement( 'c:string', strtolower( $columnName ) ) );
            }
        } else {
            /* No columns specified, request all of them */
            $columnSetNode->appendChild( $retrieveRequestDOM->createElement( 'b:AllColumns', 'true' ) );
        }

        /* Return the DOMNode */

        return $retrieveNode;
    }
public static function generateRetrieveRequest ( $ entityType , $ entityId , $ columnSet ) { /* Generate the RetrieveRequest message */ $ retrieveRequestDOM = new DOMDocument ( ) ; $ retrieveNode = $ retrieveRequestDOM -> appendChild ( $ retrieveRequestDOM -> createElementNS ( 'http://schemas.microsoft.com/xrm/2011/Contracts/Services' , 'Retrieve' ) ) ; $ retrieveNode -> appendChild ( $ retrieveRequestDOM -> createElement ( 'entityName' , $ entityType ) ) ; $ retrieveNode -> appendChild ( $ retrieveRequestDOM -> createElement ( 'id' , $ entityId ) ) ; $ columnSetNode = $ retrieveNode -> appendChild ( $ retrieveRequestDOM -> createElement ( 'columnSet' ) ) ; $ columnSetNode -> setAttributeNS ( 'http://www.w3.org/2000/xmlns/' , 'xmlns:b' , 'http://schemas.microsoft.com/xrm/2011/Contracts' ) ; $ columnSetNode -> setAttributeNS ( 'http://www.w3.org/2000/xmlns/' , 'xmlns:i' , 'http://www.w3.org/2001/XMLSchema-instance' ) ; /* Add the columns requested, if specified */ if ( $ columnSet != null && count ( $ columnSet ) > 0 ) { $ columnSetNode -> appendChild ( $ retrieveRequestDOM -> createElement ( 'b:AllColumns' , 'false' ) ) ; $ columnsNode = $ columnSetNode -> appendChild ( $ retrieveRequestDOM -> createElement ( 'b:Columns' ) ) ; $ columnsNode -> setAttributeNS ( 'http://www.w3.org/2000/xmlns/' , 'xmlns:c' , 'http://schemas.microsoft.com/2003/10/Serialization/Arrays' ) ; foreach ( $ columnSet as $ columnName ) { $ columnsNode -> appendChild ( $ retrieveRequestDOM -> createElement ( 'c:string' , strtolower ( $ columnName ) ) ) ; } } else { /* No columns specified, request all of them */ $ columnSetNode -> appendChild ( $ retrieveRequestDOM -> createElement ( 'b:AllColumns' , 'true' ) ) ; } /* Return the DOMNode */ return $ retrieveNode ; }
Generate a Retrieve Request

@ignore
Generate a Retrieve Request