Hi,

I used both iptraf  and a custom script to dump the request and I
verified what I am sending (the XML in the previous email is from
dumping the request I am sending).
However, I agree with you and I trust the logs and even the logs say
the same thing.
The GET you see there is the GET generated by Kannel toward my
endpoint to confirm the delivery.

I found this bit in the log and it might be useful: The url is not
un-escaped (& appears there)

010-02-18 09:42:24 [1168] [9] DEBUG: Parsing URL
`http://localhost/delivery-report.php?send_history_id=13853218&to_number=xxxx&type=8':
2010-02-18 09:42:24 [1168] [9] DEBUG:   Scheme: http://
2010-02-18 09:42:24 [1168] [9] DEBUG:   Host: localhost
2010-02-18 09:42:24 [1168] [9] DEBUG:   Port: 80
2010-02-18 09:42:24 [1168] [9] DEBUG:   Username: (null)
2010-02-18 09:42:24 [1168] [9] DEBUG:   Password: (null)
2010-02-18 09:42:24 [1168] [9] DEBUG:   Path: /delivery-report.php
2010-02-18 09:42:24 [1168] [9] DEBUG:   Query:
send_history_id=13853218&to_number=xxxx&type=8
2010-02-18 09:42:24 [1168] [9] DEBUG:   Fragment: (null)

I am attaching the log which show step by step all the sequence from
when my XML-POST request is received  to when the delivery is
generated.

Do I need to encode the elements is some way ?


Oscar
On Thu, Feb 18, 2010 at 10:34 AM, Nikos Balkanas <[email protected]> wrote:
>
> Hi,
>
> Please verify what you are sending. Use tcpdump or another sniffer. From SMS 
> logs you don't send *any* POSTs, just a GET and an incomplete one at that. If 
> it comes to what I trust more, logs or your sayings, I'll go with the logs, 
> anythime.
>
> BR,
> Nikos
>
> ----- Original Message -----
> From: oscar cassetti
> To: [email protected]
> Sent: Thursday, February 18, 2010 12:19 PM
> Subject: Re: XML Post and dlr-url
> Hi All,
>
> Sorry I think  I wasn't really precise.
>
> I am using XML-POST to send sms through cgi-bin/sendmessage. Basically what I 
> do is very simple. I build the XML request into a string
> and the I send  it using an HTTP/POST.  To write the XML request I am using a 
> Perl library (XML::Writer) which produces a valid XML.
> When I post I specify the Content-type 'text/xml'.
> res = $self->{'UA'}->post( $service_url, 'Content-type' => 'text/xml', 
> 'Content' => $xml_str);
>
> Everything works messages are processed and sent correctly and the content of 
> the message is escaped and un-escaped correctly. There is only one issue with 
> the delivery report.
>
> The problem is that one of the element of the XML-POST 
> http://www.kannel.org/download/1.4.3/userguide-1.4.3/userguide.html#POSTXML
> is the  url  to acknowledge the delivery  <dlr-url>  </dlr-url>.
> This url in plain text (non XML or HTML encoded) is
> http://localhost/delivery-report.php?send_history_id=xxxxx&to_number=xxxxx&type=%d
> When XML::Writer writes the element <dlr-url> it rightly coverts &  to  
> &amp;. However, Kannel doesn't seem to un-escape the character and as a
> result the url which is used by the smsbox to report the delivery is wrong 
> because the &  is still &amp;
>
> Below an example of xml which I send to kannel:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <message>
> <submit>
> <da><number>353870xxxxx</number></da>
> <oa><number>35387xxxxxx</number></oa
> ><ud>Test%20send%20%E2%82%AC%20%25%3C%20%3F%20%3E%20%3C%2Fua%3E%20</ud>
>
> <statusrequest>
> <dlr-mask>31</dlr-mask>
> <dlr-url>http://localhost/delivery-report.php?send_history_id=13853217&amp;to_number=353870xxxxx6&amp;type=%d</dlr-url></statusrequest>
>
> <!-- request from application to Kannel -->
> <from>
> <username>xxxxxxx</username>
> <password>xxxxxx</password>
> </from>
> </submit>
> </message>
>
> >From the smsbox log you can see that &amp; is not un-escaped;
>
> 9 2d 72 65   GET /delivery-re
> e 64 5f 68 69   port.php?send_hi
> 8 35 33 32 31   story_id=1385321
> d 62 65 72 3d   7&amp;to_number=
> 6 26 61 6d 70   3538xxxxxxxx&amp
> 0 2f 31 2e 31   ;type=8 HTTP/1.1
> 1 6c 68 6f 73   ..Host: localhos
> f 6e 3a 20 6b   t..Connection: k
> 5 73 65 72 2d   eep-alive..User-
> 5 6c 2f 31 2e   Agent: Kannel/1.
>                 4.3....
>
> As I said before I tried to escape the & in HTML/URI way but the result was 
> similar.
>
> 47 45 54 20 2f 64 65 6c 69 76 65 72 79 2d 72 65   GET /delivery-re
> 70 6f 72 74 2e 70 68 70 3f 73 65 6e 64 5f 68 69   port.php?send_hi
> 73 74 6f 72 79 5f 69 64 3d 31 33 38 35 33 32 31   story_id=1385321
> 35 25 32 36 74 6f 5f 6e 75 6d 62 65 72 3d 33 35   5%26to_number=35
> 33 38 37 30 36 33 32 33 34 36 25 32 36 74 79 70   3870632346%26typ
> 65 3d 38 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f   e=8 HTTP/1.1..Ho
> 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 0d 0a 43   st: localhost..C
> 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d   onnection: keep-
> 61 6c 69 76 65 0d 0a 55 73 65 72 2d 41 67 65 6e   alive..User-Agen
> 74 3a 20 4b 61 6e 6e 65 6c 2f 31 2e 34 2e 33 0d   t: Kannel/1.4.3.
>
2010-02-18 09:42:23 [1168] [3] INFO: smsbox: Got HTTP request 
</cgi-bin/sendsms> from <127.0.0.1>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: XML: <<?xml version="1.0" 
encoding="UTF-8"?>
<message><submit><da><number>xxxxxxx</number></da><oa><number>xxxxxxxxx</number></oa><ud>Test%20send%20%E2%82%AC%20%25%3C%20%3F%20%3E%20%3C%2Fua%3E%20
</ud><statusrequest><dlr-mask>31</dlr-mask><dlr-url>http://localhost/delivery-report.php?send_history_id=xxxxxxx&amp;to_number=xxxxxx&amp;type=%d</dlr-
url></statusrequest><!-- request from application to Kannel 
--><from><username>xxxxxx</username><password>xxxxxx</password></from></submit></message>
>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <from> value 
<<username>xxxx</username><password>xxxx</password>>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <username> value <xxxx>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <password> value <xxxx>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <oa> value 
<<number>xxxx</number>>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <number> value <xxxx>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <da> value 
<<number>xxxx</number>>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <number> value <xxxx>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <statusrequest> value 
<<dlr-mask>31</dlr-mask><dlr-url>http://localhost/delivery-report.php?send_history
_id=13853217&amp;to_number=xxxx&amp;type=%d</dlr-url>>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <dlr-mask> value <31>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <dlr-url> value 
<http://localhost/delivery-report.php?send_history_id=13853217&amp;to_number=35387063234
6&amp;type=%d>
2010-02-18 09:42:23 [1168] [3] DEBUG: XMLParsing: tag <ud> value 
<Test%20send%20%E2%82%AC%20%25%3C%20%3F%20%3E%20%3C%2Fua%3E%20>
2010-02-18 09:42:23 [1168] [3] INFO: sendsms used by <xxxx>
2010-02-18 09:42:23 [1168] [3] INFO: sendsms sender:<xxxx:xxxx> (127.0.0.1) 
to:<multi-cast> msg:<Test send € %< ? > </ua> >
2010-02-18 09:42:23 [1168] [3] DEBUG: Stored UUID 
d206339b-29ee-44fc-b6fb-4cbf660cf583
2010-02-18 09:42:23 [1168] [3] DEBUG: message length 27, sending 1 messages
2010-02-18 09:42:23 [1168] [3] DEBUG: Status: 202 Answer: <Sent.>
2010-02-18 09:42:23 [1168] [3] DEBUG: Delayed reply - wait for bearerbox
2010-02-18 09:42:23 [1168] [0] DEBUG: Got ACK (0) of 
d206339b-29ee-44fc-b6fb-4cbf660cf583
2010-02-18 09:42:23 [1168] [0] DEBUG: HTTP: Destroying HTTPClient area 
0x973c068.
2010-02-18 09:42:23 [1168] [0] DEBUG: HTTP: Destroying HTTPClient for 
`127.0.0.1'.
2010-02-18 09:42:24 [1168] [4] INFO: Starting delivery report <xxxx> from <xxxx>
2010-02-18 09:42:24 [1168] [4] DEBUG: Started thread 8 (gwlib/fdset.c:poller)
2010-02-18 09:42:24 [1168] [4] DEBUG: Started thread 9 
(gwlib/http.c:write_request_thread)
2010-02-18 09:42:24 [1168] [4] INFO: Starting delivery report <xxxx> from <xxxx>

2010-02-18 09:42:24 [1168] [9] DEBUG: Parsing URL 
`http://localhost/delivery-report.php?send_history_id=13853218&amp;to_number=xxxx&amp;type=8':
2010-02-18 09:42:24 [1168] [9] DEBUG:   Scheme: http://
2010-02-18 09:42:24 [1168] [9] DEBUG:   Host: localhost
2010-02-18 09:42:24 [1168] [9] DEBUG:   Port: 80
2010-02-18 09:42:24 [1168] [9] DEBUG:   Username: (null)
2010-02-18 09:42:24 [1168] [9] DEBUG:   Password: (null)
2010-02-18 09:42:24 [1168] [9] DEBUG:   Path: /delivery-report.php
2010-02-18 09:42:24 [1168] [9] DEBUG:   Query: 
send_history_id=13853218&amp;to_number=xxxx&amp;type=8
2010-02-18 09:42:24 [1168] [9] DEBUG:   Fragment: (null)
2010-02-18 09:42:24 [1168] [9] DEBUG: HTTP: Opening connection to 
`localhost:80' (fd=27).
2010-02-18 09:42:24 [1168] [9] DEBUG: Socket connecting
2010-02-18 09:42:24 [1168] [8] DEBUG: Get info about connecting socket
2010-02-18 09:42:24 [1168] [8] DEBUG: HTTP: Sending request:
2010-02-18 09:42:24 [1168] [8] DEBUG: Octet string at 0x9740528:
2010-02-18 09:42:24 [1168] [8] DEBUG:   len:  167
2010-02-18 09:42:24 [1168] [8] DEBUG:   size: 1024
2010-02-18 09:42:24 [1168] [8] DEBUG:   immutable: 0
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 47 45 54 20 2f 64 65 6c 69 76 65 
72 79 2d 72 65   GET /delivery-re
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 70 6f 72 74 2e 70 68 70 3f 73 65 
6e 64 5f 68 69   port.php?send_hi
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 73 74 6f 72 79 5f 69 64 3d 31 33 
38 35 33 32 31   story_id=1385321
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 38 26 61 6d 70 3b 74 6f 5f 6e 75 
6d 62 65 72 3d   8&amp;to_number=
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 33 35 33 38 37 30 36 33 32 33 34 
36 26 61 6d 70   xxxx&amp
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 3b 74 79 70 65 3d 38 20 48 54 54 
50 2f 31 2e 31   ;type=8 HTTP/1.1
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 0d 0a 48 6f 73 74 3a 20 6c 6f 63 
61 6c 68 6f 73   ..Host: localhos
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 74 0d 0a 43 6f 6e 6e 65 63 74 69 
6f 6e 3a 20 6b   t..Connection: k
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 65 65 70 2d 61 6c 69 76 65 0d 0a 
55 73 65 72 2d   eep-alive..User-
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 41 67 65 6e 74 3a 20 4b 61 6e 6e 
65 6c 2f 31 2e   Agent: Kannel/1.
2010-02-18 09:42:24 [1168] [8] DEBUG:   data: 34 2e 33 0d 0a 0d 0a              
                4.3....
2010-02-18 09:42:24 [1168] [8] DEBUG: Octet string dump ends.

Reply via email to