Hi,
I have to use jsmpp to send a message.
here is the link of homne page
http://code.google.com/p/jsmpp/SO I'm trying to test the sample exqamples provided on the home page of jsmpp.
Now when I try to compile ist example I get following message.
There is no ample documentation available for me to understand the error or to findout which is another constructor
available for " GeneralDataCoding" class. the example I'm trying to compile is
SimpleSubmitExample.java
I have included all the jars of jsmpp and its dependencies in the classpath,
funny part is my compiler is able to find all other classes from the "org.jsmpp.bean." package but
not able to find " GeneralDataCoding" class's constructor.
I would like to thank you for the help in advance.
Following is my error message,
==========================================================================================
D:\java sms\sms\SimpleSubmitExample.java:41: cannot find symbol
symbol : constructor GeneralDataCoding(org.jsmpp.bean.Alphabet,org.jsmpp.bean.MessageClass,boolean)
location: class org.jsmpp.bean.GeneralDataCoding
String messageId = session.submitShortMessage("CMT", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "1616", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "628176504657", new ESMClass(), (byte)0, (byte)1, timeFormatter.format(new Date()), null, new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT), (byte)0, new GeneralDataCoding(Alphabet.ALPHA_DEFAULT,
^
MessageClass.CLASS1,false), (byte)0, "jSMPP simplify SMPP on Java platform".getBytes());
1 error
Tool completed with exit code 1
==========================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
This is the code I'm trying to compile.
===========================
package org.jsmpp.examples;
import java.io.IOException;
import java.util.Date;
import org.jsmpp.InvalidResponseException;
import org.jsmpp.PDUException;
import org.jsmpp.bean.Alphabet;
import org.jsmpp.bean.BindType;
import org.jsmpp.bean.ESMClass;
import org.jsmpp.bean.GeneralDataCoding;
import org.jsmpp.bean.MessageClass;
import org.jsmpp.bean.NumberingPlanIndicator;
import org.jsmpp.bean.RegisteredDelivery;
import org.jsmpp.bean.SMSCDeliveryReceipt;
import org.jsmpp.bean.TypeOfNumber;
import org.jsmpp.extra.NegativeResponseException;
import org.jsmpp.extra.ResponseTimeoutException;
import org.jsmpp.session.BindParameter;
import org.jsmpp.session.SMPPSession;
import org.jsmpp.util.AbsoluteTimeFormatter;
import org.jsmpp.util.TimeFormatter;
/**
* @author uudashr
*
*/
public class SimpleSubmitExample {
private static TimeFormatter timeFormatter = new AbsoluteTimeFormatter();;
public static void main(String[] args) {
SMPPSession session = new SMPPSession();
try {
session.connectAndBind("localhost", 8056, new BindParameter(BindType.BIND_TX, "test", "test", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));
} catch (IOException e) {
System.err.println("Failed connect and bind to host");
e.printStackTrace();
}
try {
String messageId = session.submitShortMessage("CMT", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "1616", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "628176504657", new ESMClass(), (byte)0, (byte)1, timeFormatter.format(new Date()), null, new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT), (byte)0, new GeneralDataCoding(Alphabet.ALPHA_DEFAULT, MessageClass.CLASS1,false), (byte)0, "jSMPP simplify SMPP on Java platform".getBytes());
System.out.println("Message submitted, message_id is " + messageId);
} catch (PDUException e) {
// Invalid PDU parameter
System.err.println("Invalid PDU parameter");
e.printStackTrace();
} catch (ResponseTimeoutException e) {
// Response timeout
System.err.println("Response timeout");
e.printStackTrace();
} catch (InvalidResponseException e) {
// Invalid response
System.err.println("Receive invalid respose");
e.printStackTrace();
} catch (NegativeResponseException e) {
// Receiving negative response (non-zero command_status)
System.err.println("Receive negative response");
e.printStackTrace();
} catch (IOException e) {
System.err.println("IO error occur");
e.printStackTrace();
}
session.unbindAndClose();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Later I will be using this code in a servlet,
If any tips regarding using this process in a servlet are given it would be really nice,
Thank You,
Regards,--
Charudatta.M.Joshi