CancelMessage

From CDYNE Wiki
Jump to: navigation, search

This method uses the Message ID to cancel a message scheduled for a later time or date. Does not work if message was already sent out or queued.

Contents

CancelMessage Request

Parameter Name Data Type Sample Input
MessageID: Input unique Guid ID that is returned with every SMS message sent. Guid B01d89fd-5155-5455-5585-e84ab8de8591

HTTP Method

HTTP Method: GET

Url: http://sms2.cdyne.com/sms.svc/CancelMessage?MessageID={MESSAGEID}

Url: https://sms2.cdyne.com/sms.svc/CancelMessage?MessageID={MESSAGEID}

CancelMessage Response

Parameter Name Data Type Sample Output
Returns a True or False value String False

XML Response

The following is an example response Xml body:


<boolean xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</boolean>

Json Response

The following is an example response Json body:


true

CancelMessage Code Examples

C#

IsmsClient client = new IsmsClient("sms2wsHttpBinding");
bool resp = client.CancelMessage(new Guid("MESSAGE ID HERE"));
bool Success = true;
if (Success == true)
{
Console.WriteLine("Message successfully cancelled.");
}
Console.ReadLine();
client.Close();

VB.NET

Imports CancelMessage.WSDL
Module Module1
Sub Main()
Dim client As New CancelMessage.WSDL.IsmsClient("sms2wsHttpBinding")
Dim resp As Boolean = client.CancelMessage(New Guid("MESSAGE ID HERE"))
Dim Success As Boolean = True
If Success = True Then
Console.WriteLine("Message successfully cancelled.")
End If
Console.ReadLine()
client.Close()
End Sub
End Module

PHP

Returns a 1 if the SMS is canceled and nothing if it is not cancelled.

 
 
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');  
 
$param = array('MessageID' => 'Message ID'//MessageID from SMSResponse Object
);
 
$result = $client->CancelMessage($param);
 
print_r($result);
 
 

PHP with cURL

 
 
$url='http://sms2.cdyne.com/sms.svc/CancelMessage?MessageID=(Message ID)';
 
$cURL = curl_init();
 
curl_setopt($cURL,CURLOPT_URL,$url);
curl_setopt($cURL,CURLOPT_HTTPGET,true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
 
$result = curl_exec($cURL);
 
curl_close($cURL);
 
print_r($result);
 
 

VBScript

Dim oXMLHTTP
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set oDoc = CreateObject("MSXML2.DOMDocument")
Call oXMLHttp.Open("GET", "http://sms2.cdyne.com/sms.svc/CancelMessage?MessageID=MESSAGE ID HERE", False)
Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
Call oXMLHttp.send
MsgBox oXMLHTTP.responseText

Ruby

require 'net/http'
require 'URI'
puts URI.methods
url = URI.parse('http://sms2.cdyne.com/sms.svc/CancelMessage?MessageID=MESSAGE ID HERE')
res = Net::HTTP.get_response(url)
data = res.body
puts data
gets data

JAVA

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
 
public final class CancelMessage{
public static void main(String[] args) {
 
try{
URL url = new URL("http://sms2.cdyne.com/sms.svc/CancelMessage?"
+ "MessageID=MESSAGEID OF MESSAGE YOU WANT TO CANCEL");
try{
InputStream in = url.openStream();
StreamSource source = new StreamSource(in);
printResult(source);
}catch(java.io.IOException e){
e.printStackTrace();
}
}catch (MalformedURLException e){
e.printStackTrace();
}
}
private static void printResult(Source source) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
StreamResult sr = new StreamResult(bos);
 
Transformer trans = TransformerFactory.newInstance().newTransformer();
Properties oprops = new Properties();
oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperties(oprops);
trans.transform(source, sr);
System.out.println("**** Response ******");
 
System.out.println(bos.toString());
 
bos.close();
System.out.println();
} catch (Exception e) {
}
}
}
Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key