I am using the GDATA API for parsing google calendar. The Calendar is embedded in the website:
http://regreformtracker.aba.com/p/dodd-frank-calendar.html
I got the the calendar URL from the iframe src used in the above mentioned website which is :
https://www.google.com/calendar/b/0/embed?showTitle=0&height=600&wkst=1&bgcolor=%23FFFFFF&src=regreform%40aba.com&color=%23182C57&src=7vccf8rlid30a0v4m1004atiqg%40group.calendar.google.com&color=%23125A12&src=3rpabc5qjf34l49ho337qh9m04%40group.calendar.google.com&color=%23691426&ctz=America%2FNew_York
I am using the below mentioned snippet:
URL feedURL = new URL("https://www.google.com/calendar/b/0/embed?showTitle=0&height=600&wkst=1&bgcolor=%23FFFFFF&src=regreform%40aba.com&color=%23182C57&src=7vccf8rlid30a0v4m1004atiqg%40group.calendar.google.com&color=%23125A12&src=3rpabc5qjf34l49ho337qh9m04%40group.calendar.google.com&color=%23691426&ctz=America%2FNew_York");
CalendarService service = new CalendarService("TestCalendarFeed");
CalendarEventFeed resultFeed = service.getFeed(feedURL , CalendarEventFeed.class);
I get SAXParseException and below is the stack trace for the same:
[Fatal Error] strict.dtd:81:5: The declaration for the entity "ContentType" must end with '>'.
Oct 13, 2014 2:09:22 PM com.google.gdata.util.LogUtils logException
WARNING: org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.01//EN; systemId: http://www.w3.org/TR/html4/strict.dtd; lineNumber: 81; columnNumber: 5; The declaration for the entity "ContentType" must end with '>'.
Message: The declaration for the entity "ContentType" must end with '>'.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1236)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:430)
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.data.BaseFeed.parseAtom(Unknown Source)
at com.google.gdata.data.BaseFeed.readFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at com.google.gdata.client.GoogleService.getFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at sample.calendar.TestCalendarFeed.printAllEvents(TestCalendarFeed.java:116)
at sample.calendar.TestCalendarFeed.main(TestCalendarFeed.java:472)
The server had a problem handling your request.
com.google.gdata.util.ParseException: org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.01//EN; systemId: http://www.w3.org/TR/html4/strict.dtd; lineNumber: 81; columnNumber: 5; The declaration for the entity "ContentType" must end with '>'.
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.util.XmlParser.parse(Unknown Source)
at com.google.gdata.data.BaseFeed.parseAtom(Unknown Source)
at com.google.gdata.data.BaseFeed.readFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at com.google.gdata.client.GoogleService.getFeed(Unknown Source)
at com.google.gdata.client.Service.getFeed(Unknown Source)
at sample.calendar.TestCalendarFeed.printAllEvents(TestCalendarFeed.java:116)
at sample.calendar.TestCalendarFeed.main(TestCalendarFeed.java:472)
Caused by: org.xml.sax.SAXParseExceptionpublicId: -//W3C//DTD HTML 4.01//EN; systemId: http://www.w3.org/TR/html4/strict.dtd; lineNumber: 81; columnNumber: 5; The declaration for the entity "ContentType" must end with '>'.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1236)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:430)
... 9 more
I am not sure what the error is, could you please check and let me know where i am going wrong?
I tried using other calendars , like my private calendar to check if it is the problem with the calendar URL, but even then i am getting the same issue.
I also tried using CalendarFeed class instead of CalendarEventFeed, still i am getting the same issue.
Your feed url does not point to GData content. https://www.google.com/calendar/b/0/embed?showTitle=0&height=600&wkst=1&bgcolor=%23FFFFFF&src=regreform%40aba.com&color=%23182C57&src=7vccf8rlid30a0v4m1004atiqg%40group.calendar.google.com&color=%23125A12&src=3rpabc5qjf34l49ho337qh9m04%40group.calendar.google.com&color=%23691426&ctz=America%2FNew_York is an html web page rather than an xml feed. In any case, GData is deprecated and should not be used (will be shut down in November this year). Try taking a look into reading this calendar through API v3 (https://developers.google.com/google-apps/calendar).
Related
I am trying to decode image from base64 to byte array and load into S3 bucket. Bellow is my code,
byte[] imagecontent = Base64.decodeBase64(IMMAGE_CONTENT);
if(imagecontent .length>0) {
input = new ByteArrayInputStream(screenshot);
String file_name = "img_SOME_LOGIC.jpg";
conn.putObject( this.bucketname, file_name, input, new ObjectMetadata());
}
Above code is working fine for text documents. meaning reading text file and uploading. However above is not working for image.
Following is the error i got,
com.amazonaws.AmazonClientException: Unable to unmarshall error response (The declaration for the entity "ContentType" must end with '>'.)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:532)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:283)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:168)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2555)
at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1044)
at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:928)
Can you please help me ?
UPDATED:
[Fatal Error] strict.dtd:81:5: The declaration for the entity "ContentType" must end with '>'.
97943 [Thread-62-s3store-executor[20 20]] ERROR c.a.h.AmazonHttpClient - Unable to unmarshall error response (The declaration for the entity "ContentType" must end with '>'.)
org.xml.sax.SAXParseException: The declaration for the entity "ContentType" must end with '>'.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) ~[?:1.8.0_112]
at com.amazonaws.util.XpathUtils.documentFrom(XpathUtils.java:67) ~[aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.services.s3.internal.S3ErrorResponseHandler.handle(S3ErrorResponseHandler.java:63) ~[aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.services.s3.internal.S3ErrorResponseHandler.handle(S3ErrorResponseHandler.java:38) ~[aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:516) [aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:283) [aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:168) [aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2555) [aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1044) [aws-java-sdk-1.2.15.jar:?]
at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:928) [aws-java-sdk-1.2.15.jar:?]
at com.bgt.aggregation.bolt.s3bolt.execute(s3bolt.java:171) [classes/:?]
at org.apache.storm.daemon.executor$fn__5044$tuple_action_fn__5046.invoke(executor.clj:727) [storm-core-1.1.0.jar:1.1.0]
at org.apache.storm.daemon.executor$mk_task_receiver$fn__4965.invoke(executor.clj:459) [storm-core-1.1.0.jar:1.1.0]
at org.apache.storm.disruptor$clojure_handler$reify__4480.onEvent(disruptor.clj:40) [storm-core-1.1.0.jar:1.1.0]
at org.apache.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:472) [storm-core-1.1.0.jar:1.1.0]
at org.apache.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:451) [storm-core-1.1.0.jar:1.1.0]
at org.apache.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:73) [storm-core-1.1.0.jar:1.1.0]
at org.apache.storm.daemon.executor$fn__5044$fn__5057$fn__5110.invoke(executor.clj:846) [storm-core-1.1.0.jar:1.1.0]
at org.apache.storm.util$async_loop$fn__557.invoke(util.clj:484) [storm-core-1.1.0.jar:1.1.0]
at clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0.jar:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_112]
You can try using HTTPS instead of HTTP. AWS Client seems to be having issues with HTTP.
Our application was working fine suddenly a strange exception throws from the opentok while trying to create the session.
Could you please suggest us to, what has to be done to avoid this exception?
Exception details are given below:
Caused by: com.opentok.exception.OpenTokException:
org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>". at
com.opentok.util.TokBoxXML.<init>(TokBoxXML.java:27) at
com.opentok.api.OpenTokSDK.do_request(OpenTokSDK.java:201) at
com.opentok.api.OpenTokSDK.create_session(OpenTokSDK.java:182) at
com.opentok.api.OpenTokSDK.create_session(OpenTokSDK.java:150) at
com.opentok.api.OpenTokSDK$create_session.call(Unknown Source) at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at
com.opentok.api.OpenTokSDK$create_session.call(Unknown Source)
Thanks in advance.
Why am I getting this error:
ERROR: 'Namespace for prefix 'xsi' has not been declared.'
Here is my Java code:
package com.emp.ma.jbl.nsnhlrspmlpl.nsnhlrspmlpl.internal.action;
import com.emp.ma.util.xml.XMLDocument;
import com.emp.ma.util.xml.XMLDocumentBuilder;
public class yay {
public static void main(String[] args) {
XMLDocument xmldoc = XMLDocumentBuilder.newDocument().addRoot("spml:modifyRequest");
xmldoc.gotoRoot().addTag("modification").addText("");
xmldoc.gotoChild("modification").addTag("valueObject").addText("");
xmldoc.gotoChild("valueObject").addAttribute("xsi:type","halo");
System.out.println(xmldoc);
}
}
This code was functioning properly until I tried throwing transformer exception whilst converting XML file to HTML for experimenting only.
I need to create an xml file with the format:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<spml:modifyRequest>
<modification>
<valueObject xsi:type="halo">
</valueObject>
</modification>
</spml:modifyRequest>
I removed the transformer part from the code already and yet I'm getting this error in eclipse:
ERROR: 'Namespace for prefix 'xsi' has not been declared.'
Exception in thread "main" com.emp.ma.util.xml.XMLDocumentException: java.lang.RuntimeException: Namespace for prefix 'xsi' has not been declared.
at com.emp.ma.util.xml.XMLDocumentImpl.toResult(XMLDocumentImpl.java:1244)
at com.emp.ma.util.xml.XMLDocumentImpl.toStream(XMLDocumentImpl.java:1314)
at com.emp.ma.util.xml.XMLDocumentImpl.toString(XMLDocumentImpl.java:1336)
at com.emp.ma.util.xml.XMLDocumentImpl.toString(XMLDocumentImpl.java:1325)
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.emp.ma.util.xml.XMLDocumentBuilder$XMLDocumentHandler.invoke(XMLDocumentBuilder.java:55)
at $Proxy1.toString(Unknown Source)
at java.lang.String.valueOf(Unknown Source)
at java.io.PrintStream.println(Unknown Source)
at com.emp.ma.jbl.nsnhlrspmlpl.nsnhlrspmlpl.internal.action.yay.main(yay.java:13)
Caused by: javax.xml.transform.TransformerException: java.lang.RuntimeException: Namespace for prefix 'xsi' has not been declared.
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.emp.ma.util.xml.XMLDocumentImpl.toResult(XMLDocumentImpl.java:1242)
... 12 more
Caused by: java.lang.RuntimeException: Namespace for prefix 'xsi' has not been declared.
at com.sun.org.apache.xml.internal.serializer.SerializerBase.getNamespaceURI(Unknown Source)
at com.sun.org.apache.xml.internal.serializer.SerializerBase.addAttribute(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source)
... 15 more
I'm stuck because of this one exception and I don't know how to undo this. Please do help. Like i said, it was functioning properly before trying this experiment of mine, if possible how do I remove this transformer integration. I've tried changing workspace as well -- still not working.
For an XML document to be well-formed, all used namespace prefixes must be declared.
Simply declare the xsi namespace prefix on the root element of your XML,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<spml:modifyRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modification>
<valueObject xsi:type="halo">
</valueObject>
</modification>
</spml:modifyRequest>
and your error will go away.
Note that you'll similarly have to define the spml namespace prefix.
I got the same error "AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server faultSubcode: faultString: java.lang.RuntimeException: Namespace for prefix 'xsi' has not been declared." while calling the soap web service from coldfusion 9 server, as the error does not resolve quickly as I had to spent more time, finnaly found that due to the incorrect date value supplying to the webservice parameters, it throws different issue. Whenever we got this issue please check input values that are supplying to the webservcie parameters. In my case due to the datetime format 2015-03-04T00:00:00.000Z(It's a part of ISO-8601 date representation), issue happened, 2015-03-04 00:00 resolves the issue. For example for datetime If I provide string(xxxx), coldfusion axis webservice shows te irrelevant error --Namespace for prefix 'xsi' has not been declared....
com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException: Invalid JSON-RPC 2.0 response
at com.thetransactioncompany.jsonrpc2.client.JSONRPC2Session.send(JSONRPC2Session.java:586)
at JSON_RPC.Example_2.main(Example_2.java:82)
Caused by: com.thetransactioncompany.jsonrpc2.JSONRPC2ParseException: Invalid JSON
at com.thetransactioncompany.jsonrpc2.JSONRPC2Parser.parseJSONObject(Unknown Source)
at com.thetransactioncompany.jsonrpc2.JSONRPC2Parser.parseJSONRPC2Response(Unknown Source)
at com.thetransactioncompany.jsonrpc2.JSONRPC2Response.parse(Unknown Source)
at com.thetransactioncompany.jsonrpc2.client.JSONRPC2Session.send(JSONRPC2Session.java:579)
... 1 more
My request object is:
{"id":"102","method":"listPath","params":{"token":"8b66666-4f66c-42cf-be45-70f666666c1","path":"/"},"jsonrpc":"2.0"}
And I am getting :
Invalid JSON-RPC 2.0 response
I am using redstone-xmlrpc-1.1.1 api with my code and getting this error:
redstone.xmlrpc.XmlRpcException: The response could not be parsed.
at redstone.xmlrpc.XmlRpcClient.handleResponse(Unknown Source)
at redstone.xmlrpc.XmlRpcClient.endCall(Unknown Source)
at redstone.xmlrpc.XmlRpcClient.invoke(Unknown Source)
at redstone.xmlrpc.XmlRpcProxy.invoke(Unknown Source)
at net.bican.wordpress.$Proxy1.newMediaObject(Unknown Source)
at net.bican.wordpress.Wordpress.newMediaObject(Wordpress.java:582)
at WordpressPost.DataWordpressPost.DataPost(DataWordpressPost.java:53)
at arrestcentral.ArrestData.readPdf(ArrestData.java:420)
at arrestcentral.ArrestData.main(ArrestData.java:447)
Caused by: java.io.FileNotFoundException: http://www.arrestcentral.com/XMLrpc.php?
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1478)
... 9 more
can anyone help me why I am unable to post on wordpress..
Well, the exception tells you what's happened - you've tried to fetch a URL of
http://www.arrestcentral.com/XMLrpc.php?
... and it was giving you an HTTP 404 (not found) error. You probably need to change the URL, but you should have more idea of what that URL should be than we do.
java.io.FileNotFoundException: http://www.arrestcentral.com/XMLrpc.php? should have given you a clue:
Nothing was found at the URL you specified. This means that the server returned a HTTP response with the error code 404.
You either mistyped the URL or it no longer exists (at this location).