Hi German,

Now I am using X kannel Headers properly thanks to you.
I have a doubt that do we need to URL encode whole text message with this
approach or not.
Because I tried sending SMS without URL encoding text and it worked
perfectly. So is this any disadvantage of not encoding the text or we don't
need to do it as per kannel document we should URL encode whole text.Can
you suggest me what is the right approach of doing it.

Thanks
Kirti

On Fri, Oct 9, 2015 at 3:06 PM, Kirti Mandwade <kirti.mandw...@gmail.com>
wrote:

> Hi German
>
> Thankyou so much for your response. It worked and solved my problem.
>
> Regards
> Kirti
>
> On Thu, Oct 8, 2015 at 11:52 PM, Germán Bobr <
> german.b...@redmondsoftware.com> wrote:
>
>> Hi Kirti,
>> I believe X-Kannel-Headers are meant to be set in response to a
>> SMS-Service Post.
>> For sms push (sendsms cgi) you should use cgi variables (see
>> http://kannel.org/download/1.5.0/userguide-1.5.0/userguide.html#AEN4660)
>>
>> In any case, i think that is not the proper way to set HTTP headers for a
>> request. See:
>> http://stackoverflow.com/questions/13512188/setting-headers-in-post-request-with-java
>>
>> I am copying kannel users mailing list
>>
>> Regards,
>> Germán
>>
>>
>> 2015-10-08 7:29 GMT-03:00 Kirti Mandwade <kirti.mandw...@gmail.com>:
>>
>>> Hi German,
>>>
>>> Can you help me in how to use X-Kannel Header.
>>> Here is what i tried
>>>
>>> String url = "http://u.v.w.x:13003/cgi-bin/sendsms";;
>>>
>>>   CloseableHttpClient httpClient = HttpClients.createDefault();
>>>   HttpPost httpPost = new HttpPost(url);
>>>   httpPost.setHeader("content-type", "text/plain");
>>>   CloseableHttpResponse response = null;
>>>   StringEntity entity = null;
>>>   List <NameValuePair> headers = new ArrayList <NameValuePair>();
>>>   headers.add(new BasicNameValuePair("X-Kannel-Username", "abc"));
>>>   headers.add(new BasicNameValuePair("X-Kannel-Password", "123"));
>>>   headers.add(new BasicNameValuePair("X-Kannel-From", "abc123abc"));
>>>   headers.add(new BasicNameValuePair("X-Kannel-To", "278132300004"));
>>>   headers.add(new BasicNameValuePair("X-Kannel-SMSC", "send"));
>>>
>>>     entity = new StringEntity("hello", ContentType.create(
>>>             "text/plain"));
>>>
>>>
>>> httpPost.setEntity(new UrlEncodedFormEntity(headers));
>>> httpPost.setEntity(entity);
>>>
>>>
>>>
>>>        response = httpClient.execute(httpPost);
>>>                  System.out.println(response.getStatusLine());
>>>
>>>        EntityUtils.consume(entity);
>>>
>>>
>>>
>>> I have set accept-x-kannel headers to true in sms-service group of
>>> kannel configuration
>>>
>>> group = sms-service
>>> accept-x-kannel-headers = true
>>>
>>>
>>> Sending SMS using POST method with XML is working perfectly.
>>> Can you tell me what i am doing wrong here.
>>>
>>>
>>> Regards
>>> Kirti
>>>
>>>
>>>
>>>
>>
>>
>> --
>>
>>
>> *Germán Bobr *german.b...@redmondsoftware.com
>> [image: Description: redmond]
>>
>
>

Reply via email to