Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

XMLHttpRequest NETWORK_ERR

10 REPLIES 10
Reply
Message 1 of 11
jwolgamott
554 Views, 10 Replies

XMLHttpRequest NETWORK_ERR

I have a library script that makes an XMLHttpRequest to a REST API.  The script works fine if I set the XMLHttpRequest URL to http://myapi.foo.com, but when I try to change the request to https://myapi.foo.com (notice the s in https), the script fails with a NETWORK_ERR and no additional error information.  I am able to execute the same request from Chrome developer tools and Firefox developer tools using the https URL without issue.  Has anyone else encountered this issue?  Are there any other ways to make an HTTPS request in PLM Scripting?

 

Failing Script:

var APIURL = "https://myapi.foo.com";
var xhr = new XMLHttpRequest();
xhr.open('PUT',APIURL);
xhr.send(); // fails here
var response = xhr.responseText;

Successful Script:

var APIURL = "http://myapi.foo.com";
var xhr = new XMLHttpRequest();
xhr.open('PUT',APIURL);
xhr.send();
var response = xhr.responseText;

Thanks!

Tags (1)
10 REPLIES 10
Message 2 of 11
gasevsm
in reply to: jwolgamott

Hi,
If you take he https:// route via manual browser typing in, does it stay https or it redirects to http protocol?

Martin Gasevski | Fusion 360 Team Product Manager
Message 3 of 11
jwolgamott
in reply to: gasevsm

Hi Martin,

 

I just performed this in Chrome, and it in fact the request stays https and even shows that the TLS/SSL certificate is valid and trusted.  I was able to get a little more error information from the error log attached to my script.  The full error is: [XMLHttpRequest] org.mozilla.javascript.JavaScriptException: NETWORK_ERR.

Message 4 of 11
tony.mandatori
in reply to: jwolgamott

Your browser might have certificates that are not installed on the server.

 

The only way to diagnose is for someone with access to the server to run the following

 

openssl s_client -showcerts -connect myapp.foo.com:443

 

I don't have access to the server.

Message 5 of 11
gasevsm
in reply to: tony.mandatori

We don't install certs on server. Something else may be going on here. This should work both https and http. I'll do some tests and share..

Martin Gasevski | Fusion 360 Team Product Manager
Message 6 of 11
jwolgamott
in reply to: gasevsm

Thanks for your help Martin!  It's greatly appreciated.  The https://myapi.foo.com is obviously a fictitious URL, but I can provide you with my actual API URL on a private thread if it helps you to diagnose this issue.

Message 7 of 11
dany.poudrier
in reply to: jwolgamott

Hi,

 

We have a few customers running into similar situations and posted on this Forum:

 

http://forums.autodesk.com/t5/fusion-lifecycle-forum/xmlhttprequest-in-action-script/m-p/4378373/hig... : Authentication required since it is a secured channel.

 

http://forums.autodesk.com/t5/fusion-lifecycle-forum/javascript-require-method/m-p/6388586/highlight... : Signed certificate issue

 

http://forums.autodesk.com/t5/fusion-lifecycle-forum/network-err-for-xlmhttprequest-in-a-script/m-p/... : Authentification should be encoded 

 

 

From your snipplet, it seems that you didn't include the Authentication information in the request. If you tested with chrome you may have an active session already running.  I suggest that you open a new Chrome in Incognito mode and try again the https and analyse the response.

 



Dany Poudrier

PLM Product Manager
Message 8 of 11
jwolgamott
in reply to: dany.poudrier

Hi Dany,

 

Thank you for the recommendations.  I have unfortunately viewed all of the forum threads that you reference, and they do not address the issue that i'm encountering.  The API URL that i'm trying to access is a RESTful service that we developed in house.  The service does not currently require authentication or an Authorization header of any kind.  Additionally, the service is stateless, so no sessions are created and Chrome would not have an auth session associated with this API.  We are able to successfully access this service from other environments without issue.

 

It would be great if the PLM scripting debugger provided a more verbose error message.  We aren't sure how to proceed at this point because the error message is so generic (NETWORK_ERR).

Message 9 of 11
gasevsm
in reply to: jwolgamott

I'm looking into this with assistance of Autodesk Cloud OPS. Thanks for your patience,

Martin Gasevski | Fusion 360 Team Product Manager
Message 10 of 11
jwolgamott
in reply to: gasevsm

Thank you for your assistance with this.  I believe the issue was actually caused by my third party hosting provider for my external API.  I was able to resolve by moving my API to a different host.

Message 11 of 11
gasevsm
in reply to: jwolgamott

Pleasure. Very glad you found a solution.

Martin Gasevski | Fusion 360 Team Product Manager

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report