For sending a message to a Cisco VoIP Phone, I use Apache HttpClient:
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new StringEntity(body, ContentType.TEXT_XML));
httpPost.addHeader(new BasicScheme().authenticate(usernamePasswordCredentials, httpPost, null));
The XML message looks like this
String body =
"""
XML=
<CiscoIPPhoneText>
<Title>...</Title>
<Prompt>...</Prompt>
<Text>...</Text>
</CiscoIPPhoneText>
""";
The URL used is with IP adress like
String url = "https://<ip-adress>/CGI/Execute";
Wenn executing the POST request
HttpResponse response = closeableHttpClient.execute(httpPost);
I recieve status code 400 and
<CiscoIPPhoneError Number="1"></CiscoIPPhoneError>
I don't know what that means and what the problem is with the POST request.
The authentication seams to have been successful, because if I remove the part httpPost.addHeader(new BasicScheme()... then I get 401.
The content of the HTTP POST should be in application/x-www-form-urlencoded format, so specifying the right content header and encoding the XML=[data], something like:
(Crossposted at https://community.cisco.com/t5/other-collaboration-subjects/tesxt-message-to-voip-phone-ciscoripphoneerror-1/m-p/4435874)