Hi, Are you able to send plain messages? Have you explicitly defined your SMSC number? HUAWEIs usually require the SMSC declaration.
On 3 August 2010 13:57, ydjadi <[email protected]> wrote: > Unable to send a Wap Push SMS. I using SMSLib v3.4.6, huawei modem > model E126G and here is the code i'm using : > > import java.net.URL; > > import org.smslib.GatewayException; > import org.smslib.OutboundWapSIMessage; > import org.smslib.Service; > import org.smslib.TimeoutException; > import org.smslib.modem.SerialModemGateway; > > public class SendWAPPush { > > private static String COM_PORT = "COM9"; > private static int BAUD_RATE = 9600; > private static String MANUFACTURER = "HUAWEI"; > private static String MODEL = "E156G"; > private static String PIN_CODE = "5244"; > > private SerialModemGateway gateway = null; > private OutboundWapSIMessage message = null; > private String destPhoneNumber = null; > private String content = null; > private String link = null; > private Service service; > > public SendWAPPush(String destPhoneNumber, String link, String > content) { > this.gateway = new SerialModemGateway("modem." + COM_PORT, > COM_PORT, BAUD_RATE, MANUFACTURER, MODEL); > this.gateway.setSimPin(PIN_CODE); > this.destPhoneNumber = destPhoneNumber; > this.content = content; > this.link = link; > } > > public boolean doIt() throws Exception { > boolean sent = false; > service = new Service(); > gateway.setInbound(true); > gateway.setOutbound(true); > service.addGateway(gateway); > service.startService(); > message = new OutboundWapSIMessage(destPhoneNumber, new > URL(link), content); > message.setIndicationText("Test WAP"); > message.setSignal(OutboundWapSIMessage.WapSISignals.HIGH); > try { > service.sendMessage(message, gateway.getGatewayId()); > sent = true; > } catch (GatewayException e) { > e.printStackTrace(); > System.out.println("Message non envoye pour > GatewayException"); > System.out.println(e.getMessage()); > } catch (InterruptedException e) { > e.printStackTrace(); > System.out.println("Message non envoye pour > InterruptedException: APPEL interrompu"); > System.out.println(e.getMessage()); > } catch (TimeoutException e) { > e.printStackTrace(); > System.out.println("Message non envoye pour > TimeoutException: gateway n'a pas repondu a temps"); > System.out.println(e.getMessage()); > } catch (Exception e){ > e.printStackTrace(); > System.out.println(e.getMessage()); > } > service.stopService(); > return sent; > } > > public static void main(String[] args) { > // TODO Auto-generated method stub > SendWAPPush wapPush = new SendWAPPush("+212679760689", > "http:// > www.google.com/", "Visit Google."); > try > { > if(wapPush.doIt()) { > System.out.println("Message envoyé."); > } else { > System.out.println("Message non envoyé."); > } > } > catch (Exception e) > { > e.printStackTrace(); > } > } > > } > > I need your help. > > -- > You received this message because you are subscribed to the Google Groups > "SMSLib User Group" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<smslib%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/smslib?hl=en. > > -- You received this message because you are subscribed to the Google Groups "SMSLib User Group" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/smslib?hl=en.
