  The error in the Solar system ephemeris will lead to dipolar correlations in
the residuals of pulsar timing array for widely separated pulsars. In this
paper, we utilize such correlated signals, and construct a Bayesian
data-analysis framework to detect the unknown mass in the Solar system and to
measure the orbital parameters. The algorithm is designed to calculate the
waveform of the induced pulsar-timing residuals due to the unmodelled objects
following the Keplerian orbits in the Solar system. The algorithm incorporates
a Bayesian-analysis suit used to simultaneously analyse the pulsar-timing data
of multiple pulsars to search for coherent waveforms, evaluate the detection
significance of unknown objects, and to measure their parameters. When the
object is not detectable, our algorithm can be used to place upper limits on
the mass. The algorithm is verified using simulated data sets, and
cross-checked with analytical calculations. We also investigate the capability
of future pulsar-timing-array experiments in detecting the unknown objects. We
expect that the future pulsar timing data can limit the unknown massive objects
in the Solar system to be lighter than $10^{-11}$ to $10^{-12}$ $M_{\odot}$, or
measure the mass of Jovian system to fractional precision of $10^{-8}$ to
$10^{-9}$.
