Tried

request({
    url: 'http://127.0.0.1:13002/cgi-bin/sendota',
    method: 'POST',
    headers : {
        'content-type': 'text/xml',
        'X-Kannel-Username': 'foo',
        'X-Kannel-Password': 'bar',
        'X-Kannel-To': '1324422133',
        'X-Kannel-From': '12023455750'
    },
    body: xml
}, function (error, response, body) {
    console.log('error:', error); // Print the error if one occurred
    console.log('statusCode:', response && response.statusCode); // Print
the response status code if a response was received
    console.log('body:', body); // Print the HTML for the Google homepage.
});

Now I'm getting body: Unsupported content-type, rejected
but text/xml should be supported...

On Tue, Jan 23, 2018 at 2:40 PM, Kasper Nielsen <kasp.n...@gmail.com> wrote:

> Just testing if this mailinglist is active, has anyone received my
> questions?
>
> On Tue, Jan 23, 2018 at 2:01 PM, Kasper Nielsen <kasp.n...@gmail.com>
> wrote:
>
>> Seems - after a lot of Googling - that the Kannel SMS gateway actually
>> doesn't support HTTP POST for sending SMSes, which is a limit to the size
>> of SMSes being sent :(
>>
>> On Tue, Jan 23, 2018 at 1:35 PM, Kasper Nielsen <kasp.n...@gmail.com>
>> wrote:
>>
>>> Looked through the contrib-examples and all examples actually uses the
>>> HTTP GET method to send SMS, which may fail on large SMSes.
>>>
>>> On Tue, Jan 23, 2018 at 12:19 PM, Kasper Nielsen <kasp.n...@gmail.com>
>>> wrote:
>>>
>>>> ...and tried old school XML:
>>>>
>>>> var xml = ' \
>>>> <?xml version="1.0"?>\
>>>> <message>\
>>>>   <submit>\
>>>>     <da><number>11021034235</number></da>\
>>>>     <oa><number>11076034723</number></oa>\
>>>>     <ud>Hello</ud>\
>>>>     <from>\
>>>>       <user>foo</user>\
>>>>       <username>foo</username>\
>>>>       <pass>bar</pass>\
>>>>       <password>bar</password>\
>>>>     </from>\
>>>>   </submit>\
>>>> </message>\
>>>> ';
>>>>
>>>> var options = {
>>>>   method: 'POST',
>>>>   uri: 'http://127.0.0.1:13002/cgi-bin/sendsms',
>>>>   body: xml,
>>>>   headers: {'content-type': 'text/xml'}
>>>> };
>>>>
>>>>  but getting:      body: 'Authorization failed for sendsms' } }
>>>>
>>>>
>>>> On Tue, Jan 23, 2018 at 11:58 AM, Kasper Nielsen <kasp.n...@gmail.com>
>>>> wrote:
>>>>
>>>>> Also able to get:      body: 'Invalid content-type' } }
>>>>> But the content-type is correct http form:
>>>>> application/x-www-form-urlencoded.
>>>>>
>>>>> On Tue, Jan 23, 2018 at 11:57 AM, Kasper Nielsen <kasp.n...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> ...and the docs doesn't seem to tell anything about this.
>>>>>>
>>>>>> On Tue, Jan 23, 2018 at 11:36 AM, Kasper Nielsen <kasp.n...@gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> This is my NodeJS (request-promise) for sending SMS via HTTP GET:
>>>>>>>
>>>>>>> var options = {
>>>>>>>     method: 'GET',
>>>>>>>     uri: 'http://127.0.0.1:13002/cgi-bin/sendsms',
>>>>>>>     qs: {
>>>>>>>         username: 'foo',
>>>>>>>         password: 'bar',
>>>>>>>         to: '127883327304',
>>>>>>>         from: '12488331359 <(248)%20833-1359>',
>>>>>>>         text: 'Hi
>>>>>>>     }
>>>>>>> };
>>>>>>>
>>>>>>> This works, but changing to HTTP POST fails.
>>>>>>>
>>>>>>> var options = {
>>>>>>>     method: 'POST',
>>>>>>>     uri: 'http://127.0.0.1:13002/cgi-bin/sendsms',
>>>>>>>     form: {
>>>>>>>         username: 'foo',
>>>>>>>         password: 'bar',
>>>>>>>         to: '127883327304',
>>>>>>>         from: '12488331359 <(248)%20833-1359>',
>>>>>>>         text: 'Hi
>>>>>>>     }
>>>>>>> };
>>>>>>>
>>>>>>> Getting      body: 'Authorization failed for sendsms' } }
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to