Page 1 of 1

Problem with Payload mode

Posted: Mon Oct 29, 2012 12:59 pm
by DerSkythe
Hello, now I am using commercial version of your library. Version 1.0.12.5.
When I trying to send sms with Payload mode I receive following error:

************** Exception Text **************
System.ArgumentOutOfRangeException: Length too long. Shouldn't be more than 5 symbols.
Parameter name: ServiceType
at Inetlab.SMPP.PDU.SubmitSm.set_ServiceType(String value)
at Inetlab.SMPP.PDU.SubmitSm..ctor(String ServiceType, Byte SrcTon, Byte SrcNpi, String SrcAddr, Byte DestTon, Byte DestNpi, String DestAddr)
at Inetlab.SMPP.SmppClient.PrepareSubmit(SubmitMode mode, Byte srcTon, Byte srcNpi, String srcAddr, Byte destTon, Byte destNpi, String destAddr, DataCodings dataCoding, Byte[] byteArray)
at Inetlab.SMPP.SmppClient.PrepareSubmit(SubmitMode mode, Byte srcTon, Byte srcNpi, String srcAddr, Byte destTon, Byte destNpi, String destAddr, DataCodings dataCoding, String Text)
at SmppClientDemo.SmppClientDemo.bSubmit_Click(Object sender, EventArgs e) in C:\Users\PVParpura\Dropbox\Dev\Inetlab.SMPP.Developer\Demo\CS\SmppClientDemo\SmppClientDemo.cs:line 479
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


In submit mode "ShortMessage" all is working fine. But in this mode I can't send long messages (as I understood).
My params:
SubmitMode: Payload, srcTon: 0, srcNpi: 1, srcAddr: 8145, destTon: 0, destNpi: 1, destAddr: 994503312380, dataCoding: Default, Text: Test

Service Type: MC
Addr_TON: 0
Addr_NPI: 1
Use SSL: NO
What's wrong with my ServiceType? And how I can send long sms?

Re: Problem with Payload mode

Posted: Mon Oct 29, 2012 8:28 pm
by alt
Hello DerSkythe,

do you have smppClient.ServiceType property value longer than 5 symbols?

Re: Problem with Payload mode

Posted: Tue Oct 30, 2012 12:24 pm
by DerSkythe
Thank you for fast reply.
No, my Service Type is MC
Here is sample of code:

Code: Select all

                     AddToLog(
                        String.Format(
                            "Prepare message. SubmitMode: {0}, srcTon: {1}, srcNpi: {2}, srcAddr: {3}, destTon: {4}, destNpi: {5}, destAddr: {6}, dataCoding: {7}, Text: {8}",
                            mode,
                            byte.Parse(tbSrcAdrTON.Text),
                            byte.Parse(tbSrcAdrNPI.Text),
                            tbSrcAdr.Text,
                            byte.Parse(tbDestAdrTON.Text),
                            byte.Parse(tbDestAdrNPI.Text),
                            tbDestAdr.Text,
                            coding,
                            tbSend.Text));

                    List<SubmitSm> req = client.PrepareSubmit(
                        mode,
                        byte.Parse(tbSrcAdrTON.Text),
                        byte.Parse(tbSrcAdrNPI.Text),
                        tbSrcAdr.Text,
                        byte.Parse(tbDestAdrTON.Text),
                        byte.Parse(tbDestAdrNPI.Text),
                        tbDestAdr.Text,
                        coding,
                        tbSend.Text);

                    foreach (SubmitSm sm in req)
                    {
                        sm.ValidityPeriod = DateTime.Now.AddDays(2).ToString("yyMMddhhmmss000+");
                        sm.RegisteredDelivery = 1;
                        sm.ServiceType = tbServiceType.Text;
                        sm.PriorityFlag = 1;
                    }

                    List<SubmitSmResp> resp = client.Submit(req);

Re: Problem with Payload mode

Posted: Thu Nov 22, 2012 5:02 pm
by alt
This error can happen only when tbServiceType.Text has value longer than 5 characters. Do you have spaces in this textbox?

Re: Problem with Payload mode

Posted: Fri Nov 23, 2012 7:47 am
by DerSkythe
I double check this field. There are no whitespaces

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 10:57 am
by alt
what value you have in property client.ServiceType ?

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 11:33 am
by DerSkythe
ServiceType: MC, Len: 2

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 11:41 am
by alt
PrepareSubmit method uses client.ServiceType property. Possible we have confusing because in code you also tried to set service type directly
sm.ServiceType = tbServiceType.Text;
but error appeared before this line.
It means you should check exactly client.ServiceType, instead of tbServiceType.Text.

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 11:59 am
by DerSkythe
Previous result generated by first string of this code.

Code: Select all

[color=#FF0000]AddToLog(String.Format("ServiceType: {0}, Len: {1}", client.ServiceType, client.ServiceType.Length));[/color]

AddToLog(
                        String.Format(
                            "Prepare message. SubmitMode: {0}, srcTon: {1}, srcNpi: {2}, srcAddr: {3}, destTon: {4}, destNpi: {5}, destAddr: {6}, dataCoding: {7}, Text: {8}",
                            mode,
                            byte.Parse(tbSrcAdrTON.Text),
                            byte.Parse(tbSrcAdrNPI.Text),
                            tbSrcAdr.Text,
                            byte.Parse(tbDestAdrTON.Text),
                            byte.Parse(tbDestAdrNPI.Text),
                            tbDestAdr.Text,
                            coding,
                            tbSend.Text));

                    List<SubmitSm> req = client.PrepareSubmit(
                        mode,
                        byte.Parse(tbSrcAdrTON.Text),
                        byte.Parse(tbSrcAdrNPI.Text),
                        tbSrcAdr.Text,
                        byte.Parse(tbDestAdrTON.Text),
                        byte.Parse(tbDestAdrNPI.Text),
                        tbDestAdr.Text,
                        coding,
                        tbSend.Text);

                    foreach (SubmitSm sm in req)
                    {
                        sm.ValidityPeriod = DateTime.Now.AddDays(2).ToString("yyMMddhhmmss000+");
                        sm.RegisteredDelivery = 1;
                        sm.ServiceType = tbServiceType.Text;
                        sm.PriorityFlag = 1;
                    }

                    List<SubmitSmResp> resp = client.Submit(req);
I am tried comment string
sm.ServiceType = tbServiceType.Text;
But it doesn't give result

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 12:13 pm
by alt
I found bug in PrepareSubmit. When SubmitMode.Payload is used this method uses client.SystemType.

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 12:17 pm
by alt
I can fix this bug in 1.0.12.
But could you start to use version 1.1?

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 12:24 pm
by DerSkythe
I bought a license on September 19. My order number: 424 640 555.
This is the standard version, without the source code (Inetlab.SMPP Client/Server Developer License).
If you give me any fixed version, I will be very thankful to you.

Re: Problem with Payload mode

Posted: Tue Nov 27, 2012 12:25 pm
by DerSkythe
My email: skif1ch at gmail.com