ReadMessageStatus

From CDYNE Wiki
Jump to navigation Jump to search

Read the status of an incoming or outgoing message.

ReadMessageStatus Request

Parameter Name Data Type Sample Input Required
LicenseKey: License key used to send message.
Trial Key
Production Key
GUID f01d89fd-5155-5455-5585-e84ab8de8591 TRUE
MessageID: Unique ID for message. GUID f01d89fd-5155-5455-5585-e84ab8da152t TRUE

ReadMessageStatus Response

Parameter Name Data Type Sample Output
Attachment: MediaID of attachment sent in message. String 12486
From: DID/short code used to send message. String 15559080983
MessageID: Unique ID set to outgoing message. GUID 1627aea5-8e0a-4371-9022-9b504344e724
MessageStatus: Status of outgoing message. String Ready
(Complete list of return codes.)
Sent Time: UTC date and time message sent. DateTime 1999-05-31T11:20:00
To: Recipient number. String 15551234567

HTTP GET Request

http://messaging.cdyne.com/Messaging.svc/ReadMessageStatus?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591&MessageId=f01d89fd-5155-5455-0000-000011af9652

Ruby

 1 require 'net/http'
 2 require 'URI' 
 3 
 4 puts URI.methods 
 5 
 6 url = URI.parse("http://messaging.cdyne.com/Messaging.svc/ReadMessageStatus?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591&MessageId=f01d89fd-5155-5455-0000-000011af9652")
 7 
 8 res = Net::HTTP.get_response(url) 
 9 
10 data = res.body 
11 
12 puts data
13 gets data

C#

 1 /*http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL*/
 2 
 3 using System;
 4 using System.Collections.Generic;
 5 using System.Linq;
 6 using System.Text;
 7 using System.Threading.Tasks;
 8 using ReadMessageStatus.WSDL;
 9 
10 namespace ReadMessageStatus
11 {
12     class Program
13     {
14         static void Main(string[] args)
15         {
16             MessagingClient client = new MessagingClient("mms2wsHttpBinding");
17 
18             OutgoingMessageResponse resp = client.ReadMessageStatus(new Guid("f01d89fd-5155-5455-5585-e84ab8de8591"), new Guid("f01d89fd-5155-5455-0000-000011af9652"));
19 
20             Console.WriteLine("MessageID: " + resp.MessageID + Environment.NewLine +
21                               "Message Status: " + resp.MessageStatus + Environment.NewLine + 
22                               "To: " + resp.To + Environment.NewLine +
23                               "From: " + resp.From + Environment.NewLine +
24                               "UTC Time Sent: " + resp.SentTime + Environment.NewLine +
25                               "Attachments: " + resp.Attachments);
26 
27             Console.ReadLine();
28         }
29     }
30 }

VB.Net

 1 'http://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL
 2 
 3 Imports ReadMessageStatus.WSDL
 4 
 5 Module Module1
 6 
 7     Sub Main()
 8 
 9         Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
10 
11         Dim resp As OutgoingMessageResponse = client.ReadMessageStatus(New Guid("f01d89fd-5155-5455-5585-e84ab8de8591"), new Guid("f01d89fd-5155-5455-0000-000011af9652"))
12 
13         Console.WriteLine("MessageID: " + Convert.ToString(resp.MessageID) + Environment.NewLine +
14                               "Message Status: " + Convert.ToString(resp.MessageStatus) + Environment.NewLine +
15                               "To: " + resp.To + Environment.NewLine +
16                               "From: " + resp.From + Environment.NewLine +
17                               "UTC Time Sent: " + Convert.ToString(resp.SentTime) + Environment.NewLine +
18                               "Attachments: " + resp.Attachments)
19         Console.ReadLine()
20 
21     End Sub
22 
23 End Module

PHP with cURL

 1 <?php
 2 
 3 $url='http://messaging.cdyne.com/Messaging.svc/ReadMessageStatus?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591&MessageId=f01d89fd-5155-5455-0000-000011af9652';
 4 
 5 $ch = curl_init(); 
 6 
 7 curl_setopt($ch,CURLOPT_URL,$url);
 8 curl_setopt($ch,CURLOPT_HTTPGET,true);
 9 curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);  
10 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
11 
12 //print_r($url);
13 
14 $response = curl_exec($ch); 
15 curl_close($ch); 
16 
17 print_r($response);
18 
19 ?>

VBScript

 1 Dim oXMLHTTP
 2 Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
 3 Set oDoc = CreateObject("MSXML2.DOMDocument")
 4 
 5 Call oXMLHttp.Open("GET", "http://messaging.cdyne.com/Messaging.svc/ReadMessageStatus?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591&MessageId=f01d89fd-5155-5455-0000-000011af9652", False)
 6 Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
 7 Call oXMLHttp.send
 8 
 9 MsgBox oXMLHTTP.responseText
10 
11 Const ForReading = 1, ForWriting = 2, ForAppending = 8
12 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
13 Dim fso, MyFile, FileName, TextLine
14 Set fso = CreateObject("Scripting.FileSystemObject")
15 FileName = "c:\Users\Desktop\MMS.txt"
16 Set MyFile = fso.OpenTextFile(FileName, ForWriting, True)
17 MyFile.WriteLine oXMLHttp.responseText
18 MyFile.Close
19 Set MyFile = fso.OpenTextFile(FileName, ForReading)
20 Do While MyFile.AtEndOfStream <> True
21 TextLine = MyFile.ReadLine
22 Loop
23 MyFile.Close  
24 
25 set request = nothing

JAVA

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL;
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public final class ReadMessageStatus {
14 
15     public static void main(String[] args) {
16 
17         try {
18             URL url = new URL("http://messaging.cdyne.com/Messaging.svc/ReadMessageStatus?"
19                     + "LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591"
20                     + "&MessageId=f01d89fd-5155-5455-0000-000011af9652");
21             try {
22                 InputStream in = url.openStream();
23                 StreamSource source = new StreamSource(in);
24                 printResult(source);
25             } catch (java.io.IOException e) {
26             }
27         } catch (MalformedURLException e) {
28         }
29     }
30 
31     private static void printResult(Source source) {
32         try {
33             ByteArrayOutputStream bos = new ByteArrayOutputStream();
34             StreamResult sr = new StreamResult(bos);
35             Transformer trans = TransformerFactory.newInstance().newTransformer();
36             Properties oprops = new Properties();
37             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
38             trans.setOutputProperties(oprops);
39             trans.transform(source, sr);
40             System.out.println("**** Response ******");
41             System.out.println(bos.toString());
42 
43             bos.close();
44             System.out.println();
45         } catch (Exception e) {
46         }
47     }
48 }