1

I have developed a web application that sends HTTP requests to a JSON API and gets responses from it. It is also sending E-mails via an SMTP server to users. I am stuck on how to modelise these scenarios in my sequence diagrams.

Edit:

The sequence for logging in goes as the following:

1-The user inputs his login and password to the view

2-The view sends the inputted data to the controller

3-The controller calls a function located in the WebService class

4- The functions creates an instance of the login request model (The login request model is a class that has the same format as the JSON data that will be sent)

5- The function serializes the created instance to JSON and sends it via HTTP to the remote Web service

6- The functions reads the response stream and deserializes it into a new instance of the response class

7-The instance created then is sent back to the controller

8-The controller runs a test on the received instance to see if the user has provided correct credentials or not

9-Based on the test results, the controller redirects the user to either the landing page (in case he inputted the right credentials) or sends a message in the index page indicating that the credentials are wrong

In this case, what will be the actors in my sequence diagram and what should I put in it and what should I leave undescriped?

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • 1
    Why is it in french and what do you want exactly? – jim May 18 '16 at 22:00
  • @jim It is in french because that's the language I am working with. What I want to do is a sequence diagram for my project. – Yacine Ben Slimene May 19 '16 at 12:46
  • Well, there you have it. Even better, it's in French! – jim May 19 '16 at 13:01
  • I think you're making a big deal of it being in french !!! If you have an idea about how to make a sequence diagram for a web application that sends requests to a JSON API please provide your experience. – Yacine Ben Slimene May 20 '16 at 03:01
  • Probably :) Let me walk you through your question anyway: "Here is a diagram. I will not tell you what is on it. I will not tell you what is wrong with it. Please help me fix it." I don't think anyone can assist you with all that's given. – jim May 20 '16 at 07:20
  • @jim I see your point now. sorry ! Let me edit my question. – Yacine Ben Slimene May 21 '16 at 18:23

1 Answers1

1

Your initial diagram is a good start.

I've annotated it here with english text in black (so taht everybody can benefit from it), the references of your numbered sequence list, and some changes in magenta. I've also added 3 circles to highlight some general remarks: enter image description here

Remark 1: it's unclear for me if this first message is synchronous (plain arrow). Does your user class really wait for a return ? I think this could be asynchronous, and the final message that comes back would then not necessarily be an return message (dotted line).

Remark 2: the incoming message 4 on the request template/model is asynchronous. So I'd expect the answer being an asynchronous message as well (not dotted).

Remark 3: Here (and on several other occasions), you have an incoming "create" message. If you create a new object, you'd better start the lifeline there, to show the instantiation.

Remark: you can show alternative interactions (at the end of the sequence) less ambiguously by using an alt region.

Final remark: you worry about different kind of transmission (i.e. JSON vs. SMTP). The UML diagram doesn't show the format of the message. So if the flow is the same but only the protocol changes, you could just keep it (and eventually make an annotation to show that its JSON or SMTP). If you'd have different kind of interactions in the sequence, you could use an alt.

Community
  • 1
  • 1
Christophe
  • 68,716
  • 7
  • 72
  • 138