• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How Do I Read/Parse an XML File?

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using the org.apache.commons.httpclient API and I can't retreive an XML file. My code seems to be failing here:


Here is the stack output (I'm using GWT in Eclipse)

com.google.gwt.user.client.rpc.StatusCodeException: The call failed on the server; see server log for details
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:192)
at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:264)
at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:236)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:227)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:264)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:557)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)

Can anyone offer help? Thanks in advance,
-Russ
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The call failed on the server; see server log for details



Do you have access to the server logs from my.safaribooksonline.com? If not, then all you know is that your request caused a failure in their system. You could experiment with different requests to see what features of the request cause failures. Or if this happens frequently and unpredictably you could contact them and try to find somebody to discuss the problem with.

By the way your post title is misleading. There is no XML file involved here, the server failed instead of returning one to you.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could use an HTTP proxy (like tcpmon) to compare the HTTP request being sent by your application and the one being sent by the browser (which you have presumably tried and which works fine).
 
Russ Russell
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I simply copy & paste the URL into a browser, I get the XML document. That's why I beleive the server error refers to my app's RPC call - not the my.safaribooksonline.com server.

I'm really just looking for the APIs and steps required to read and parse XML (since my method doesn't seem to work).

Thank you,
-Russ

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's just an HTTP call, and since it works in principal -the browser can do it, after all-, there must be something different about the HTTP request being sent by your app. Hence the suggestion to examine those differences.
 
Russ Russell
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been examining those differences all day. Here's what I've discovered. The code fails at the line:


Since I'm new to XML (not so new to Java), I thought I'd post my probelm here in the hopes of finding what I'm doing wrong, or what the proper method is for successfully grabbing XML data.

Thank you.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, as Ulf already said, it has nothing to do with the fact that you expect to be getting XML data back from that server. The problem is more likely that you aren't sending the HTTP request correctly. Maybe you need to authenticate, or pass cookies back and forth, or something like that.

So I'm going to move this to a more suitable forum.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic