Question: I am pretty new to tikz. I need a request response message in tikz. I have attached the image. I need the image should be generated as shown in the attached figure.[![enter image description here](https://i.stack.imgur.com/vi3Qc.jpg)](https://i.stack.imgur.com/vi3Qc.jpg) I have tried a lot, but struck in between. Here is the source.

```
 \documentclass[12pt,a4paper,twoside]{report}
 \usetikzlibrary{shapes, arrows, positioning}
 \usepackage{pgfplots}
 \usepackage{tikz}
 \usetikzlibrary{patterns}
 \usepgfplotslibrary{groupplots}
 \pgfplotsset{compat=1.12}
 \begin{document}
 \begin{figure}
 \centering
 \begin{tikzpicture}[shape=rectangle, text width=2cm, minimum height=3cm, minimum width=2cm, node distance=5cm, align=center, ultra thick, color=black]
 \node [draw](sp) {Service Provider};
 \node [draw,right=of sp] (sc) {Service Consumer};
 \draw [->] (sp) -- node [right] {request service} (sc) ;
 \draw [->] (sc.west) +(0,-1em) coordinate (b1) -- (sp.east |- b1);
 \end{tikzpicture}
 \end{figure} 
 \end{document}

```

Answer: 
You're fairly close actually. First, you do of course need to have `\usepackage{tikz}` before `\usetikzlibrary{..}`.

As for the diagram, instead of having all those settings directly in the `tikzpicture` options, make a new style with `stylename/.style={<list of settings>}`, and apply that style to your two nodes. Because you had them like that, it seems they applied to the node with `request service` as well, which is why that node had a linebreak in it. Finally, place the `request`/`response for` nodes `above` the path, instead of `right`. I also shifted the first line up, in the same way you shifted the second one down. 

[![output of code](https://i.stack.imgur.com/0sJU0.png)](https://i.stack.imgur.com/0sJU0.png)

```
\documentclass[12pt,a4paper,twoside]{report}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
 mybox/.style={
   text width=2cm,
   minimum height=3cm,
   minimum width=2cm,
   node distance=5cm,
   align=center,
   ultra thick,
   draw},
 myarrow/.style={
   ->,
   >=stealth,
   thick
  }
]
\node [mybox](sp) {Service Provider};
\node [mybox,right=of sp] (sc) {Service Consumer};
\draw [myarrow] (sp.east) +(0,-1em) coordinate (b1) -- node [above] {response for service} (sc.west |- b1) ;
\draw [myarrow] (sc.west) +(0,1em) coordinate (b1) --node[above] {request for a service} (sp.east |- b1);
\end{tikzpicture}
\end{figure} 
\end{document}

```
[![enter image description here](https://i.stack.imgur.com/4fHoH.png)](https://i.stack.imgur.com/4fHoH.png)

so similar to [Torbjørn T.](http://%20Torbj%C3%B8rn%20T) answer that I was doubt to publish because I was to late for 3 min:

```
 \documentclass[12pt,a4paper,twoside]{report}
 \usepackage{tikz}
 \usetikzlibrary{ arrows.meta, positioning, quotes, shadows}

 \begin{document}
 \begin{figure}
 \centering
 \begin{tikzpicture}[
 node distance = 2mm and 55mm,
             > = Stealth,
    box/.style = {rectangle, draw, thick, fill=white,
                   text width=2cm, minimum height=3cm,
                   align=center,  drop shadow}
                    ]
 \node [box](sp)                {Service Provider};
 \node [box,right=of sp] (sc)   {Service Consumer};
 \draw [->] ([yshift=3mm] sp.east)  to ["request for service"] ([yshift=3mm] sc.west) ;
 \draw [->] ([yshift=-3mm] sc.west) to ["response for service"] ([yshift=-3mm] sp.east);
 \end{tikzpicture}
 \end{figure}
 \end{document}

```