I am trying to reply to incoming message (I believe I don't need to send any invitations in this case).
Once a 'message' resource from 'conversation' sender is received, I took the link
<link rel="messaging" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/messaging" />
Then I constructed a url:
url = host + "/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/messaging" + "?OperationId=73dc2a78-2c09-43d3-ade9-166a17845a03";
(OperationId I generated)
Afther that I POST to that link with a reply message.
The response was:
<?xml version="1.0" encoding="utf-8"?>
<reason xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/rtc/2012/03/ucwa">
<code>ServiceFailure</code>
<subcode>None</subcode>
<message>Your request couldn't be completed.</message>
<debugInfo>
<property name="errorReportId">14cb93491da94ab8a638e148462fcc21</property>
</debugInfo>
<parameters />
</reason>
My scenario:
1) once 'messagingInvitation' event arrives, I 'follow' the 'accept' link. 2) following event(s) that I receive which contains 'conversation' resource:
<sender rel="conversation" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903">
<updated rel="messaging" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/messaging">
<resource rel="messaging" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/messaging">
<link rel="conversation" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903" />
<link rel="stopMessaging" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/messaging/terminate" />
<property name="state">Connecting</property>
</resource>
</updated>
</sender>
3) Then, another 'event' arrives, relevant part:
<sender rel="communication" href="/ucwa/oauth/v1/applications/103298024370/communication">
<updated rel="conversation" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903">
<resource rel="conversation" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903">
<link rel="applicationSharing" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/applicationSharing" />
<link rel="audioVideo" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/audioVideo" />
<link rel="dataCollaboration" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/dataCollaboration" />
<link rel="messaging" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/messaging" />
<link rel="phoneAudio" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/phoneAudio" />
<link rel="localParticipant" href="/ucwa/oauth/v1/applications/103298024370/communication/conversations/81bf5ef8-885f-4579-9add-a5857ccf6903/participants/XXXXX" title="xxxxxxx" />
<link rel="addParticipant" href="/ucwa/oauth/v1/applications/103298024370/communication/participantInvitations?conversation=81bf5ef8-885f-4579-9add-a5857ccf6903" />
<property name="state">Connected</property>
<property name="threadId">AdKCFu+gFQccG58iQA6mppaTcfoeBwAABC+wAACcbnAAAHuvoAAhdqzwAAv+RhAAAuLo8A==</property>
<property name="subject"></property>
<propertyList name="activeModalities">
<item>Messaging</item>
</propertyList>
<property name="importance">Normal</property>
<property name="recording">False</property>
</resource>
<property name="state">Connected</property>
So it means that I am connected, right?
What should be my next step?
My Scenario Update
You are indeed connected to both the conversation and messaging. Your next step should be to either issue a GET request on the messaging resource or look for events related to messaging that contains links to sendMessage. Finally with that sendMessage link you can provide a text/plain body with the message you wish to send.
Initial Notes
You should not be able to reply to any received messages unless there is an active conversation. The messaging resource is not the correct resource to use to respond to messages. In your scenario if you are receiving a message from another contact and have not established a conversation you would be looking at a messagingInvitation that included a message. If this is your scenario the intended solution is to inspect the messaging resources links and locate addMessaging link and POST on that where it appears you can include a reply message.
If this is not the scenario, feel free to provide additional details.