Assume a point mass $m$ located at $\vec{x}$. Assume also a solid body whose coordinates $\vec{x}'$ belong to a connected subdomain $\vec{x}' \in \Omega$. The solid body has a non-uniform mass density $\rho(\vec{x}')$. We may thus define the mass of the solid object as
$$M = \int_{\Omega} \rho(\vec{x}')\,{\rm d}^3x'$$
and its center of mass
$$\vec{x}_c'= \int_{\Omega} \vec{x}' \rho(\vec{x}')\,{\rm d}^3x'$$
The infinitesimal force of gravity acting on a volume element of the solid object is given by
$$\,{\rm d}\vec{F} = Gm\,{\rm d}M\frac{\vec{x}' - \vec{x}}{|\vec{x}' - \vec{x}|^3} = Gm \rho(\vec{x}') \frac{\vec{x}' - \vec{x}}{|\vec{x}' - \vec{x}|^3} \,{\rm d}^3 x'$$
The total force can be obtained by integration.
$$\vec{F} = Gm \int_{\Omega} \rho(\vec{x}') \frac{\vec{x}' - \vec{x}}{|\vec{x}' - \vec{x}|^3} \,{\rm d}^3 x'$$
Question: How does one prove that the total force is
$$\vec{F} = GmM \frac{\vec{x}'_c - \vec{x}}{|\vec{x}_c' - \vec{x}|^3}$$
I am aware of the question Why does gravity act at the center of mass?. I am explicitly interested in the integral proof, which the solution does not provide
Now, I admit that I understood or learned it wrong. What I was assuming to be the general case, was in fact a special case for large distances and/or spherical bodies.