2011 Jan 11 12:51 AM
Does anyone know how to pass hidden form fields into an HTTP Post? Here is an example in HTML. I need to do the same thing in ABAP:
<html>
<body>
<FORM ACTION="https://www.aesdirect.gov/weblink/weblink.cgi" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="wl_app_ident" VALUE="TEST">
<INPUT TYPE="HIDDEN" NAME="wl_nologin_url" VALUE="http://www.weblinktestapp.com/nologin.html">
<INPUT TYPE="HIDDEN" NAME="wl_nosed_url" VALUE="http://www.weblinktestapp.com/nosed.html">
<INPUT TYPE="HIDDEN" NAME="wl_success_url" VALUE="http://www.weblinktestapp.com/success.html">
<input type="submit" value="Submit">
</FORM>
</body>
</html>
Here is my code so far:
L_POST_URI = '/weblink/weblink.cgi'.
POST_HOST = 'www.aesdirect.gov'.
CALL METHOD cl_http_client=>create
EXPORTING
host = POST_HOST
service = '443'
scheme = '2'
ssl_id = 'ANONYM'
proxy_host = wf_proxy
proxy_service = wf_port
IMPORTING
client = http_client.
http_client->propertytype_logon_popup = http_client->co_disabled.
wf_user = '' .
wf_password = '' .
proxy server authentication
CALL METHOD http_client->authenticate
EXPORTING
proxy_authentication = 'X'
username = wf_user
password = wf_password.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_protocol'
value = 'HTTPS/1.0'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'HOST'
value = POST_HOST.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_uri'
value = L_POST_URI.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'text/xml; charset=utf-8'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Length'
value = txlen.
*CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'SOAPAction'
value = 'https://gatewaybeta.fedex.com:443/GatewayDC'
data: lt_formfields type TIHTTPNVP.
data: ls_formfields type IHTTPNVP.
ls_formfields-name = 'wl_app_ident'.
ls_formfields-value = 'TEST'.
append ls_formfields to lt_formfields.
*ls_formfields-name = 'wl_app_name'.
*ls_formfields-value = 'TEST'.
*append ls_formfields to lt_formfields.
ls_formfields-name = 'wl_nosed_url'.
ls_formfields-value = 'http://www.weblinktestapp.com/nosed.html'.
append ls_formfields to lt_formfields.
ls_formfields-name = 'wl_success_url'.
ls_formfields-value = 'http://www.weblinktestapp.com/success.html'.
append ls_formfields to lt_formfields.
CALL METHOD http_client->request->set_form_fields
EXPORTING
FIELDS = lt_formfields.
CALL METHOD http_client->request->set_cdata
EXPORTING
data = wf_string
offset = 0
length = rlength.
CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
CLEAR wf_string1 .
wf_string1 = http_client->response->get_cdata( ).
thank you,
2011 Jan 11 2:03 PM
Hi Tony,
for an HTTP-POST it's irrelevant whether the field is hidden or not. Just pass the fields as described in your source example.
Regards, Uwe
Does anyone know how to pass hidden form fields into an HTTP Post? Here is an example in HTML. I need to do the same thing in ABAP:
<html>
<body>
<FORM ACTION="https://www.aesdirect.gov/weblink/weblink.cgi" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="wl_app_ident" VALUE="TEST">
<INPUT TYPE="HIDDEN" NAME="wl_nologin_url" VALUE="http://www.weblinktestapp.com/nologin.html">
<INPUT TYPE="HIDDEN" NAME="wl_nosed_url" VALUE="http://www.weblinktestapp.com/nosed.html">
<INPUT TYPE="HIDDEN" NAME="wl_success_url" VALUE="http://www.weblinktestapp.com/success.html">
<input type="submit" value="Submit">
</FORM>
</body>
</html>
Here is my code so far:
L_POST_URI = '/weblink/weblink.cgi'.
POST_HOST = 'www.aesdirect.gov'.
CALL METHOD cl_http_client=>create
EXPORTING
host = POST_HOST
service = '443'
scheme = '2'
ssl_id = 'ANONYM'
proxy_host = wf_proxy
proxy_service = wf_port
IMPORTING
client = http_client.
http_client->propertytype_logon_popup = http_client->co_disabled.
wf_user = '' .
wf_password = '' .
proxy server authentication
CALL METHOD http_client->authenticate
EXPORTING
proxy_authentication = 'X'
username = wf_user
password = wf_password.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_protocol'
value = 'HTTPS/1.0'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'HOST'
value = POST_HOST.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_uri'
value = L_POST_URI.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'text/xml; charset=utf-8'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Length'
value = txlen.
*CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'SOAPAction'
value = 'https://gatewaybeta.fedex.com:443/GatewayDC'
data: lt_formfields type TIHTTPNVP.
data: ls_formfields type IHTTPNVP.
ls_formfields-name = 'wl_app_ident'.
ls_formfields-value = 'TEST'.
append ls_formfields to lt_formfields.
*ls_formfields-name = 'wl_app_name'.
*ls_formfields-value = 'TEST'.
*append ls_formfields to lt_formfields.
ls_formfields-name = 'wl_nosed_url'.
ls_formfields-value = 'http://www.weblinktestapp.com/nosed.html'.
append ls_formfields to lt_formfields.
ls_formfields-name = 'wl_success_url'.
ls_formfields-value = 'http://www.weblinktestapp.com/success.html'.
append ls_formfields to lt_formfields.
CALL METHOD http_client->request->set_form_fields
EXPORTING
FIELDS = lt_formfields.
CALL METHOD http_client->request->set_cdata
EXPORTING
data = wf_string
offset = 0
length = rlength.
CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
CLEAR wf_string1 .
wf_string1 = http_client->response->get_cdata( ).
thank you,
2011 Jan 11 2:03 PM
Hi Tony,
for an HTTP-POST it's irrelevant whether the field is hidden or not. Just pass the fields as described in your source example.
Regards, Uwe
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |