In British English a lawyer is a more general term representing a person trained in the law (in a formal way, enabling them to represent someone in a court, prepare legal documents or provide legal advises).
The Oxford Advanced Learner's Dictionary provides this lawyer definition:
a person who is trained and qualified to advise people about the law and to represent them in court, and to write legal documents
Under the link there's also a detailed explanation of all related terms so it's the best first resource to check.
A solicitor is a specialised kind of a lawyer. Their responsibility is narrowed to documents preparation, advisory and limited representation in courts. They are not entitled to speak in most cases in the court of law, e.g. they cannot defend in criminal cases.
This is the Oxford Advanced Learner's Dictionary definition of a solicitor:
a lawyer who prepares legal documents, for example for the sale of land or buildings, advises people on legal matters, and can speak for them in some courts of law
A lawyer who is eligible to speak in the court of law is called a barrister on an advocate depending on a region. Usually an advocate refer to a barrister who defend the case but in Scotland it's a replacement of the barrister term.
A barrister definition:
a lawyer in Britain who has the right to argue cases in the higher courts of law
An advocate definition:
- a person who defends somebody in court
- (in Scotland) a lawyer who has the right to argue cases in higher courts
More on the topic in Oxford Advanced Learner's Dictionary
And a comparison of the solicitor and barrister roles.
In American English there is no separate role of a solicitor. A British barrister role is called counsel.
Check more in Oxford Advanced American Dictionary's lawyer definition. Make sure to expand the "More About" section.