Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9164

AJAX + jQuery + SAP Auth + Basic Authenticacion = 401 Unauthorized. (Code + Pics)

$
0
0

Hello,

 

Well, I can't find the way out. I google a lot, try different kind of ways, code examples, etc etc. and I am having this weird problem.

In SoapUI I can test the web service, and I can even authenticate to test the service.

But...

I can't make it by code.

 

So here are some print screens and the code I'm trying.

If you guys can help me out.

I will appreciate it.

 

thanks.

 

CODE:---------------

 

var WEBSERVICE_URL = "http://webservice:port/bla/bla/bla";

 

 

 

        $.ajax({

            url: WEBSERVICE_URL,

            type: "POST",

            dataType: "json",

            username: "user",

            password: "password",

            processData: false,

  crossDomain: true,

            contentType: "application/json",

  beforeSend: function (xhr) {

    xhr.setRequestHeader ("Authorization", "Basic SomeLettersAndNumbers_I_GotBySoapUI_IKnowHereItGoesTheKeyString==");

},

            success: function () {

                alert("success");

            },

            error: function (xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response

                alert(xhr.status);

                alert(xhr.responseText);

            },

        });


Viewing all articles
Browse latest Browse all 9164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>