Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Adding Authorization Http Header to a Request from Client

843841Nov 21 2006
I have 2 web applications, running on Jboss and Oracle As,
in the same network. The application on Oracle As uses basic
authentication. The application running on Jboss has no authentication, basic, form or digest, but the request
is to implement an authorization against the Oracle As, so the oracle users will have also access into the jboss app.,
a sort of sigle sign on between the two servers.

I find out the solution to authenticate through the java code using
Authenticator.setDefault, ( this is my post http://forum.java.sun.com/thread.jspa?threadID=787326&tstart=0 )
but when I try to click a link to a secured page in Oracle As I still receive the basic popup asking me for user and password.

Therefore I need to add authentication information to the http request
header sent by the client running on jboss when open a secured page
from the second app, running on Oracle As.

The application on Oracle Aps uses basic authentication so I just need to add the
"Authorization: Basic <base64 string>" header. I checked with http://web-sniffer.net/ to see exactly how this header should look like.

Could anybody offer an example to demonstrate how to add the Authorization header? Thanks.

Comments

Sunil Bhatia

Hi,

Onload text item would be null if your code runs before populating the actual apex item. Why dont you try the same code on button click.

It will ensure the syntax you are using is correct or not. Also if you are using oracle workspace, share the link of application as well.

-- Sunil Bhatia

Ap3x DEV

i have created a dynamic action on button but when i click it does not fires

work space name persnal

user name test

password is 1234gee

app name is ebay u can chake it out thnx

nad page number is 5 title is reporting2

Tom Petrus

javascript is case sensitive. Item IDs are generated in uppercase.

$v('P1_VALUE')

Sunil Bhatia

Your page has 3 errors in javascript console. Correct them and then execute your javascript, it will probably run.

[blocked] The page at 'https://apex.oracle.com/pls/apex/f?p=56420:5:116547887824068:::::' was loaded over HTTPS, but ran insecure content from 'http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findI…IN&itemFilter(2).value(1)=FixedPrice&itemFilter(2).value(2)=StoreInventory': this content should also be loaded over HTTPS.  f?p=56420:5:116547887824068::::::1

Uncaught SyntaxError: Unexpected token < f?p=56420:5:116547887824068::::::210

Uncaught TypeError: undefined is not a function



Ap3x DEV

hi tom thnx for reply and

i have done that but it still not working

Ap3x DEV

hi sunil thnx for help but i am trying to create a page in apex that will get the data from ebay

and show it in my apex page in my js code i m actually calling the ebay api and getting the data from it and displaying it in my

html region div

<html>

<head>

<title>ebay data</title>

<body>

<h1>eBay Search Results</h1>

<div id="results"></div>

<script>

// Parse the response and build an HTML table to display search results

function _cb_findItemsByKeywords(root) {

  var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];

  var html = [];

  html.push('<table width="100%" border="0" cellspacing="0" cellpadding="3"><tbody>');

  for (var i = 0; i < items.length; ++i) {

    var item     = items[i];

    var title    = item.title;

    var pic      = item.galleryURL;

    var viewitem = item.viewItemURL;

    if (null != title && null != viewitem) {

      html.push('<tr><td>' + '<img src="' + pic + '" border="0">' + '</td>' +

      '<td><a href="' + viewitem + '" target="_blank">' + title + '</a></td></tr>');

    }

  }

  html.push('</tbody></table>');

  document.getElementById("results").innerHTML = html.join("");

}  // End _cb_findItemsByKeywords() function

// Create a JavaScript array of the item filters you want to use in your request

var filterarray = [

  {"name":"MaxPrice",

   "value":"25",

   "paramName":"Currency",

   "paramValue":"USD"},

  {"name":"FreeShippingOnly",

   "value":"true",

   "paramName":"",

   "paramValue":""},

  {"name":"ListingType",

   "value":["AuctionWithBIN", "FixedPrice", "StoreInventory"],

   "paramName":"",

   "paramValue":""},

  ];

// Define global variable for the URL filter

var urlfilter = "";

// Generates an indexed URL snippet from the array of item filters

function  buildURLArray() {

  // Iterate through each filter in the array

  for(var i=0; i<filterarray.length; i++) {

    //Index each item filter in filterarray

    var itemfilter = filterarray[i];

    // Iterate through each parameter in each item filter

    for(var index in itemfilter) {

      // Check to see if the paramter has a value (some don't)

      if (itemfilter[index] !== "") {

        if (itemfilter[index] instanceof Array) {

          for(var r=0; r<itemfilter[index].length; r++) {

          var value = itemfilter[index][r];

          urlfilter += "&itemFilter\(" + i + "\)." + index + "\(" + r + "\)=" + value ;

          }

        }

        else {

          urlfilter += "&itemFilter\(" + i + "\)." + index + "=" + itemfilter[index];

        }

      }

    }

  }

}  // End buildURLArray() function

// Execute the function to build the URL filter

buildURLArray(filterarray);

// Construct the request

// Replace MyAppID with your Production AppID

var keywe = "&keywords=query";

window.alert($v('P5_VALUR'));

var url = "http://svcs.ebay.com/services/search/FindingService/v1";

    url += "?OPERATION-NAME=findItemsByKeywords";

    url += "&SERVICE-VERSION=1.0.0";

    url += "&SECURITY-APPNAME=WizmenSy-c510-435d-9924-1f1b5e68bb03";

    url += "&GLOBAL-ID=EBAY-US";

    url += "&RESPONSE-DATA-FORMAT=JSON";

    url += "&callback=_cb_findItemsByKeywords";

    url += "&REST-PAYLOAD";

    url +=  keywe;

    url += "&paginationInput.entriesPerPage=3";

    url += urlfilter;

// Submit the request

s=document.createElement('script'); // create script element

s.src= url;

document.body.appendChild(s);

</script>

</body>

</html>

this is the code i m actualy executing

i m using ebay function find items by keywords and input field i m creating so that user can enter the keywords

and ebay will return the result

now tel me wht should i do????

1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 19 2006
Added on Nov 21 2006
0 comments
283 views