Error 00068: Broken data source, when trying to publish Web Tool with Portal connection.

3591
7
Jump to solution
05-26-2020 05:46 AM
MarkusBenninghoff
New Contributor II

I am running into an issue when trying to publish our Geoprocessing tool as a Web Tool to our portal.

I created the simplest script, to recreate the issue:

from arcgis.gis import GIS
import arcpy

gis = GIS(url="https://gis.example.com/portal", username='geop', password='****')

fv = arcpy.GetParameterAsText(0)
if fv=="":
    fv = 'DEFAULT'
fv = str(fv)

arcpy.AddMessage("Parameter is: {}, type: {}".format(fv, type(fv)))
arcpy.AddMessage("Finished!")‍‍‍‍‍‍‍‍‍‍‍‍

It runs fine in ArcGIS Pro 2.5. When I try to share it as a Web Tool Error 00068 and Warning 24032 pop up, referencing a broken project data source.

Script TestScript contains broken project data source:

MESSAGEFORMAT=esriAGSInternetMessageFormatBin;SERVERTYPE=esriAGSServerTypeDiscovery;CONNECTIONMODE=esriAGSConnectionModePublisher;SERVERURL=https://gis.example.com/arcgis;USERPORTALANDFEDSERVERTOKEN=-1;PORTALURL=https://gis.example.com/port...

I suppose that including ArcGIS API for Python like this in Web Tool is not desired/supported. What is the correct way to include it?

Tags (1)
1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

Hi @PhilipC , @MarkusBenninghoff ,

This might help you with publishing the GP tool into Portal:

portalURL = "https:??gis.example.com?portal"
portalURL = portalURL.replace('??', '//')
portalURL = portalURL.replace('?', '/')

gis = GIS(url = portalURL, username = 'geop', password = '****', verify_cert = False)

When trying to share a GP tool and analyzing it before publishing, the GP script is scanned to discover any project data. When this happens, every quoted string used in a Python variable or as an argument to a function is tested to see if it is a path to data that exists.

Therefore, in the user's script,  the Portal URL string is interpreted as a file path, hence deemed to be an invalid data source. By creating a string variable as "https:??gis.example.com?portal" and replacing the "?" with "/", the URL will be interpreted as a file path.

I hope that helps.

Mehdi

View solution in original post

7 Replies
MarkusBenninghoff
New Contributor II

The same script runs fine with connection to ArcGIS Online.

gis = GIS(url="https://www.arcgis.com", username='geop', password='****')

However, we need to share it to our portal.

Is there a way to register the Portal connection before publishing it as a Web Tool?

Related (unanswered) issue:

https://community.esri.com/thread/250333-can-the-python-api-be-used-in-a-web-tool-for-managing-porta... 

0 Kudos
PhilipC
New Contributor

Hi,

Did you ever figure out the solution to this problem? I am receiving the same error; however, I do not use the arcgis api for python. Just arcpy, as I was having problems on my portal when importing the former. Like you, the tool runs just fine in ArcGIS Pro 2.5 but gets stuck on the Share As Web Tool phase.

Thanks for any help!

0 Kudos
MehdiPira1
Esri Contributor

Hi @PhilipC , @MarkusBenninghoff ,

This might help you with publishing the GP tool into Portal:

portalURL = "https:??gis.example.com?portal"
portalURL = portalURL.replace('??', '//')
portalURL = portalURL.replace('?', '/')

gis = GIS(url = portalURL, username = 'geop', password = '****', verify_cert = False)

When trying to share a GP tool and analyzing it before publishing, the GP script is scanned to discover any project data. When this happens, every quoted string used in a Python variable or as an argument to a function is tested to see if it is a path to data that exists.

Therefore, in the user's script,  the Portal URL string is interpreted as a file path, hence deemed to be an invalid data source. By creating a string variable as "https:??gis.example.com?portal" and replacing the "?" with "/", the URL will be interpreted as a file path.

I hope that helps.

Mehdi

PhilipC
New Contributor

Thank you @MehdiPira1 ! This worked for me!

0 Kudos
MehdiPira1
Esri Contributor

Cool @PhilipC,

Great to hear that!

0 Kudos
kmsmikrud
Occasional Contributor III

Hi @MehdiPira1 ,

Thank-you for the work around on the Portal URL. I've changed this in the script tool I'm trying to share as a web tool. I still have errors with the web tool analyze step in that it wants to register/copy all the AGOL feature layer urls to the server. This is the first web tool I am trying to share to our Portal and currently we do not have a collaboration set up with our organization AGOL. Can I register our AGOL as a data store for these services? 

Or is there an issue with AGOL feature layers (only shared to a group) being used as data sources in web tools? The GIS object I reference in the script is to our AGOL not our Portal since the data is in AGOL. I am new to the web tool and so I'm still not sure on all the settings.

Thanks in advance,

Kathy

0 Kudos
Ranga_Tolapi
Occasional Contributor III

https://support.esri.com/en/technical-article/000022882

portalURL = "https??hostname.domian.com?portal"
portalURL = portalURL.replace('??', '://')
portalURL = portalURL.replace('?', '/')
gis = GIS(portalURL)

 Attention: '??' need to be replaced with '://'

0 Kudos