on 04-11-2006 1:30 PM
Hi,
I having some technical issues while trying to post a SQL query to an MS SQL database through HTTP.
when I pass the query it self or the XML formated query in the URL it works fine. but as there as some size limitation I would like to post my query.
but the SQL ISAPI doesn't find it .
here is the error I'm getting back from the web server.
<H3>ERROR: 400.100 Bad Request</H3>
<b>HResult:</b> 0x80004005<br><b>Source:</b> Microsoft SQL isapi extension<br>
<b>Description:</b> Query not specified<br>
here is the XML i'm trying to send :
<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql' > <sql:query> SELECT * FROM OF_PROJ FOR XML RAW </sql:query> </ROOT>
it works this way :
http://web server/directory?template=<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql' > <sql:query> SELECT * FROM OF_PROJ FOR XML RAW </sql:query> </ROOT>
the problem is the size limitation.
so I'm trying to post the XML. I activated the POST in the SQL database.
here is part of the coding :
"
data : xmlbody type string,
XMLSTRING type string,
rlength type i.
concatenate
'<ROOT xmlns:sql=''urn:schemas-microsoft-com:xml-sql'' > '
'<sql:query> '
'SELECT * '
'FROM OF_PROJ '
'FOR XML RAW'
'</sql:query>'
'</ROOT> '
into xmlbody separated by space.
cl_http_client=>create_by_url( EXPORTING url = 'http://web server/dir"
IMPORTING client = http_client ).
rlength = strlen( xmlbody ).
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 = '~request_method'
VALUE = 'POST'.
CALL METHOD HTTP_CLIENT->REQUEST->SET_CDATA
EXPORTING
DATA = xmlbody
OFFSET = 0
LENGTH = RLENGTH.
HTTP_CLIENT->SEND( ).
HTTP_CLIENT->RECEIVE( ).
HTTP_CLIENT->RESPONSE->GET_STATUS( IMPORTING CODE = RLENGTH ).
XMLSTRING = HTTP_CLIENT->RESPONSE->GET_CDATA( ).
HTTP_CLIENT->CLOSE( ).
write 😕 xmlbody.
write 😕 xmlstring.
"
any help would be appreciated.
regards,
Abdellatif
Welcome to SDN
replace the following code
CALL METHOD HTTP_CLIENT->REQUEST->SET_CDATA
EXPORTING
DATA = xmlbody
OFFSET = 0
LENGTH = RLENGTH.
with
call method HTTP_CLIENT->request->set_form_field
exporting
name = 'template'
value = xmlbody .
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.