Skip to Main Content

Infrastructure Software

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!

Zone reboot issue

942274Nov 20 2012 — edited Nov 26 2012
Hi all,

Since I'm running Virtual box in Solaris 11 in a zone, but when I reboot a non-global-zone, the error occurred like following message.

Could anyone met this message before and how to fix it?



zlogin redhat5 zlogin: login allowed only to running zones is shutting_down

Comments

User_HWHT9

Have you read the documentation? https://docs.oracle.com/en/cloud/paas/mobile-cloud/mcsua/rest-connector-apis.html#GUID-12D976D7-5FCA-49C1-8D85-44A9BC438…

Have you watched the videos? https://www.youtube.com/watch?v=AzRYJ_wQduY&list=PL2ux0DjE-RYf7Rzh05Y98QWroTb76yyov

If yes can you be more specific on your question on what you don't understand please.

CM.

Janaki Narayanan

I have gone through the documentation and video in youtube ,but i didnt get a clear idea about the REST Connectors that created with Rest URL with headers.

I also tried the REST API (google api) provided in oracle and it is working fine.Few sample API like weather api is also working fine.

I have elaborated my question.Please check it out.

Thanks& Regards,

-Janaki

User_HWHT9

Janaki, is your question about REST Connectors in general in MCS, or specifically about adding HTTP headers to a REST Connector call via MCS?

If the later, there are 2 ways to do this:

a) For static non changing HTTP headers use the REST HTTP Header "Rules" feature:

https://docs.oracle.com/en/cloud/paas/mobile-cloud/mcsua/rest-connector-apis.html#GUID-21EBB7F1-CDD3-4812-925A-607B76A84…

b) If the HTTP headers are dynamic, instead in your NodeJS code when you call the REST connector:

service.get('/mobile/custom/incidentreport/weather/:city',

  function (req, res) {

  var body = {

  Header: {

    myHeader1:"myValue1",

    myHeader2:"myValue2"

  },

  Body: {

    GetWeather: {

      CityName: req.params.city,

      CountryName: 'Spain'

    }

  }

};

req.oracleMobile.connectors.post('globalweather', 'GetWeather', body).then(

  function (result) {

    console.info("result is: " + result.statusCode);

    res.send(result.statusCode, result.result);

  },

  function (error) {

    console.info("error is: " + error.statusCode); 

    res.send(500, error.error);

  }

  );

  });


CM.

Janaki Narayanan

Hi Chris,

I have rest URL with authorization as one of the header parameter.When I Test the Rest Connector I am able to add the authorization as a header parameter and test it successfully.But when I test the custom API created using that connector I am getting below error.Screenshot.jpg

I will also attach my Node Js code

/**

* The ExpressJS namespace.

* @external ExpressApplicationObject

* @see {@link http://expressjs.com/3x/api.html#app}

*/

/**

* Mobile Cloud custom code service entry point.

* @param {external:ExpressApplicationObject}

* service

*/

module.exports = function(service) {

/\*\*

 \*  The file samples.txt in the archive that this file was packaged with contains some example code.

 \*/

service.get('/mobile/custom/Login_Rest/login', function(req,res) {

var body = {

Header: {

"content-type": req.header.content-type,

"authorization": req.header.authorization,

"Responsibility": req.header.Responsibility,

"RespApplication": req.header.RespApplication,

"SecurityGroup": req.header.SecurityGroup,

"NLSLanguage": req.header.NLSLanguage,

"Org_Id": req.header.Org_Id

},

Body: {

username: req.params.username,

password:req.params.password

}

};

req.oracleMobile.connectors.post('TestRestAPI', '', body).then(

function (result) {

console.info("result is: " + result.statusCode);

res.send(result.statusCode, result.result);

},

function (error) {

console.info("error is: " + error.statusCode);

res.send(500, error.error);

}

);

});

};

Please clarify me below

How to pass authorization header paramter?

whether there is any error with the custom code ?

Tware-Oracle

See: Calling MCS APIs from Custom Code

Note:

You might notice that you don’t need to worry about authentication when you send requests to MCS APIs from custom code. MCS re-uses the access token that’s passed into the custom code and takes care of authentication for you. With connectors, if you need to use different credentials for the external service, you can use options.externalAuthorization

to pass the value to be used in the Authorization

header for the external service.

Janaki Narayanan

Thanks for your response Tware

Still I didn't create a custom API using REST connectors successfully.

Can you please verify the steps I follow.

Entered API name and created resources with GET method.I have given two input parameters as query and Headers parameters as headers.

My Custom code is

/**

* The ExpressJS namespace.

* @external ExpressApplicationObject

* @see {@link http://expressjs.com/3x/api.html#app}

*/

/**

* Mobile Cloud custom code service entry point.

* @param {external:ExpressApplicationObject}

* service

*/

module.exports = function(service) {

  /**

  *  The file samples.txt in the archive that this file was packaged with contains some example code.

  */

service.get('/mobile/custom/MobileLogin_Rest/userLogin', function(req,res) {

  var body = {

  Header: {

"Content-type": req.header.content-type,

"authorization": req.header.authorization,

"Responsibility":  req.header.Responsibility,

"RespApplication": req.header.RespApplication,

"SecurityGroup":  req.header.SecurityGroup,

"NLSLanguage":  req.header.NLSLanguage,

"Org_Id":  req.header.Org_Id

  },

  Body: {

      P_USRNAME: req.params.P_USRNAME,

    P_PASSWORD: req.params.P_PASSWORD

  }

};

req.oracleMobile.connectors.post('TestRestAPI', '', body).then(

  function (result) {

console.info("result is: " + result.statusCode);

  res.send(result.statusCode, result.result);

},

  function (error) {

    console.info("error is: " + error.statusCode);

    res.send(500, error.error);

  }

  );

  });

};

And also clarify me .

Whether I have to change the authorization to options.externalAuthorization in Headers parameters?

Tware-Oracle

Your code should look roughly like this:

service.get('/mobile/custom/MobileLogin_Rest/userLogin', function(req,res) {

  var headers = {

"Content-type": req.header.content-type,

"Responsibility":  req.header.Responsibility,

"RespApplication": req.header.RespApplication,

"SecurityGroup":  req.header.SecurityGroup,

"NLSLanguage":  req.header.NLSLanguage,

"Org_Id":  req.header.Org_Id

  };

var body =  {

      P_USRNAME: req.params.P_USRNAME,

    P_PASSWORD: req.params.P_PASSWORD

  };

req.oracleMobile.connectors.post('TestRestAPI', '', body, {inType: 'json', externalAuthorization: <authorization for your external service here if needed> }, {headers: headers}).then(

  function (result) {

console.info("result is: " + result.statusCode);

  res.send(result.statusCode, result.result);

},

  function (error) {

    console.info("error is: " + error.statusCode);

    res.send(500, error.error);

  }

  );

  });

};

Janaki Narayanan

Hi Tware,

Now getting below error

Thanks,Screenshot001.jpg

Tware-Oracle

Take a look at your logs.  There should be a log message with a stack trace.  That will be useful in tracking this down.

If you don't see that message, please share your identity domain name.

Janaki Narayanan

I found that error in log in that log.Identity Domain is gse00010158.

Tware-Oracle

What is the error?  Please include the stack trace.

Janaki Narayanan

Hi Tware,

Below is the stack trace .Please help me.

Tware-Oracle

The top line of the stack trace tells you where the problem is:

type is not defined at /mobile/mobile_ccc/custom_code_modules/transrestapi_1.0.0_7/transrestapi/transrestapi.js:25:36

Look on line 25 of transrestapi.js.  Do you see "type" there.  It need to be defined before you can use it.

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

Post Details

Locked on Dec 24 2012
Added on Nov 20 2012
3 comments
4,027 views