Comments

  • Chris Muir

    Given you're doing this for MAX, you might like to consider approaching this differently

    At the moment you're storing the binary images in the Storage API, then later retrieving them as per your code and you want the images as base64 encoded strings for MAX.  The problem is that conversion process takes CPU, memory and time, which is not ideal while the MAX mobile app waits for the response.  As such consider storing the images as base64 encoded strings in the Storage API instead when you first store them in MCS.  This means when you code retrieves the images, they're already converted to base64 strings and there is little CPU & memory expense in transferring them to MAX.

    However there is a constraint around this, in that base64 encoded images as strings can be large.  So you need to check the size of your largest image as a base64 encoded string, and test that the Storage API is happy to store that.  For example while small images should be fine, but if you have a 8MB image that converts to an even larger base64 string, this may not be suitable.

    The typical question I get at this point is what is the capacity of the Storage API.  However I'm reluctant to publicly give an answer as this is increasing all the time, and a near-future radical shift to the storage under the covers in MCS should bump this considerably and my answer will be out of date almost immediately.  So rather best you test the Storage API against your requirements, and if suitable then its good enough.

    CM.

  • Chris Muir

    It's not entirely clear where this code resides. I'm assuming this is a NodeJS code exert from a Custom API you've written inside of MCS?

    In this case you need to make use of a 'promise' framework that allows you to process all the images, *then* process the JSON file.  Promises are becoming a native feature of JavaScript based languages and as a NodeJS developer you will need to become familiar with these in order to solve asynchronous programming problems like that you're encountering.

    The MCS NodeJS solution is embedded with the 'Bluebird' promises library as mentioned in the MCS doc:

    https://docs.oracle.com/en/cloud/paas/mobile-cloud/mcsua/implementing-custom-apis.html#GUID-5DD8040C-1289-4E26-8484-2385…

    The MCS documentation does go on to detail how to use 'promises' in the following subsections 'Handling a Promise' and 'Chaining Calls' by using the 'then' keyword which shows you an example of what you're attempting to achieve:

    https://docs.oracle.com/en/cloud/paas/mobile-cloud/mcsua/calling-apis-custom-code.html#GUID-9E17EDB9-2FE4-499F-8D21-617E…

    Moving beyond MCS you can read the Bluebird documentation itself to see how it helps you with asynchronous programming problems.  It's worth while learning more about this as you work with asynchronous programming languages to understand the general async programming challenges and how to solve them:

    Getting Started | bluebird

    Separately I note your attached doc says "SR". If you separately lodged an SR with Oracle Support can you please let me know the SR number.

    CM.

  • Chris Muir

    Again this has to do with your user privileges.

    CM.

  • Chris Muir

    Hi Shubham

    If I understand it correctly at the end, you're indicating that somebody else (aka. your Administrator) has setup your account to an MCS trial account for your organization, and now you can't access the developer console.

    The typical reason for a user account not to be able to access the MCS developer console is the user does not have the required privileges/roles.  Which privileges your user has is controlled by the domain administrator at the higher level Oracle Cloud console.  What privileges do you have and not have?  Typically developers should have all roles except the "mobile business user" role.

    Alternatively rather than attempting to access the MCS developer console via the tutorial, have you attempted to access it from the Oracle Cloud console once logged in?

    Regards,


    CM.

  • Chris Muir

    As mentioned:

    "I suggest comparing the outgoing network calls to see what is different to see if you can work out why it isn't working.  In the end, the SDK makes a raw REST call just like your own code.  You have the ability to compare and work out what's going wrong."

    As such use the debugger to compare the network calls for your code vs the SDK code, and see where the outgoing network call payloads differ.  This will identify why your code vs the SDK code is not working.

    CM.

  • Chris Muir

    It's unclear when you say non using the SDK, do you mean inside the MCS test facility or from your own code.  I assume the latter.

    I suggest comparing the outgoing network calls to see what is different to see if you can work out why it isn't working.  In the end, the SDK makes a raw REST call just like your own code.  You have the ability to compare and work out what's going wrong.

    CM.

  • Chris Muir

    The error is being raised because the user you are logging into against MCS does not have privileges on the API you've built (/mobile/custom/CUST_FW_SCREEN_API/CUST_FW_SCREENEP).

    To test that the user does have privileges, login into MCS and use the test facility for the API in question.  When executing the API ensure to use a POST, and to use the same mobile backend, version, username and password.

    CM.

  • Chris Muir

    Sorry, I don't understand your answer to "b".  What do you mean "is itself MCS username and password"?  Do you mean you're using the MCS user you use to login to the MCS cloud user interface?  That user does not have privileges on accessing the MCS APIs.  Only users that exist in the Mobile Backend Realm can access APIs.  You need to create a separate user in the Realm of the Mobile Backend to authenticate with from your app.

    On "c", unfortunately you've completely hidden the URL call to the external server.  This means I can't see which API is getting called.  Only hide the base URL of the URL so we can see what MCS resource is being called.

    CM.

  • Chris Muir

    Some things I notice:

    a) Your MCS Mobile Backend name is odd "CUST_FW_SCREEN_MB1.0".  Is "1.0" actually in the name of the Mobile Backend?  Typically we don't do this.

    b) Is the username+password you're trying to authenticate with included in the Realm mapped to the MCS Mobile Backend?  ie. does the user actually exist in MCS?

    c) As per my other post, I suggest you use the debugger to see what actual remote API call is being called when you get the 401, and post that information here too.

    d) Finally I assume within your mcs_config where you have all the XXXXXs, that's just you obfuscating the real values.

    CM.

  • Chris Muir

    So this is a new and separate problem.  The previous problem is resolved.

    401 signifies the remote API you're calling is returning a user-is-not-authorized error.  As such the user you're attempting to use, either they don't exist, the password is wrong, or they don't have privileges on the API you're calling.

    As this is a separate problem to the original Ionic issue, can you please post a new OTN forum post AND code sample AND work out which line of code you're calling is resulting in the 401 being returned.  From my perspective I don't know Ionic, but it should be able to give you a debugger that shows you the remote API going out, and the 401 coming back.  This will help identify the code that is causing the problem.

    CM.

  • Chris Muir

    One thing we've noted is you've made a mistake in loading the libraries.  In a previous post you said you had added the following to your index.html:

    <script src="assets/mcs-cordova-js-sdk-v17.2.5.0/mcs.min.js"></script>

    <script src="assets/mcs-cordova-js-sdk-v17.2.5.0/mcs.sync.min.js"></script>

    <script src="assets/mcs-cordova-js-sdk-v17.2.5.0/mcs.js"></script>

    Firstly, it's not necessary to load both "mcs.min.js" and "mcs.js".  They are the same library.  The "min" library is the compressed library used for production systems.  The non-min library is the fully expanded library used for debugging.  By loading both of these you are creating a potential conflict in loading the same library twice.

    Second, you've included mcs.sync.min.js.  Only include this library if you intend to use our Sync Express functionality.  Sync Express shouldn't be added at a whim as it requires additional settings that are complex to setup when you may not be intending to use the sync library at all.

    Coincidentally regarding mcs.sync.min.js in asking our developers to check your post, they've discovered an initialization bug in Ionic 3 which may be causing your error.  They have a logged a bug for this and it will be prioritized for a future fix.  If you require an immediate fix for this issue please lodge an SR with Oracle Support, citing this OTN Forum post.

    In conclusion, assuming you don't intend to load the Sync Express library, then the only <script> tag you should require is the following if you are creating a production ready system:

    <script src="assets/mcs-cordova-js-sdk-v17.2.5.0/mcs.min.js"></script>

    ..or the following if you are creating a debuggable application..

    <script src="assets/mcs-cordova-js-sdk-v17.2.5.0/mcs.js"></script>

    CM.

  • Chris Muir

    For MAF your option for data offline & sync is CDM, which is the newer version of AMPA.  CDM is documented in the MAF dev guide.

    MAF is not compatible with the MCS feature known as "Data offline & Sync API", nor "Sync Express".  To express this another way MAF+CDM supports data offline & sync which can be used against MCS, but MAF does not support the MCS data offline & sync API feature itself.

    CM.

  • Chris Muir

    Thanks.  Like the other forum post unfortunately we don't have someone skilled in Ionic monitoring these posts, so I'll need to find somebody who can answer the question.  This may take sometime thanks to timezones and availability of staff.

    CM.

  • Chris Muir

    Can you confirm you've followed the steps in this forum post please?

    CM.

  • Chris Muir

    Hi Reinhard, this is the forum for "Oracle Mobile Cloud Service", an actual product in it's own right.  It does not cover mobile apps for other products such as Sales Cloud.  I suggest you post to the appropriate forum for that product.

    CM.