# Unable to Resolve XML URL (Even though it is valid)

**URL:** <https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836>\
**Category:** Coding Questions\
**Created:** [June 4, 2019, 3:59pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836 "2019-06-04T15:59:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![n055](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/n055/32/5466_2.png) [@n055](https://discourse.processing.org/u/n055)\
**Post date:** [June 4, 2019, 3:59pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/1 "2019-06-04T15:59:18Z")

</div>

Hey y’all, I’m trying to fetch an xml document from a URL for a daily quote, but despite the link working outside of Processing (it resolves in my browser and in an online xml reader), I’m getting lots of strange errors when I try in Processing.

```auto
XML x;

void setup() {
  size(400, 400);
  background(255);
  
  x = loadXML("https://www.chabad.org/tools/rss/dailyquote_rss.xml");
  
}

void draw() {
  saveXML(x, "save.xml");
  noLoop();
}

```

Here are the errors I get:

> java.io.IOException: Server returned HTTP response code: 403 for URL: [Chabad.org2 -- Daily Quote](https://www.chabad.org/tools/rss/dailyquote_rss.xml)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
> at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  
> at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1944)  
> at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1939)  
> at java.security.AccessController.doPrivileged(Native Method)  
> at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1938)  
> at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1508)  
> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)  
> at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)  
> at processing.core.PApplet.createInputRaw(PApplet.java:7152)  
> at processing.core.PApplet.createInput(PApplet.java:7098)  
> at processing.core.PApplet.createReader(PApplet.java:6904)  
> at processing.core.PApplet.loadXML(PApplet.java:5995)  
> at processing.core.PApplet.loadXML(PApplet.java:5985)  
> at XML\_test.setup(XML\_test.java:28)  
> at processing.core.PApplet.handleDraw(PApplet.java:2425)  
> at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1547)  
> at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:313)  
> Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: [Chabad.org2 -- Daily Quote](https://www.chabad.org/tools/rss/dailyquote_rss.xml)  
> at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)  
> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)  
> at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)  
> at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)  
> at processing.core.PApplet.createInputRaw(PApplet.java:7145)  
> … 8 more  
> The file “[Chabad.org2 -- Daily Quote](https://www.chabad.org/tools/rss/dailyquote_rss.xml)” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.  
> NullPointerException

I’ve tried to resolve some sample xml URLs, and some of them worked, but others do not. Any ideas why or how I can get this working?

Much appreciated \<3

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 4, 2019, 4:54pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/2 "2019-06-04T16:54:35Z")

</div>

> **[HTTP 403](https://en.wikipedia.org/wiki/HTTP_403)**
>
> HTTP 403 is a standard HTTP status code communicated to clients by an HTTP server to indicate that access to the requested (valid) URL by the client is Forbidden for some reason. The server understood the request, but will not fulfil it due to client related issues. There are a number of sub-status error codes that provide a more specific reason for responding with the 403 status code.
> HTTP 403 provides a distinct error case from HTTP 401; while HTTP 401 is returned when the client has not authe...

---

<div class="post-metadata">

**Author:** ![n055](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/n055/32/5466_2.png) [@n055](https://discourse.processing.org/u/n055)\
**Post date:** [June 4, 2019, 7:50pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/3 "2019-06-04T19:50:36Z")

</div>

I appreciate the reference. I had researched all of this before writing this ticket though 😕 it still doesn’t explain why Processing specifically is having trouble with accessing the link, or give any ideas to how to fix it.  
Networking isn’t my strong suit so I’d appreciate any help with this

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 4, 2019, 8:16pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/4 "2019-06-04T20:16:14Z")

</div>

> [@n055](#):
>
> Networking isn’t my strong suit…

Neither mine. 😑

Perhaps they’ve prohibited your request due to lack of some headers or credentials. 🆔

This library should be more fitted for such complex requests: 📚

> **[GitHub - runemadsen/HTTP-Requests-for-Processing](https://github.com/runemadsen/HTTP-Requests-for-Processing)**
>
> Contribute to runemadsen/HTTP-Requests-for-Processing development by creating an account on GitHub.

Or you may try to write it in p5js instead: 😳

- [reference | p5.js](http://p5js.org/reference)
- [Processing transition · processing/p5.js Wiki · GitHub](http://GitHub.com/processing/p5.js/wiki/Processing-transition)

---

<div class="post-metadata">

**Author:** ![n055](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/n055/32/5466_2.png) [@n055](https://discourse.processing.org/u/n055)\
**Post date:** [June 4, 2019, 8:29pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/5 "2019-06-04T20:29:43Z")

</div>

Thanks \<3 I’ll take a look

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [June 5, 2019, 8:25am UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/6 "2019-06-05T08:25:58Z")

</div>

Do you have any form of network proxy involved where you’re testing?

---

<div class="post-metadata">

**Author:** ![n055](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/n055/32/5466_2.png) [@n055](https://discourse.processing.org/u/n055)\
**Post date:** [June 5, 2019, 4:06pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/7 "2019-06-05T16:06:19Z")

</div>

@neilcsmith I do, I use a VPN, but I’ve turned it off and even connected to another network just to make sure. Same results.

---

<div class="post-metadata">

**Author:** ![n055](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/n055/32/5466_2.png) [@n055](https://discourse.processing.org/u/n055)\
**Post date:** [June 5, 2019, 4:10pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/8 "2019-06-05T16:10:05Z")

</div>

> [@GoToLoop](#):
>
> This library should be more fitted for such complex requests: 📚
> 
> ![](https://github.githubassets.com/favicon.ico) [GitHub](https://github.com/runemadsen/HTTP-Requests-for-Processing)
> 
> ![](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/37dddcb60da7428c6242b2dc37a5d1260c51f276.jpeg)
> 
> ### [runemadsen/HTTP-Requests-for-Processing](https://github.com/runemadsen/HTTP-Requests-for-Processing)
> 
> Contribute to runemadsen/HTTP-Requests-for-Processing development by creating an account on GitHub.
> 
> Or you may try to write it in p5js instead:

This is working for me! 🙂 thanks so much. Still no clue why the normal way isn’t working, but I can have this for now. Thanks again.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [June 5, 2019, 4:31pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/9 "2019-06-05T16:31:48Z")

</div>

Just a thought, because the JVM can have issues with proxies. Anyway, found the answer to your problem now I’m at my computer, and it’s a fun one - try this

```auto
XML x;

void setup() {
  size(400, 400);
  System.setProperty("http.agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0");
  
  background(255);
  
  x = loadXML("https://www.chabad.org/tools/rss/dailyquote_rss.xml");
 
}

void draw() {
  //saveXML(x, "save.xml");
  println(x);
  noLoop();
}

```

Looks like they’re rejecting some user agents!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 5, 2019, 6:13pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/10 "2019-06-05T18:13:50Z")

</div>

> [@neilcsmith](#):
>
> Looks like they’re rejecting some user agents!

Nice finding! But I’ve also found out any “user agent” string will do for this site: 🤣

```auto
static final String
  AGENT = "http.agent", 

  URL =
  "http://" +
  "Chabad.org/" +
  "tools/rss/" +
  "dailyquote_rss.xml";

XML xml;

void setup() {
  System.setProperty(AGENT, JAVA2D);
  println(URL, ENTER);

  xml = loadXML(URL);
  println(xml);

  exit();
}

```

---

<div class="post-metadata">

**Author:** ![n055](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/n055/32/5466_2.png) [@n055](https://discourse.processing.org/u/n055)\
**Post date:** [June 5, 2019, 6:37pm UTC](https://discourse.processing.org/t/unable-to-resolve-xml-url-even-though-it-is-valid/11836/11 "2019-06-05T18:37:28Z")

</div>

Lol that’s too funny. I’m probably gonna end up having some fun and make my useragent some Gucci brand smart fridge browser or something. Anyways thanks fellas and be well
