DeliverSm failing during deserializing

.NET library for SMPP protocol
Post Reply
NickAskew
Posts: 60
Joined: Tue Oct 07, 2008 1:35 pm

DeliverSm failing during deserializing

Post by NickAskew » Tue Aug 19, 2014 5:47 pm

Hi

I am using v1.1.15.5

I can serialize the DeliverSm however upon deserializing I am receiving:
System.NullReferenceException: Object reference not set to an instance of an object.
at Inetlab.SMPP.PDU.DeliverSm.ReadFromBuffer(SmppBuffer buf, Int32& offset) in E:\Home\My Documents\Visual Studio 2013\Projects\Azure\20140807 SlickSMS\Inetlab.SMPP.Source\Source\VB.NET\PDU\DeliverSm.vb:line 333
at Inetlab.SMPP.PDU.DeliverSm..ctor(SerializationInfo info, StreamingContext context) in E:\Home\My Documents\Visual Studio 2013\Projects\Azure\20140807 SlickSMS\Inetlab.SMPP.Source\Source\VB.NET\PDU\DeliverSm.vb:line 519
at ReadDeliverSmFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)...

Specifically this line in the source:
SourceAddr = buf.ToCString(offset, Client.GetMappedEncoding(DataCodings.Default))

'Client' is Nothing/Null because I have no way of associating the DeliverSm with an active SmppClient owing to me deserializing the DeliverSm from a queue - is there a workaround for this rather than me removing these references to the Client from the code?

My code to deserialize from the queue is: (DeliverSm)dsm = (Microsoft.ServiceBus.Messaging.BrokeredMessage)receivedMessage.GetBody(Of DeliverSm)()

Regards
Nick
ProcessFlows UK Ltd
http://www.processflows.co.uk/

hishhash2
Posts: 12
Joined: Mon Jan 30, 2012 11:24 am

Re: DeliverSm failing during deserializing

Post by hishhash2 » Tue May 29, 2018 6:31 am

I am also facing the similar issue when trying to deserialize. Am I doing something wrong in the below code?

string sPDU = "0000004200000005000000000000000a4E4F52455000010139373135303030303030303000050054455354000400000000000003001369643A313233343536373839";
byte[] message_payload_bytes = System.Text.Encoding.ASCII.GetBytes(sPDU);
DeliverSm deliverSM = DeliverSm.Deserialize(message_payload_bytes);

I am getting the below error,

Index was outside the bounds of the array.
at Inetlab.SMPP.PDU.DeliverSm.CRvxk0OPMh(FDORcP2nblJm3MATP1 , Int32& )
at Inetlab.SMPP.PDU.DeliverSm.RrfxrANwyQ(FDORcP2nblJm3MATP1 , Int32& , SmppClientBase )
at Inetlab.SMPP.PDU.DeliverSm.Deserialize(Byte[] data)
at SmppClientDemo.SmppClientDemo.SmppClientDemo_Load(Object sender, EventArgs e) in c:\Users\hisham\Desktop\Inetlab.SMPP\Demo\CS\SmppClientDemo\SmppClientDemo.cs:line 642


Regards,
Hisham

alt
Site Admin
Posts: 728
Joined: Tue Apr 25, 2006 9:45 am

Re: DeliverSm failing during deserializing

Post by alt » Wed Jun 20, 2018 7:43 pm

Hallo Hisham,

This PDU has wrong short message length. It is defined as 19 (HEX 0x13), but actually 12.
The length of entire PDU 0x42 is correct.

Post Reply