CakePHP - XML helper issue - cakephp

I'm trying to spit out XML from an array.
So it almost work except that now I'm seeing this error "Resource interpreted as document but transferred with MIME type application/xml."
When I look at the source, what is being printed is
<?xml version="1.0" encoding="UTF-8" ?>
<response>
...
</response>
<?xml version="1.0" encoding="utf-8" ?>
How do I get rid of that second
<?xml version="1.0" encoding="utf-8" ?>
Seems like that automatically gets added.
This is the url I have constructed /services/config.xml
Thanks,
Tee

Your view template should be located in the xml subfolder
/app/views/services/xml/config.ctp
The xml tag <?xml version="1.0" encoding="utf-8" ?> is then automatically rendered by the cake framework, so you should NOT have this tag in you config.ctp template. All you need to do is render your <response></response>.
Also, your services controller should render the content type HTTP header in the afterFilter:
function afterFilter()
{
$this->header('Content-Type: application/xml');
}
Good luck!

Related

Tika - omitting specific mime-type

Is there a way to configure Tika to ommit one of default mime type? Considering I don't want use custom tika-mimetypes.xml
I have tried following configuration file but the excluded mime is still being used.
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<parsers>
<parser class="org.apache.tika.parser.DefaultParser">
<mime-exclude>message/rfc822</mime-exclude>
</parser>
<parser class="org.apache.tika.parser.EmptyParser">
<mime>message/rfc822</mime>
</parser>
</parsers>
<detectors>
<detector class="org.apache.tika.detect.DefaultDetector">
<mime-exclude>message/rfc822</mime-exclude>
</detector>
</detectors>
</properties>

Download twilio record in my dataBase #10

I used the "action" option of twiML to send the recording of a call to my application and add the url and the text of call in my database
but it doesn't work
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial record="true" > +######## </Dial> <Record method="POST" action="http://myapp.com/phone_call/speech.php" timeout="10" /> </Response>
There are a number of different ways to record a call, which I assume is what you are trying to do.
You want to use the Record attribute (and associated recordingStatusCallback) of the Dial Verb. The TwiML Record verb is used for recording voice mails, as an example.
TwiML™ Voice:
Recording Incoming Twilio Voice Calls
Done :)
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial record="true" recordingStatusCallback="https://myapp.com/call/speech.php"
recordingStatusCallbackEvent="completed" >
+##########
</Dial>
</Response>

cvc-complex-type.3.2.2: Attribute 'exceptionType' is not allowed to appear in element 'throwException'

I am trying to throw exception on camel. I am on version 2.2.170.redhat-000013. When I use below code in spring DSL
<throwException id="_throwException1" exceptionType="org.mycompany.MyException" message="Test Exception"/>
Gives
Multiple annotations found at this line:
- cvc-complex-type.4: Attribute 'ref' must appear on element 'throwException'.
- cvc-complex-type.3.2.2: Attribute 'exceptionType' is not allowed to appear in element
'throwException'.
- cvc-complex-type.3.2.2: Attribute 'message' is not allowed to appear in element
'throwException'.
Schema location in my project is as below
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd" >
throwException syntax should work as per documentation, please help to find mistake.

Google CALDAV ignoring filter options

Is there any documentation why does the google caldav api ignores this request.
<?xml version="1.0" encoding="UTF-8"?>
<C:calendar-query xmlns:d="DAV:"
xmlns:C="urn:ietf:params:xml:ns:caldav"
xmlns:A="http:/ /apple.com/ns/ical/">
<d:prop>
<d:getetag/>
<C:calendar-data/>
</d:prop>
<C:filter>
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VEVENT">
<C:prop-filter name="UID">
<C:text-match collation="i;octet">xxxxxxxxxxxx</C:text-match>
</C:prop-filter>
</C:comp-filter>
</C:comp-filter>
</C:filter>
</C:calendar-query>
It returns every event but it should return only the one i requested in the filter.
I can only filter the events with
<C:time-range start="20160326T230000Z" end="20160430T220000Z"/>
but everything else is just ignored.
I find another solution to get only one event by uid with caldav api google.
I use href url of the event like $href="https://apidata.googleusercontent.com/caldav/v2/IDCalendar/events/**uid.**ics
And i query with :
<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-multiget xmlns="DAV:"mlns:C="urn:ietf:params:xml:ns:caldav">
<prop><getetag/><C:calendar-data/></prop>
<href>$href</href>
</C:calendar-multiget>
and i get only the event with UID :) .
Dam
but Google CalDAV supports calendar-multiget, where you can use same url pattern
https://icalendar.org/CalDAV-Access-RFC-4791/7-9-caldav-calendar-multiget-report.html
Example:
<?xml version='1.0' encoding='utf-8'?>
<C:calendar-multiget xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:CS="http://calendarserver.org/ns/" xmlns:D="DAV" xmlns:I="http://apple.com/ns/ical/">
<ns0:prop xmlns:ns0="DAV:">
<ns0:getetag/>
<C:calendar-data/>
</ns0:prop>
<ns0:href xmlns:ns0="DAV:">/caldav/v2/[calendar_id]/events/[UID]</ns0:href>
</C:calendar-multiget>
with response
<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:" xmlns:caldav="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:ical="http://apple.com/ns/ical/">
<D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">
<D:href>/caldav/v2/[calendarID]/events/[UID]</D:href>
<D:propstat>
<D:status>HTTP/1.1 200 OK</D:status>
<D:prop>
<D:getetag>"63701474571"</D:getetag>
<caldav:calendar-data>BEGIN:VCALENDAR
.....
</caldav:calendar-data>
</D:prop>
</D:propstat>
</D:response>
</D:multistatus>

KML & Google maps error

I've created a program in Java to create a KML file. The output is this:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Placemark>
<name>Evidence File</name>
<description>London</description>
<Point>
<coordinates>51.522416,-0.131836,0<coordinates>
</Point>
</Placemark>
</kml>
However, when I import it into Google maps - I have the error:
We could not finish uploading your file. No changes have been made to
the map.
Can anyone see any errors that I'm missing?
You're closing coordinates tag is missing a '/', i.e. it should be:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Placemark>
<name>Evidence File</name>
<description>London</description>
<Point>
<coordinates>51.522416,-0.131836,0</coordinates>
</Point>
</Placemark>
</kml>

Resources