You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@esme.apache.org by Richard Hirsch <hi...@gmail.com> on 2009/11/30 11:31:19 UTC

Action question regarding Content-Type header

Right now, it is possible to use HTTP Post as an action in an action
(http://cwiki.apache.org/confluence/display/ESME/Actions)

I'm attempting to integrate an application ( which shall remain
anonymous :->) which requires that XML is sent in the POST data.
Right now, we also sending "application/x-www-form-urlencoded" as the
Content-Type header . I need "'text/xml' in this header.

Any suggestions / ideas?

D.

Re: Action question regarding Content-Type header

Posted by Richard Hirsch <hi...@gmail.com>.
Now the 12sprints beta has announced, I can say that this integration
is for 12sprints
(http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/16898). There is
a rather detailed REST API that is available. There are are also great
examples in java for using the REST API. It should be very easy to
create a bot that reads ESME messages and performs the corresponding
12sprints action.

I am attempting to first use an ESME action to create an 12sprints activity.

D.

On Mon, Nov 30, 2009 at 10:13 PM, Vassil Dichev <vd...@apache.org> wrote:
> Did you try:
>
> http://localhost:1234
> header:Content-Type=text%2fxml
> <text>%s</text>
>
> It could be tricky what to decode and what not.
>
>
> On Mon, Nov 30, 2009 at 8:06 PM, Vassil Dichev <vd...@apache.org> wrote:
>> Right, the value of the header had to be escaped. I will try to check
>> it out tonight.
>>
>> I am surprised I haven't documented this, I will correct this.
>>
>>
>> On Mon, Nov 30, 2009 at 3:31 PM, Richard Hirsch <hi...@gmail.com> wrote:
>>> I tried to set the header without encoding it and then we get a parsing error.
>>>
>>> header: Content-Type=text/xml
>>>
>>> D.
>>>
>>> On Mon, Nov 30, 2009 at 1:34 PM, Richard Hirsch <hi...@gmail.com> wrote:
>>>> Of course, you have URLEncode everything and then it doesn't work:
>>>>
>>>> https://beta.com/v1
>>>> header%3A%20Content-Type%3Dtext%2Fxml
>>>> %3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3C%20name%3D%22New%20using%20cURL%22%3E%3C%2F%3E
>>>>
>>>> D.
>>>>
>>>> On Mon, Nov 30, 2009 at 12:59 PM, Vassil Dichev <vd...@apache.org> wrote:
>>>>>> Tried and it didn't work.
>>>>>>
>>>>>> How exactly would the action look like? Like this?
>>>>>>
>>>>>> https://beta.xxx.com
>>>>>> Content-Type header: text/xml
>>>>>> test Message
>>>>>
>>>>> Actually I just checked the source and it should be
>>>>>
>>>>> https://beta.xxx.com
>>>>> header: Content-Type=text/xml
>>>>> test Message
>>>>>
>>>>
>>>
>>
>

Re: Action question regarding Content-Type header

Posted by Vassil Dichev <vd...@apache.org>.
Did you try:

http://localhost:1234
header:Content-Type=text%2fxml
<text>%s</text>

It could be tricky what to decode and what not.


On Mon, Nov 30, 2009 at 8:06 PM, Vassil Dichev <vd...@apache.org> wrote:
> Right, the value of the header had to be escaped. I will try to check
> it out tonight.
>
> I am surprised I haven't documented this, I will correct this.
>
>
> On Mon, Nov 30, 2009 at 3:31 PM, Richard Hirsch <hi...@gmail.com> wrote:
>> I tried to set the header without encoding it and then we get a parsing error.
>>
>> header: Content-Type=text/xml
>>
>> D.
>>
>> On Mon, Nov 30, 2009 at 1:34 PM, Richard Hirsch <hi...@gmail.com> wrote:
>>> Of course, you have URLEncode everything and then it doesn't work:
>>>
>>> https://beta.com/v1
>>> header%3A%20Content-Type%3Dtext%2Fxml
>>> %3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3C%20name%3D%22New%20using%20cURL%22%3E%3C%2F%3E
>>>
>>> D.
>>>
>>> On Mon, Nov 30, 2009 at 12:59 PM, Vassil Dichev <vd...@apache.org> wrote:
>>>>> Tried and it didn't work.
>>>>>
>>>>> How exactly would the action look like? Like this?
>>>>>
>>>>> https://beta.xxx.com
>>>>> Content-Type header: text/xml
>>>>> test Message
>>>>
>>>> Actually I just checked the source and it should be
>>>>
>>>> https://beta.xxx.com
>>>> header: Content-Type=text/xml
>>>> test Message
>>>>
>>>
>>
>

Re: Action question regarding Content-Type header

Posted by Vassil Dichev <vd...@apache.org>.
Right, the value of the header had to be escaped. I will try to check
it out tonight.

I am surprised I haven't documented this, I will correct this.


On Mon, Nov 30, 2009 at 3:31 PM, Richard Hirsch <hi...@gmail.com> wrote:
> I tried to set the header without encoding it and then we get a parsing error.
>
> header: Content-Type=text/xml
>
> D.
>
> On Mon, Nov 30, 2009 at 1:34 PM, Richard Hirsch <hi...@gmail.com> wrote:
>> Of course, you have URLEncode everything and then it doesn't work:
>>
>> https://beta.com/v1
>> header%3A%20Content-Type%3Dtext%2Fxml
>> %3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3C%20name%3D%22New%20using%20cURL%22%3E%3C%2F%3E
>>
>> D.
>>
>> On Mon, Nov 30, 2009 at 12:59 PM, Vassil Dichev <vd...@apache.org> wrote:
>>>> Tried and it didn't work.
>>>>
>>>> How exactly would the action look like? Like this?
>>>>
>>>> https://beta.xxx.com
>>>> Content-Type header: text/xml
>>>> test Message
>>>
>>> Actually I just checked the source and it should be
>>>
>>> https://beta.xxx.com
>>> header: Content-Type=text/xml
>>> test Message
>>>
>>
>

Re: Action question regarding Content-Type header

Posted by Richard Hirsch <hi...@gmail.com>.
I tried to set the header without encoding it and then we get a parsing error.

header: Content-Type=text/xml

D.

On Mon, Nov 30, 2009 at 1:34 PM, Richard Hirsch <hi...@gmail.com> wrote:
> Of course, you have URLEncode everything and then it doesn't work:
>
> https://beta.com/v1
> header%3A%20Content-Type%3Dtext%2Fxml
> %3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3C%20name%3D%22New%20using%20cURL%22%3E%3C%2F%3E
>
> D.
>
> On Mon, Nov 30, 2009 at 12:59 PM, Vassil Dichev <vd...@apache.org> wrote:
>>> Tried and it didn't work.
>>>
>>> How exactly would the action look like? Like this?
>>>
>>> https://beta.xxx.com
>>> Content-Type header: text/xml
>>> test Message
>>
>> Actually I just checked the source and it should be
>>
>> https://beta.xxx.com
>> header: Content-Type=text/xml
>> test Message
>>
>

Re: Action question regarding Content-Type header

Posted by Richard Hirsch <hi...@gmail.com>.
Of course, you have URLEncode everything and then it doesn't work:

https://beta.com/v1
header%3A%20Content-Type%3Dtext%2Fxml
%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3C%20name%3D%22New%20using%20cURL%22%3E%3C%2F%3E

D.

On Mon, Nov 30, 2009 at 12:59 PM, Vassil Dichev <vd...@apache.org> wrote:
>> Tried and it didn't work.
>>
>> How exactly would the action look like? Like this?
>>
>> https://beta.xxx.com
>> Content-Type header: text/xml
>> test Message
>
> Actually I just checked the source and it should be
>
> https://beta.xxx.com
> header: Content-Type=text/xml
> test Message
>

Re: Action question regarding Content-Type header

Posted by Vassil Dichev <vd...@apache.org>.
> Tried and it didn't work.
>
> How exactly would the action look like? Like this?
>
> https://beta.xxx.com
> Content-Type header: text/xml
> test Message

Actually I just checked the source and it should be

https://beta.xxx.com
header: Content-Type=text/xml
test Message

Re: Action question regarding Content-Type header

Posted by Richard Hirsch <hi...@gmail.com>.
Tried and it didn't work.

How exactly would the action look like? Like this?

https://beta.xxx.com
Content-Type header: text/xml
test Message



On Mon, Nov 30, 2009 at 12:21 PM, Vassil Dichev <vd...@apache.org> wrote:
>> Just checked and found that the class that sends the post is in
>> HttpSender.scala.   The content type is hard-coded at the current
>> time.
>>
>>      def getContentType() = "application/x-www-form-urlencoded"
>>
>> My suggestion would be to somehow pass the content type as part of the
>> action. Maybe as an extra parameter in the URL that gets removed
>> afterword
>
> Hm, that's getting too complicated. Why don't you try to specify a
> Content-Type: http header and see if it overwrites the original one?
>

Re: Action question regarding Content-Type header

Posted by Vassil Dichev <vd...@apache.org>.
> Just checked and found that the class that sends the post is in
> HttpSender.scala.   The content type is hard-coded at the current
> time.
>
>      def getContentType() = "application/x-www-form-urlencoded"
>
> My suggestion would be to somehow pass the content type as part of the
> action. Maybe as an extra parameter in the URL that gets removed
> afterword

Hm, that's getting too complicated. Why don't you try to specify a
Content-Type: http header and see if it overwrites the original one?

Re: Action question regarding Content-Type header

Posted by Richard Hirsch <hi...@gmail.com>.
Just checked and found that the class that sends the post is in
HttpSender.scala.   The content type is hard-coded at the current
time.

      def getContentType() = "application/x-www-form-urlencoded"

My suggestion would be to somehow pass the content type as part of the
action. Maybe as an extra parameter in the URL that gets removed
afterword

Ideas?

D.


On Mon, Nov 30, 2009 at 11:31 AM, Richard Hirsch <hi...@gmail.com> wrote:
> Right now, it is possible to use HTTP Post as an action in an action
> (http://cwiki.apache.org/confluence/display/ESME/Actions)
>
> I'm attempting to integrate an application ( which shall remain
> anonymous :->) which requires that XML is sent in the POST data.
> Right now, we also sending "application/x-www-form-urlencoded" as the
> Content-Type header . I need "'text/xml' in this header.
>
> Any suggestions / ideas?
>
> D.
>