Problem with Payload mode

.NET library for SMPP protocol
Locked
DerSkythe
Posts: 11
Joined: Tue Oct 09, 2012 7:12 am

Problem with Payload mode

Post by DerSkythe » Mon Oct 29, 2012 12:59 pm

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?
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Problem with Payload mode

Post by alt » Mon Oct 29, 2012 8:28 pm

Hello DerSkythe,

do you have smppClient.ServiceType property value longer than 5 symbols?
DerSkythe
Posts: 11
Joined: Tue Oct 09, 2012 7:12 am

Re: Problem with Payload mode

Post by DerSkythe » Tue Oct 30, 2012 12:24 pm

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);
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Problem with Payload mode

Post by alt » Thu Nov 22, 2012 5:02 pm

This error can happen only when tbServiceType.Text has value longer than 5 characters. Do you have spaces in this textbox?
DerSkythe
Posts: 11
Joined: Tue Oct 09, 2012 7:12 am

Re: Problem with Payload mode

Post by DerSkythe » Fri Nov 23, 2012 7:47 am

I double check this field. There are no whitespaces
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Problem with Payload mode

Post by alt » Tue Nov 27, 2012 10:57 am

what value you have in property client.ServiceType ?
DerSkythe
Posts: 11
Joined: Tue Oct 09, 2012 7:12 am

Re: Problem with Payload mode

Post by DerSkythe » Tue Nov 27, 2012 11:33 am

ServiceType: MC, Len: 2
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Problem with Payload mode

Post by alt » Tue Nov 27, 2012 11:41 am

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.
DerSkythe
Posts: 11
Joined: Tue Oct 09, 2012 7:12 am

Re: Problem with Payload mode

Post by DerSkythe » Tue Nov 27, 2012 11:59 am

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
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Problem with Payload mode

Post by alt » Tue Nov 27, 2012 12:13 pm

I found bug in PrepareSubmit. When SubmitMode.Payload is used this method uses client.SystemType.
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Problem with Payload mode

Post by alt » Tue Nov 27, 2012 12:17 pm

I can fix this bug in 1.0.12.
But could you start to use version 1.1?
DerSkythe
Posts: 11
Joined: Tue Oct 09, 2012 7:12 am

Re: Problem with Payload mode

Post by DerSkythe » Tue Nov 27, 2012 12:24 pm

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.
DerSkythe
Posts: 11
Joined: Tue Oct 09, 2012 7:12 am

Re: Problem with Payload mode

Post by DerSkythe » Tue Nov 27, 2012 12:25 pm

My email: skif1ch at gmail.com
Locked