HTTP adapter request and response for a Get action
The HTTP adapter can retrieve data from a specified URL by using a Get action. You must enter the Get action in the Action field of the Properties tab for the Call Adapter activity.
When you use a context item as an input for an adapter request, you must enclose the adapter request in <request-data> elements. However, when you create a static request, <request-data> is not required and the adapter request starts with the <adapterName-adapter-request> element.
BMC recommends that you do not include empty elements in the adapter request because they might cause errors.
The following table describes the adapter request elements for the HTTP adapter with a Get action:
Elements for an HTTP adapter request with a Get action
The following figure shows an XML template for the HTTP adapter request with a get action.
XML template of the HTTP adapter request with a get action
<httpAdapterRequest>
<action></action>
<data-format></data-format>
<character-set></character-set>
<http-connection-properties>
<user-name>test</user-name>
<password>this</password>
</http-connection-properties>
</httpAdapterRequest>
The following figure shows an XML sample for the HTTP adapter request with NTLM authentication. NTLM authentication is an application protocol used in various Microsoft network protocol implementations and is used throughout Microsoft systems as an integrated single sign-on mechanism.
XML sample of the HTTP adapter request with NTLM authentication
<httpAdapterRequest>
<action>http://someHost/_vti_bin/UserGroup.asmx</action>
<use-ssl-certificate></use-ssl-certificate>
<install-certificate></install-certificate>
<allow-unsigned-certificate></allow-unsigned-certificate>
<passphrase></passphrase>
<data-format>XHTML</data-format>
<character-set>shift_jis</character-set>
<http-connection-properties>
<user-name>USERDOMAIN\user123</user-name>
<password>password</password>
<ntlm-authentication>true</ntlm-authentication>
<Content-Type>text/html</Content-Type>
</http-connection-properties>
</httpAdapterRequest>
The following figure shows an XML sample for the HTTP adapter request when the adapter supports mutual authentication.
XML sample of the HTTP adapter request when the adapter supports mutual authentication
<httpAdapterRequest>
<use-ssl-certificate>true</use-ssl-certificate>
<install-certificate>true</install-certificate>
<signature-properties>
<keystore-file>server.jks</keystore-file>
<keystore-password>changeit</keystore-password>
<alias>1</alias>
</signature-properties>
<action>https://10.128.249.45:8087/</action>
</httpAdapterRequest>
The following figure shows an XML sample for the HTTP adapter request with JSON data support.
XML sample of the HTTP adapter request with JSON data support
<httpAdapterRequest>
<use-ssl-certificate>false</use-ssl-certificate>
<install-certificate>true</install-certificate>
<allow-unsigned-certificate>true</allow-unsigned-certificate>
<enable-json-conversion>true</enable-json-conversion>
<data-format>xml</data-format>
<strip-namespace-from-response>true</strip-namespace-from-response>
<action>http://10.128.249.29:8089/</action>
</httpAdapterRequest>
The following figure shows an XML sample for the HTTP adapter request when <enable-redirects> is set to true.
XML sample for the HTTP adapter request when <enable-redirects> is set to true
<http-adapter-request>
<action>http://www.gmail.com</action>
<use-ssl-certificate>false</use-ssl-certificate>
<allow-unsigned-certificate>false</allow-unsigned-certificate>
<data-format>html</data-format>
</http-adapter-request>
The following figure shows an XML sample for the HTTP adapter request when <enable-redirects> is set to false.
XML sample for the HTTP adapter request when <enable-redirects> is set to false
<http-adapter-request>
<http-connection-properties />
<action>http://mail.google.com/mail/</action>
<use-ssl-certificate>false</use-ssl-certificate>
<install-certificate>false</install-certificate>
<allow-unsigned-certificate>false</allow-unsigned-certificate>
<passphrase>changeit</passphrase>
<data-format>html</data-format>
<enable-redirects>false</enable-redirects>
</http-adapter-request>
The following figure shows an XML sample for the HTTP adapter request when the adapter supports downloading a file.
XML sample of the HTTP adapter request when the adapter supports downloading a file
<httpAdapterRequest>
<download-attachment>true</download-attachment>
<download-directory>c:\test</download-directory>
<action>http://www.samplesite.com/sample.pdf</action>
</httpAdapterRequest>
The HTTP adapter generates a response to the HTTP request (URL) defined in the adapter request.
The following table describes the elements of the response to an HTTP adapter request with a Get action, when <data-format> is HTML for any <Content-Type> of HTTP server response:
Elements of an HTTP adapter response to a request with a Get action when <data-format> is HTML for any <Content-Type> of HTTP response
The following figure shows an XML sample for HTTP adapter response with a Get action, when <data-format> is HTML for any Content-Type of HTTP server response.
XML sample of the HTTP adapter response to a request with a Get action when <data-format> is HTML for any <Content-Type>
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line> <!-- status of http response -->
<code>10000</code>
<reason></reason>
</status-line>
<header-lines> <!-- header of the http response -->
<[field-name]></[field-name]>
...
</header-lines>
<message-body> <!-- message body of the http response in HTML/XHTML/XML...>
</message-body>
</httpAdapterResponse>
The following table describes the elements of an HTTP adapter response:
Elements of an HTTP adapter response to a request with a Get action when <data-format> is XHTML or XML and <Content-Type> is a well-formed text, HTML, or XML
The following figure shows an XML sample for the HTTP adapter response to an HTTP adapter request with a Get action when:
- <data-format> is XHTML or XML, <Content-Type> of the HTTP server response is TEXT or HTML, and the HTTP server response is a well-formed XHTML or XML after syntax correction (cleaning of malformed or faulty HTML using the JTidy tool)
- <data-format> is XHTML or XML, <Content-Type> of the HTTP server response is TEXT or HTML/XML, and the HTTP server response is well-formed XHTML or XML
XML sample of the HTTP adapter response to an HTTP adapter request with a Get action when <data-format> is XHTML or XML and <Content-Type> of HTTP response is a well-formed text, HTML, or XML
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>OK</reason>
</status-line>
<header-lines>
<[field-name]></[field-name]>
</header-lines>
<message-body>
<!-- message body of the http response in well formed XML/HTML -->
</message-body>
</httpAdapterResponse>
The following figure describes the elements of an HTTP adapter response to a request with a Get action, when:
- <data-format> is XHTML or XML, <Content-Type> of the HTTP server response is TEXT or HTML, and the HTTP server response is not well-formed XHTML or XML after syntax correction (cleaning of malformed or faulty HTML using the JTidy tool)
- <data-format> is XHTML or XML, <Content-Type> of the HTTP server response is TEXT or HTML/XML, and the HTTP server response is not well-formed XHTML or XML
XML sample of an HTTP adapter response to a request with a Get action when <data-format> is XHTML or XML and <Content-Type> of the HTTP response is not a well-formed text, HTML, or XML
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>OK</reason>
</status-line>
<header-lines>
<[field-name]></[field-name]>
...
</header-lines>
<message-body>
<non-xml-data-response>
<!-- message body of the http response in not well formed XML/HTML -->
</non-xml-data-response>
</message-body>
</httpAdapterResponse>
The following figure shows an XML sample of the HTTP adapter response that contains a JSON string in <message-body> of an HTML response before parsing.
XML sample of the HTTP adapter response with a JSON string in <message-body> before parsing
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>OK</reason>
</status-line>
<header-lines>
<Transfer-encoding>chunked</Transfer-encoding>
<Content-type>text/html</Content-type>
</header-lines>
<message-body>
<html lang="en-US">
<head>
<title>BBDA API</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
{"job-approval":{"result":"approve","detail":"dsd"}}
<h1>Accepted request</h1>
</body>
</html>
</message-body>
</httpAdapterResponse>
The following figure shows an XML sample of the HTTP adapter response that contains a JSON string in <message-body> of an HTML response after parsing.
XML sample of the HTTP adapter response with a JSON string in <message-body> after parsing
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>OK</reason>
</status-line>
<header-lines>
<Transfer-encoding>chunked</Transfer-encoding>
<Content-type>text/html</Content-type>
</header-lines>
<message-body>
<html lang="en-US">
<head>
<title>BBDA API</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<job-approval>
<detail>dsd</detail>
<result>approve</result>
</job-approval>
<h1>Accepted request</h1>
</body>
</html>
</message-body>
</httpAdapterResponse>
The following figure shows an XML sample of the HTTP adapter response when <enable-redirects> is set to true.
XML sample of the HTTP adapter response when <enable-redirects> is set to true
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>OK</reason>
</status-line>
<header-lines>
<Content-Type>text/html; charset=UTF-8</Content-Type>
<Set-Cookie>GAPS=1:sVXtSO34KWlupqAGylx_5b-LBzMeGA:8yrRmbqgnSV0wRXV;Path=/accounts;Expires=Wed, 24-Jul-2013 10:52:44 GMT;Secure;HttpOnly</Set-Cookie>
<Set-Cookie>GALX=446w2a9s9bI;Path=/accounts;Secure</Set-Cookie>
<Cache-control>no-cache, no-store</Cache-control>
<Pragma>no-cache</Pragma>
<Expires>Mon, 01-Jan-1990 00:00:00 GMT</Expires>
<X-Frame-Options>Deny</X-Frame-Options>
<X-Auto-Login>realm=com.google&args=service%3Dmail%26continue%3Dhttp%253A%252F%252Fmail.google.com%252Fmail%252F%253Fui%253Dhtml%2526zy%253Dl</X-Auto-Login>
<Date>Mon, 25 Jul 2011 10:52:44 GMT</Date>
<X-Content-Type-Options>nosniff</X-Content-Type-Options>
<X-XSS-Protection>1; mode=block</X-XSS-Protection>
<Content-Length>18700</Content-Length>
<Server>GSE</Server>
</header-lines>
<message-body><html lang="en" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="description" content="7+ GB of storage, less spam, and mobile access. Gmail is email that's intuitive, efficient, and useful. .... </html></message-body>
</httpAdapterResponse>
The following figure shows an XML sample of the HTTP adapter response when <enable-redirects> is set to false.
XML sample of the HTTP adapter response when <enable-redirects> is set to false
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>302</code>
<reason>Moved Temporarily</reason>
</status-line>
<header-lines>
<Content-Type>text/html; charset=UTF-8</Content-Type>
<Cache-Control>no-cache, no-store, max-age=0, must-revalidate</Cache-Control>
<Pragma>no-cache</Pragma>
<Expires>Fri, 01 Jan 1990 00:00:00 GMT</Expires>
<Date>Mon, 25 Jul 2011 10:59:22 GMT</Date>
<Location>https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=llya694le36z&scc=1<mpl=default<mplcache=2&from=login</Location>
<X-Content-Type-Options>nosniff</X-Content-Type-Options>
<X-Frame-Options>SAMEORIGIN</X-Frame-Options>
<X-XSS-Protection>1; mode=block</X-XSS-Protection>
<Server>GSE</Server>
<Content-Length>423</Content-Length>
<Connection>Keep-Alive</Connection>
</header-lines>
<message-body><HTML><HEAD><TITLE>Moved Temporarily</TITLE></HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"><H1>Moved Temporarily</H1>The document has moved <A HREF="https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=llya694le36z&scc=1&ltmpl=default&ltmplcache=2&from=login">here</A>.</BODY></HTML></message-body>
</httpAdapterResponse>
The following figure shows an XML sample of the HTTP adapter response when the the adapter supports downloading a file.
XML sample of the HTTP adapter response when the adapter supports downloading a file
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>OK</reason>
</status-line>
<header-lines>
<Date>Thu, 01 Sep 2011 11:29:35 GMT</Date>
<Server>Apache</Server>
<Last-Modified>Sat, 09 Oct 2010 14:30:17 GMT</Last-Modified>
<ETag>"a010afff-35702-4cb07c79"</ETag>
<Accept-Ranges>bytes</Accept-Ranges>
<Content-Type>application/pdf</Content-Type>
<Content-Length>218882</Content-Length>
<Connection>Keep-Alive</Connection>
<Age>89423</Age>
</header-lines>
<download-directory>c:\test\</download-directory>
<name>sample.pdf</name>
</httpAdapterResponse>