XML : Unable to access file from google cloud storage using endpoints API

I have created an endpoint API which is suppose to read from xml file stored on Google Cloud Storage. But I am getting the following error: 503 Service Unavailable

  • Show headers -

    { "error": { "message": "javax.xml.bind.UnmarshalException\n - with linked exception:\n[java.io.FileNotFoundException: com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService@3c11f7: No such file: GcsFilename(miceast1, Carpool.xml)]", "code": 503, "errors": [ { "domain": "global", "reason": "backendError", "message": "javax.xml.bind.UnmarshalException\n - with linked exception:\n[java.io.FileNotFoundException: com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService@3c11f7: No such file: GcsFilename(miceast1, Carpool.xml)]" } ] } }

I am running the code in development sever. Below is the code used to read from the file.

  public CarPool receive() throws       Exception {      CarPool carpool=new CarPool();      JAXBContext context = JAXBContext.newInstance(FocusAnything.class);      Unmarshaller um = context.createUnmarshaller();        GcsService gcsService = GcsServiceFactory.createGcsService();      GcsFilename filename = new GcsFilename("miceast1", "Carpool.xml");        GcsInputChannel readChannel = null;      BufferedReader reader = null;      try {          readChannel = gcsService.openReadChannel(filename, 0);          reader = new BufferedReader(Channels.newReader(readChannel, "UTF8"));          FocusAnything focus = (FocusAnything) um.unmarshal(reader);          carpool = focus.getCarpool();      } finally {          if (reader != null) { reader.close(); }      }      return carpool;   }    

No comments:

Post a Comment