Select to view content in your preferred language

How to use Esri::ArcGISRuntime::Portal to connect to my own portal

2439
13
10-08-2018 06:17 AM
NorbertThoden
Frequent Contributor

Hi!

I would like to get information about the service urls privided at my onw portal.

So like to start with Esri::ArcGISRuntime::Portal, but how?

  1. There are so many examples using Portal, don´t know where is a simple on (as less QML as possible)?
  2. How do i get my url? (one of my REST-URLs is
    "http://XXXX.de/arcgis/rest/services/Bremen/BremenElevation/ImageServer "
  3. Do i have to use credentials? I would like to start very simple, just get list of basemap or items...)
  4. Got errorCode 25, like error occured realted to SSL...
    Pltaform codes are NOT here (Error Class | ArcGIS for Developers ), but would be nice to have i link...
    Should be here (Platform error codes—ArcGIS Runtime SDK for .NET (WPF) | ArcGIS for Developers )?
    But can`t find code 25....
  5. My Portal doesn´t have a CA, so using the browser i have to accept ssl messages od create exception.
    Will it work?

Thx in advance!

Norbert

0 Kudos
13 Replies
LucasDanzinger
Esri Frequent Contributor

Hi Norbert,

This documentation discusses how you sign into your Portal - Access the ArcGIS platform—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

To access items, see this topic - Access portal content—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

And to search, see this topic - Search for content—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

The high level workflow is:

- Create Portal object using your URL, and pass in credentials with username and password

- Load the Portal and wait fo it to be done loading

- Call findItems on the Portal object by passing in query parameters

- Get your desired Portal Item from this list

NorbertThoden
Frequent Contributor

Hi Luke!
Thanks for your quick answer 🙂

I tried my own URL "http://XXX.de"  with credentials

After load i get doneLoading and errorOccured with:

Esri::ArcGISRuntime::Error: code=404, domain=0, extendedErrorType=0, message='Error transferring http://excgeo20.sl.defence-elec.de/sharing/rest/info?f=json - server replied: Not Found', additionalMessage='Error transferring http://excgeo20.sl.defence-elec.de/sharing/rest/info?f=json - server replied: Not Found'

Any ideas?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Norbert- are you on the same internal network? If not, is your portal accessible outside your network? Also, did you set up your proxy? It should be as simple as the code in the doc:

QUrl portalUrl = QUrl("http://geoportal.mycompany.com");
Credential* portal_Credential = new Credential(portalUsername, portalPassword, this);
Portal* onPremisesPortal = new Portal(portalUrl, portal_Credential, this);
connect(onPremisesPortal, &Portal::loadStatusChanged, [this, onPremisesPortal](LoadStatus loadStatus)
{
  if (loadStatus == LoadStatus::Loaded)
  {
    PortalInfo* info = onPremisesPortal->portalInfo();
    qDebug() << info->portalName();
  }
});


onPremisesPortal->load();
0 Kudos
NorbertThoden
Frequent Contributor

Hi Luke!

I use my own map example to load an arcgisonline basemap tu guarantee that internet access is working.

In the same example i configure this portal url without credentials:   

new Esri::ArcGISRuntime::Portal(QStringLiteral("http://www.argis.com"));

or

new Esri::ArcGISRuntime::Portal(QStringLiteral("http://www.argis.com"), false);

After a few seconds:

2018-10-10 11:39:27.096 ERROR Portal |#| void SituationMap::Portal::onPortalDoneLoading(const Esri::ArcGISRuntime::Error &) Portal -> EsriError occured: Esri::ArcGISRuntime::Error: code=404, domain=0, extendedErrorType=0, message='Error transferring https://www.argis.com/sharing/rest/portals/self?f=json - server replied: Not Found', additionalMessage='Error transferring https://www.argis.com/sharing/rest/portals/self?f=json - server replied: Not Found' (SituationMap/Portal/portal.cpp:141)

2018-10-10 11:39:27.096 ERROR Portal |#| void SituationMap::Portal::onPortalErrorOccurred(const Esri::ArcGISRuntime::Error &) Portal -> EsriError occured: Esri::ArcGISRuntime::Error: code=404, domain=0, extendedErrorType=0, message='Error transferring https://www.argis.com/sharing/rest/portals/self?f=json - server replied: Not Found', additionalMessage='Error transferring https://www.argis.com/sharing/rest/portals/self?f=json - server replied: Not Found' (SituationMap/Portal/portal.cpp:132)

Is this maybe also not implemented on linux?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

If it fails to load with http://arcgis.com, I think that suggests some sort of network issue. It works in general on Linux - we run full certification testing on all the supported platforms.

0 Kudos
NorbertThoden
Frequent Contributor

I got it:

I was using an url like this: http:/XXX.de

Correct is: http://XXX.de/arcgis 

Consulting explained that the webadapter of our own portal uses "arcgis" by default.

So he suggested to add "/arcgis"

This fact should be noticed in the doc right!?

Thx

0 Kudos
NorbertThoden
Frequent Contributor

So, using http://XXX.de/arcgis i can connect to the portal anonymously.

After load and fetchBasemaps(), fetchFeaturedGroups(), fetchFeaturedItems(), fetchHomepageFeaturedContent() i can get the according model.

But the model content is not as expected:

  • FeaturedGroup contains just one entry: 'Featured Maps and Apps'.
    But i have added "MyBasemap".
    Using the browser i can see at the they have same parameter: Status == Public
  • Basemaps contains 2 entries: with empty name, but an url.
    These 2 urls match the 2 entries at "MyBasemap"

Maybe i have to use login credentials?

Therefore i updated the ssl certificates.

Result:

errorCode 25, related to SSL...

What is my long term goal?

  • get the swatch image of a (map) service (tile service used as basemap) and similar
  • get a list of available services (so the user can select one or more as basemap and update the config file for our application)

Any hints?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

We have a sample for that. It uses Qt Quick, so the UI portions won't be relevant for you, but the Portal related code should be - arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/CloudAndPortal/ShowOrgBasemaps at master · E... 

You can see that once the Portal loads, we call fetchBasemaps - arcgis-runtime-samples-qt/ShowOrgBasemaps.cpp at master · Esri/arcgis-runtime-samples-qt · GitHub 

Once basemapsChanged emits, you can access the BasemapListModel  and display that in a view of some sort (like List or GridView) Portal Class | ArcGIS for Developers 

The list model has roles for the thumbnail URL, name, etc - BasemapListModel Class | ArcGIS for Developers 

0 Kudos
NorbertThoden
Frequent Contributor

Hi Luke!

Thank you for your answer.

As describes i need not just the basemapListModel.

More important are the (basic) services listed under "My Content" if i login as portal user (admin).

There are my services of type

  • Map Image Layer -> used as basmap
  • Scene Layer (Scene Layer Package) -> containing the 3D model
  • Elevation Layer -> for 3D visualization and displaying the elevation of current mouse position

Is it correct that this service list can´t be retrieved using the SDK?

Is there another?

Thx

0 Kudos