# How to sent application/xml request body in a http\_poller endpoint

**URL:** <https://discuss.elastic.co/t/how-to-sent-application-xml-request-body-in-a-http-poller-endpoint/143824>\
**Category:** Logstash\
**Created:** [August 10, 2018, 8:01am UTC](https://discuss.elastic.co/t/how-to-sent-application-xml-request-body-in-a-http-poller-endpoint/143824 "2018-08-10T08:01:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jishnu\_Prathap](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@Jishnu\_Prathap](https://discuss.elastic.co/u/Jishnu_Prathap)\
**Post date:** [August 10, 2018, 8:01am UTC](https://discuss.elastic.co/t/how-to-sent-application-xml-request-body-in-a-http-poller-endpoint/143824/1 "2018-08-10T08:01:36Z")

</div>

I am having difficulties setting XML in request body to a http\_poller endpoint. When I set the request body in http\_poller endpoint is showing error

My conf file

```
    input {
  http_poller {
	schedule => { cron => "* * * * * UTC"}
    # List of urls to hit
    # URLs can either have a simple format for a get request
    # Or use more complex HTTP features
    urls => {
      some_other_service => {
        method => "post"
        url => "I have removed the url due to securuty purposes"            
        headers => {
          Accept => "application/xml"
        }   
	body => {
	'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ReqListLocation><User><Login>username111</Login><Password>password!</Password></User><Location><Disabled>1</Disabled><Type>P</Type></Location></ReqListLocation>'
        }   
      }
    }
    # Maximum amount of time to wait for a request to complete
    request_timeout => 30
    # How far apart requests should be
    #interval => 60
    # Decode the results as xml
    codec => "xml"
    # Store metadata about the request in this key
    metadata_target => "http_poller_metadata"
  }
    }
    output {
      stdout {
        codec => rubydebug
      }
    }

```

Error stack trace

`[ERROR] 2018-08-10 08:10:36.703 [Converge PipelineAction::Create<main>] agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 16, column 9 (byte 713) after input {\n http_poller {\n\tschedule => { cron => \"* * * * * UTC\"}\n # List of urls to hit\n # URLs can either have a simple format for a get request\n # Or use more complex HTTP features\n urls => {\n some_other_service => {\n method => \"post\"\n url => \"url to post\" \n headers => {\n Accept => \"application/xml\"\n } \n\tbody => {\n '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ReqListLocation><User><Login>username111</Login><Password>password</Password></User><Location><Disabled>1</Disabled><Type>P</Type></Location></ReqListLocation>'\n ", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:42:in`compile\_imperative'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:50:in `compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:12:in`block in compile\_sources'", "org/jruby/RubyArray.java:2486:in `map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:11:in`compile\_sources'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:49:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:167:in`initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline\_action/create.rb:40:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:305:in`block in converge\_state'"]}`

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 10, 2018, 8:56am UTC](https://discuss.elastic.co/t/how-to-sent-application-xml-request-body-in-a-http-poller-endpoint/143824/2 "2018-08-10T08:56:10Z")

</div>

```
body => "..."

```

not

```
body => { "..." }

```

Though I can't see any documentation of the `body` option.

---

<div class="post-metadata">

**Author:** ![Jishnu\_Prathap](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@Jishnu\_Prathap](https://discuss.elastic.co/u/Jishnu_Prathap)\
**Post date:** [August 10, 2018, 5:37pm UTC](https://discuss.elastic.co/t/how-to-sent-application-xml-request-body-in-a-http-poller-endpoint/143824/3 "2018-08-10T17:37:21Z")

</div>

Thanks @magnusbaeck Its working now!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 7, 2018, 5:37pm UTC](https://discuss.elastic.co/t/how-to-sent-application-xml-request-body-in-a-http-poller-endpoint/143824/4 "2018-09-07T17:37:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
