Web Appbuilder ArcGIS online layer print issue

1693
5
11-09-2016 08:00 AM
CCWeedcontrol
Regular Contributor

So i built a web app, i added the map i mad on ArcGis online with layers that i uploaded onto ArcGIS online. I upload the layer by using the "Add item, from computer" as a zip file. Once i was happy with the app i download and i tested it on my IIS with a proxy to by pass the login. I finally got the proxy to by pass the login. The problem I am having now is that when i try to print with the stock print widget  i get "Error, try again".

Chrome console throws this error and i am not sure what it means.

init.js:89 Error: Unable to complete operation.
    at Object.f.load (http://js.arcgis.com/3.18/init.js:862:493)
    at http://js.arcgis.com/3.18/init.js:87:450
    at c (http://js.arcgis.com/3.18/init.js:103:393)
    at d (http://js.arcgis.com/3.18/init.js:103:182)
    at b.Deferred.resolve.callback (http://js.arcgis.com/3.18/init.js:105:10)
    at c (http://js.arcgis.com/3.18/init.js:104:96)
    at d (http://js.arcgis.com/3.18/init.js:103:182)
    at b.Deferred.resolve.callback (http://js.arcgis.com/3.18/init.js:105:10)
    at http://js.arcgis.com/3.18/init.js:92:118
    at h (http://js.arcgis.com/3.18/init.js:107:279)

So i did a little testing and found something odd. If i add a layer to my ArcGIS online map( map used in my web Appbuilder) and not change a thing to that layer i get it to print fine BUT if i change the style of that layer say to only have a clear fill of the polygons i get the error mentioned above. If i try to change it back to with a fill i still get the error, i have to remove the layer from the map and re add the layer and not change anything for it to print fine.

Anyone else having this issue?

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

2CDSD 2C,

   Is the layer a secure layer? Have you checked the network traffic and made sure that the print task is going through the proxy? There are several threads on the proxy not handling secure service printing.

0 Kudos
CCWeedcontrol
Regular Contributor

I have done a search about printing secure layers but i haven't found what exactly i need to do or what to add to the proxy and the config file.

yes it is a secure layer.I have added the service to the proxy. maybe it's not right...?

How do i check the network traffic to make sure that the print task is going through the proxy?

the network, execute response for the print widget show.

{"error":{"code":400,"message":"Unable to complete operation.","details":["Error executing tool. Export Web Map Task Job ID: jfc9b9139cfe04c6193721d4ca567ea3e : Layer \"Sections\": Failed to create layer from service at http://services6.arcgis.com/885XQwwhV5bcCoLj/arcgis/rest/services/Sections/FeatureServer/0.\nFailed to execute (Export Web Map).\nFailed to execute (Export Web Map Task)."]}}

curl "http://****.****.org/DotNetProxy/proxy.ashx?http://services6.arcgis.com/885XQwwhV5bcCoLj/arcgis/rest..." -H "Accept-Encoding: gzip, deflate, sdch" -H "Accept-Language: en-US,en;q=0.8" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: */*" -H "Referer: http://****.****./DSDViewerTest1/index.html" -H "Connection: keep-alive" --compressed

my proxy is set up like this.

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
             mustMatch="false">
     <serverUrls>
       <serverUrl url="http://2cweeds.maps.arcgis.com" username="***" password="***" matchAll="true"/>
          <serverUrl url="http://services6.arcgis.com" clientId="D5tlWxpU0igT3EuI" clientSecret="86d8bd5c705f4546a3ebe855ae75cc7c" oauth2Endpoint="https://2cweeds.maps.arcgis.com/sharing/oauth2" matchAll="true"/>

    </serverUrls>
</ProxyConfig>

If the proxy not handling secure service printing how do you modify your config or proxy to handle secure service printing, is there an example?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

2CDSD 2C,

   You need to call tech support on this.

CCWeedcontrol
Regular Contributor

will do, thanks!

0 Kudos
ChristopherSchreiber
Occasional Contributor II

2CDSD 2C,

Unfortunatly, the Esri Resource proxy does not support printing secured services at this point. I have done some digging and found (from PrintTask, Secure AGS Service, and Resource Proxy ) this: 

The resource proxy will not print a secured map service. This is by design. So it is possible to use the proxy in order to authenticate and display the secured service on the map, but when it comes to printing a secured service, the resource proxy will not handle this scenario as it will not pass the token in the Web_Map_as_JSON parameter. If you are using a short lived token, then a solution would be to let the identity manager handle the authentication for you, meaning that you will get a prompt to enter your credentials once the app loads and then these credentials will be used when you try to print. Otherwise, you can create a custom print service and embed the credentials as described in the article. If you choose to use the second option, please make sure that you use a 10.3 print service or above as there was an issue in the earlier versions which is fixed in 10.3

======================================================================================

I have spent about a month on the phone with Esri tech support about this and have spoken with ArcGIS Server and Online personnel at the Esri UC this past summer and have gotten the same answers. Because the proxy won't apply the token it has, the print service will then not have permission to access the secured layer. I have tried and gotten the same errors as you are seeing. 

(My GeoNet thread: https://community.esri.com/message/598929 ) 

The suggested action by Esri tech support and the Esri staff at the UC was to custom edit the proxy to apply the token to the request. 

Sorry about the bad news. 

Chris