cancel
Showing results for 
Search instead for 
Did you mean: 

Http Post

Former Member
0 Kudos

Dear all

I need to send data to the url http://api.myvaluefirst.com/psms in the following format

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE MESSAGE SYSTEM "http://127.0.0.1:80/psms/dtd/messagev12.dtd">

<MESSAGE VER="1.2">

<USER USERNAME="" PASSWORD=""/>

<SMS UDH="0" CODING="1" TEXT="" PROPERTY="0" ID="1">

<ADDRESS FROM="" TO="" SEQ="1" TAG="some clientside random data"/>

</SMS>

<SMS UDH="0" CODING="1" TEXT="Client API version 1.2 testing msg" PROPERTY="0" ID="2">

<ADDRESS FROM="" TO="" SEQ="1" TAG="" />

</SMS>

</MESSAGE>

and the operation is "send"

Is this HTTp post?

If i use Http Receiver, what should be written in epilog and prolog?

Regards

Monika

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE MESSAGE SYSTEM "http://127.0.0.1:80/psms/dtd/messagev12.dtd">

<MESSAGE VER="1.2">

<USER USERNAME="" PASSWORD=""/>

<SMS UDH="0" CODING="1" TEXT="" PROPERTY="0" ID="1">

<ADDRESS FROM="" TO="" SEQ="1" TAG="some clientside random data"/>

</SMS>

<SMS UDH="0" CODING="1" TEXT="Client API version 1.2 testing msg" PROPERTY="0" ID="2">

<ADDRESS FROM="" TO="" SEQ="1" TAG="" />

</SMS>

</MESSAGE>

Here is the raw type of that request (from Fiddler)

POST http://api.myvaluefirst.com/psms/servlet/psms.Eservice2 HTTP/1.1

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, /

Referer: http://api.myvaluefirst.com/psms

Accept-Language: en-us

Content-Type: application/x-www-form-urlencoded

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; CMNTDF)

Connection: Keep-Alive

Content-Length: 726

Host: api.myvaluefirst.com

Pragma: no-cache

Cookie: JSESSIONID=417DB5A3199F96BEFFA1C34E81741642

data=%3C%3Fxmlversion%3D%221.0%22encoding%3D%22ISO-8859-1%22%3F%3E%0D%0A%3C%21DOCTYPEMESSAGESYSTEM%22http%3A%2F%2F127.0.0.1%3A80%2Fpsms%2Fdtd%2Fmessagev12.dtd%22%3E%0D%0A%3CMESSAGEVER%3D%221.2%22%3E%0D%0A%3CUSERUSERNAME%3D%22%22PASSWORD%3D%22%22%2F%3E%0D%0A%3CSMS+UDH%3D%220%22CODING%3D%221%22TEXT%3D%22%22PROPERTY%3D%220%22ID%3D%221%22%3E%0D%0A%3CADDRESSFROM%3D%22%22TO%3D%22%22SEQ%3D%221%22TAG%3D%22someclientsiderandomdata%22%2F%3E%0D%0A%3C%2FSMS%3E%0D%0A%3CSMSUDH%3D%220%22CODING%3D%221%22TEXT%3D%22ClientAPIversion1.2testingmsg%22PROPERTY%3D%220%22ID%3D%222%22%3E%0D%0A%3CADDRESSFROM%3D%22%22TO%3D%22%22SEQ%3D%221%22TAG%3D%22%22+%2F%3E%0D%0A%3C%2FSMS%3E%0D%0A%3C%2FMESSAGE%3E&action=send

Is this HTTp post?

If i use Http Receiver, what should be written in epilog and prolog?

Based on what is pasted from Fiddler, yes it is an HTTP POST request. If you use Plain HTTP Receiver, the prolog is data= and epilog is &action=send

Hope this helps,

Mark

Former Member
0 Kudos

Thanks Mark for your response..

How about the payload? The data that needs to be passed to the url should be contained in it? Also how do i build the data type on the receiver side for such a request?

Regards

Monika

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

How about the payload? The data that needs to be passed to the url should be contained in it? Also how do i build the data type on the receiver side for such a request?

The payload in the HTTP Body is

data=%3C%3Fxmlversion%3D%221.0%22encoding%3D%22ISO-8859-1%22%3F%3E%0D%0A%3C%21DOCTYPEMESSAGESYSTEM%22http%3A%2F%2F127.0.0.1%3A80%2Fpsms%2Fdtd%2Fmessagev12.dtd%22%3E%0D%0A%3CMESSAGEVER%3D%221.2%22%3E%0D%0A%3CUSERUSERNAME%3D%22%22PASSWORD%3D%22%22%2F%3E%0D%0A%3CSMS+UDH%3D%220%22CODING%3D%221%22TEXT%3D%22%22PROPERTY%3D%220%22ID%3D%221%22%3E%0D%0A%3CADDRESSFROM%3D%22%22TO%3D%22%22SEQ%3D%221%22TAG%3D%22someclientsiderandomdata%22%2F%3E%0D%0A%3C%2FSMS%3E%0D%0A%3CSMSUDH%3D%220%22CODING%3D%221%22TEXT%3D%22ClientAPIversion1.2testingmsg%22PROPERTY%3D%220%22ID%3D%222%22%3E%0D%0A%3CADDRESSFROM%3D%22%22TO%3D%22%22SEQ%3D%221%22TAG%3D%22%22+%2F%3E%0D%0A%3C%2FSMS%3E%0D%0A%3C%2FMESSAGE%3E&action=send

Based on that you have two approaches

1.) Use Plain HTTP Receiver, enter the prolog and epilog in the receiver CC and then try sending the XML as is. Though I'm not sure if adding the prolog/epilog will automatically escape the XML characters. If it is not automatically escaped, you need to use java mapping to build the request.

2.) Use SOAP Receiver Adapter (Check Do Not Use SOAP Envelope), and use Java mapping to build the output as is. Then you need to use messageTransformBean to change the content type from application/xml to application/x-www-form-urlencoded

The data that needs to be passed to the url should be contained in it?

No, the data is placed in the HTTP Body and not in the URL. Remember that we can have only up to 200 character limit for URLs when using dynamic config and that the HTTP Adapter needs an HTTP Body for it to work.

Hope this helps,

Mark

Former Member
0 Kudos

Dear Mark

I have configured the Http CC as follwos:

Content Type :text/xml

Prolog: data=

Epilog: &action=send

Mask Special Characters(URL Escaping) is unchecked.

Currentllt i am sending the xml from RWB and My scenario is successful. But i am not able to check where to see whether is url is corectly formed or not.

Also how to build the data type for this?

Regards

Monika

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Currentllt i am sending the xml from RWB and My scenario is successful. But i am not able to check where to see whether is url is corectly formed or not.

The URL will still be http://api.myvaluefirst.com/psms/servlet/psms.Eservice2 so no worries about that.

Also how to build the data type for this?

There is already a datatype provided, this is a DTD or document type definition. For this you need to ask them to provide you the dtd and import it into ESR no need to build it


<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE MESSAGE SYSTEM "http://127.0.0.1:80/psms/dtd/messagev12.dtd">
<MESSAGE VER="1.2">
<USER USERNAME="" PASSWORD=""/>
<SMS UDH="0" CODING="1" TEXT="" PROPERTY="0" ID="1">
<ADDRESS FROM="" TO="" SEQ="1" TAG="some clientside random data"/>
</SMS>
<SMS UDH="0" CODING="1" TEXT="Client API version 1.2 testing msg" PROPERTY="0" ID="2">
<ADDRESS FROM="" TO="" SEQ="1" TAG="" />
</SMS>
</MESSAGE>

Hope this helps,

Mark

Edited by: Mark Dihiansan on Mar 2, 2012 10:54 AM

Former Member
0 Kudos

Thanks Mark again for your response.

Actually they havent provided dtd/xsd. I would try building it myself.

Sharing with you some details

Target host: api.myvaluefirst.com

Service number: 80

Path: /psms/servlet/psms.Eservice2

Unfortunately message is usccessful in moni but we dont get the results. That is when we execute it in browser we get an sms om mobile. We dont via PI.

How to view the url that has been send by PI?

Regards

Monika

Former Member
0 Kudos

Dear Mark

I was able to send data from RWB. Took the same input available on their url as xml and sent.

I made change in the content from text/xml to application/x-www-form-urlencoded.

It works with/without Mask special Characters (url escaping)

The dtd is not correct. I have tried importing into ESR. It did not work. Any pointers on this? I even used xml spy to change it.

It is referring to 127.0.0.1. Thats the problem.

Regards

Monika

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

The URL is http://api.myvaluefirst.com/psms, but the namespace referred to in the dtd is http://127.0.0.1:80/psms/dtd/messagev12.dtd. Therefore the dtd is located in this URL http://api.myvaluefirst.com/psms/dtd/messagev12.dtd

Once you load that ED in PI, choose DTD as the category and then Message: From First Element.

Hope this helps,

Mark

Former Member
0 Kudos

Dear Mark

Thanks for your response again.

http://127.0.0.1:80/psms/dtd/messagev12.dtd is unaccessible, however http://api.myvaluefirst.com/psms/dtd/messagev12.dtd

had the dtd, how do you make out that this is the location?

Regards

Monika

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

http://127.0.0.1:80/psms/dtd/messagev12.dtd is unaccessible, however http://api.myvaluefirst.com/psms/dtd/messagev12.dtd

had the dtd, how do you make out that this is the location?

127.0.0.1 is used for localhosts, so I just replaced it with the host api.myvaluefirst.com. Probably for security reasons, they used 127.0.0.1 in the DTD instead of http://api.myvaluefirst.com/psms/dtd/messagev12.dtd. Messages like this always have a repository.

Hope this helps,

Mark

Former Member
0 Kudos

Thanks a lot Mark for your support.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Monika,

Can you try with Java mapping?

This links may help

which version you are in ?

Thanks

Ray..

baskar_gopalakrishnan2
Active Contributor
0 Kudos

What PI version do you use. PI by default does only HTTP Post. PI versions below 7.3 does only Post. I believe only 7.3 has option to do both POST and GET.