I'm trying to create a Podcast RSS feed using WCF. The feed seems to be valid, but the enclosure tag is being ignored. Any ideas?
Fixed now ... don't use file file:/// urls even if you are feeding yourself the files.
<rss version="2.0">
<channel>
<title>Joe Blow</title>
<link>http://google.com/</link>
<description>The Joe Blow Show</description>
<managingEditor>joeblow#gmail.com</managingEditor>
<category>Talk Radio</category>
<item>
<guid isPermaLink="false">1342</guid>
<category>Podcast</category>
<title>Joe Blow Show #1</title>
<description>Joe Blow Show #1</description>
<pubDate>Mon, 01 Jun 2009 13:57:47 -0600</pubDate>
<enclosure url="file:///C:/JoeBlowShow1.mp3" type="audio/mpeg" length="101725855" />
</item>
</channel>
</rss>
Two things:
The enclosure should not be stored on your hard drive. This should be a world accessible URL. (This assumes that you are publishing this on the web.)
Run the feed through a feed validator to look for errors.
Related
I have this template from a bank that is used to make payments on bank account transfers.
See xml below. I have included the sample data that has to be entered when sending the file to the bank.
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CstmrCdtTrfInitn>
<GrpHdr>
<MsgId>Cart Urgent28052018_57894</MsgId>
<CreDtTm>2018-06-29T11:52:23</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<CtrlSum>667896.00</CtrlSum>
<InitgPty>
<Nm>CART LIMITED</Nm>
<Id>
<OrgId>
<Othr>
<Id>S001234/PJones</Id>
<SchmeNm>
<Cd>CUST</Cd>
</SchmeNm>
</Othr>
</OrgId>
</Id>
</InitgPty>
</GrpHdr>
<PmtInf>
<PmtInfId>Payment for addon development SAP B1</PmtInfId>
<PmtMtd>TRF</PmtMtd>
<BtchBookg>false</BtchBookg>
<NbOfTxs>1</NbOfTxs>
<CtrlSum>667896.00</CtrlSum>
<PmtTpInf>
<InstrPrty>HIGH</InstrPrty>
</PmtTpInf>
<ReqdExctnDt>2018-06-29</ReqdExctnDt>
<Dbtr>
<Nm>CART LIMITED</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<Othr>
<Id>0112345110846</Id>
</Othr>
</Id>
<Ccy>KES</Ccy>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>SBICKENX</BIC>
</FinInstnId>
</DbtrAgt>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>156335578965</EndToEndId>
</PmtId>
<Amt>
<InstdAmt Ccy="KES">667896.00</InstdAmt>
</Amt>
<ChrgBr>DEBT</ChrgBr>
<CdtrAgt>
<FinInstnId>
<BIC>DTKEKENA</BIC>
<ClrSysMmbId>
<MmbId>63000</MmbId>
</ClrSysMmbId>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>EOH SEAL LTD</Nm>
<PstlAdr>
<StrtNm>P.O. Box 10496</StrtNm>
<TwnNm>Nairobi</TwnNm>
<Ctry>KE</Ctry>
<AdrLine>P.O. Box 10496</AdrLine>
<AdrLine>00100 NAIROBI</AdrLine>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<Othr>
<Id>0112406001</Id>
</Othr>
</Id>
</CdtrAcct>
<RmtInf>
<Ustrd>Cart Urgent28052018_57894</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</PmtInf>
</CstmrCdtTrfInitn>
</Document>
The file is quite long as has to be in the format given. The black letters represent the details to be passed to the xml. To test if I understood what data goes where I filled it manually and sent to bank for testing. That is all good now.
I have a SAP addon program that captures details from a form and generates a list. Each payment must follow this structure.
Looking at the below:
<Nm>CART LIMITED</Nm>
<Id>
<OrgId>
<Othr>
<Id>S001234/PJones</Id>
<SchmeNm>
<Cd>CUST</Cd>
</SchmeNm>
</Othr>
</OrgId>
</Id>
Is creating a class with all properties according to the template the best way to create the xml needed.
How do I stagger the
<Id>
<OrgId>
<Othr>
as in the case above?
Also the <CtrlSum>667896.00</CtrlSum> is found in the group header and payment info tags. How do I deal with this?
For what i see, the problem is you have a addon in SAP to specify multiple payments methods, but in the XML template given from the bank you don't the structure for multiple payments, so you need to get this information to know how can you work with it.
when you have this information you can use a better XML template with VS or another tool to generate the correct class to work with the XML
Below is my result from web service, how can I change the record name so that it's uniquely identified? e.g. Record1, Record2, Record3.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ArrayOfRecord xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Record> /*How to change this Record to Record1*/
<item>
Buffalo DriveStation Combo 3.5 inch External Hard Drive USB 2.0 1.5TB Quadra
</item>
<qty>1</qty>
<qtyapproved>1</qtyapproved>
<availability>0</availability>
<description>Returned</description>
<itemdescription>-</itemdescription>
<id>188</id>
</Record>
<Record>
<item>eSataII HDD Docking with 1TB 3.5 inch hard disk</item>
<qty>1</qty>
<qtyapproved>1</qtyapproved>
<availability>0</availability>
<description>Returned</description>
<itemdescription/>
<id>184</id>
</Record>
</ArrayOfRecord>
Instead of changing the record name include a unique column in the resultset being returned by the web service, you can use a sequence number if you do not have any unique column.
For example you can add itemId a new column in Record
<Record> /*How to change this Record to Record1*/
<itemId>1</itemId>
<item>
Buffalo DriveStation Combo 3.5 inch External Hard Drive USB 2.0 1.5TB Quadra
</item>
<qty>1</qty>
<qtyapproved>1</qtyapproved>
<availability>0</availability>
<description>Returned</description>
<itemdescription>-</itemdescription>
<id>188</id>
</Record>
I am trying to create an program that automatically creates iTunes Podcast RSS feeds. The problem I am running into is I dont know how to create the require XML elements. I tried to create two tags here in two different ways. First I used "itunes:" for subtitle and it doesnt work it throws an exception that I cant use the colon in my name. The second one (image) outputs this
<image xmlns="http://www.itunes.com/dtds/podcast-1.0.dtd" href="http://someurkl.com/myimgp.png"/>
Is there any way to get this to work with ASP.net? Or can you point me the right direction of documentation or a tutorial that can show me how to create a feed for a iTunes podcast.
My Code:
XNamespace itunesNS = "http://www.itunes.com/dtds/podcast-1.0.dtd";
SyndicationFeed feed = new SyndicationFeed(title, description, new Uri(link));
feed.ElementExtensions.Add(new XElement("itunes:" + "subtitle", subTitle).CreateReader());
feed.ElementExtensions.Add(new XElement(itunesNS + "image", new XAttribute("href", imageUrl)).CreateReader());
Format Required By iTunes:
<itunes:subtitle>My Subtitle Here</itunes:subtitle>
Example Feed from Apple:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>All About Everything</title>
<link>http://www.example.com/podcasts/everything/index.html</link>
<language>en-us</language>
<copyright>℗ & © 2005 John Doe & Family</copyright>
<itunes:subtitle>A show about everything</itunes:subtitle>
<itunes:author>John Doe</itunes:author>
<itunes:summary>All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Store</itunes:summary>
<description>All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Store</description>
<itunes:owner>
<itunes:name>John Doe</itunes:name>
<itunes:email>john.doe#example.com</itunes:email>
</itunes:owner>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything.jpg" />
<itunes:category text="Technology">
<itunes:category text="Gadgets"/>
</itunes:category>
<itunes:category text="TV & Film"/>
<item>
<title>Shake Shake Shake Your Spices</title>
<itunes:author>John Doe</itunes:author>
<itunes:subtitle>A short primer on table spices</itunes:subtitle>
<itunes:summary>This week we talk about salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!</itunes:summary>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything/Episode1.jpg" />
<enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a" length="8727310" type="audio/x-m4a" />
<guid>http://example.com/podcasts/archive/aae20050615.m4a</guid>
<pubDate>Wed, 15 Jun 2005 19:00:00 GMT</pubDate>
<itunes:duration>7:04</itunes:duration>
</item>
<item>
<title>Socket Wrench Shootout</title>
<itunes:author>Jane Doe</itunes:author>
<itunes:subtitle>Comparing socket wrenches is fun!</itunes:subtitle>
<itunes:summary>This week we talk about metric vs. old english socket wrenches. Which one is better? Do you really need both? Get all of your answers here.</itunes:summary>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything/Episode2.jpg" />
<enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode2.mp3" length="5650889" type="audio/mpeg" />
<guid>http://example.com/podcasts/archive/aae20050608.mp3</guid>
<pubDate>Wed, 8 Jun 2005 19:00:00 GMT</pubDate>
<itunes:duration>4:34</itunes:duration>
</item>
<item>
<title>Red, Whine, & Blue</title>
<itunes:author>Various</itunes:author>
<itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
<itunes:summary>This week we talk about surviving in a Red state if you are a Blue person. Or vice versa.</itunes:summary>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything/Episode3.jpg" />
<enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode1.mp3" length="4989537" type="audio/mpeg" />
<guid>http://example.com/podcasts/archive/aae20050601.mp3</guid>
<pubDate>Wed, 1 Jun 2005 19:00:00 GMT</pubDate>
<itunes:duration>3:59</itunes:duration>
</item>
</channel>
</rss>
TL;DR
Looks like you need to define a custom namespace for the itunes: tag in the area of your code that generates your rss.
Here is some info originally written by Lukasz Karolak, that might help you.
Let’s assume we would like to have a RSS feed, which in fact would serve as a podcast, e.g. for iTunes. The software from Apple uses some information from their custom-defined RSS-tags, with an itunes prefix, for example:
<itunes:author>Anonymous One</itunes:author>
Without this prefix it’s very easy. Our SyndicationItem class provides us a functionality to extend the standard item’s elements:
SyndicationItem item = new SyndicationItem();
item.ElementExtensions.Add(customTagString.Empty, "My test");
The second attribute is the namespace which comes into play in the next step. In order to add the tag prefix as mentioned before, one has start with adding the namespace to the feed instance:
SyndicationFeed feed = new SyndicationFeed();
XmlQualifiedName n=new XmlQualifiedName("itunes","http://www.w3.org/2000/xmlns/");
String itunesNs = "http://www.itunes.com/dtds/podcast-1.0.dtd";
feed.AttributeExtensions.Add(n, itunesNs);
Now that we have added the new namespace to the feed, we can start adding custom item elements within that namespace.
SyndicationItem item = new SyndicationItem();
item.ElementExtensions.Add(new SyndicationElementExtension("author",
itunesNs, "Famous author"));
That should solve the issue with custom tags with custom prefixes.
I have to send an XML as a SOAP response to a SAP WAS.
SAP is quite fussy with what you are sending (special characters and stuff), and by now I want to exhaust all possibilities.
Is there a way when you make a myXMLDoc.LoadXml
to specify something like "do not shorten tags when empty"?
Usually when you make this:
<item>
<Trkorr>TDEK978887</Trkorr>
<Sequence>0</Sequence>
<Solicit>cggaste</Solicit>
<Type></Type><Id></Id><Number></Number><Message></Message>
</item>
It transforms it to:
<item>
<Trkorr>TDEK978887</Trkorr>
<Sequence>0</Sequence>
<Solicit>cggaste</Solicit>
<Type/><Id/><Number/><Message/>
</item>
Any property I'm missing?
BTW (I don't think it's worth another question, so...)
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Server</faultcode>
<faultstring xml:lang="en">SOAP processing failure, error id = 112</faultstring>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>
This is the error sap's returning.
Thanks in advance!
No, there isn't another way without writing everything yourself.
And even with that done, that's not the problem.
The problem is something on the SAP Server and/or the SAP Parameters you were sending beside those you show.
I'm not sure the end tags are the real problem. Take a look at SAP note 1318784 on how to enable tracing and use this to find out what's behind the error message 112.
I'm trying to do very simple operations on a .cxml file. As you know it's basically an .xml file. This is a sample file I created to test the application:
<?xml version="1.0" encoding="utf-8"?>
<Collection xmlns:p="http://schemas.microsoft.com/livelabs/pivot/collection/2009" SchemaVersion="1.0" Name="Actresses" xmlns="http://schemas.microsoft.com/collection/metadata/2009">
<FacetCategories>
<FacetCategory Name="Nationality" Type="LongString" p:IsFilterVisible="true" p:IsWordWheelVisible="true" p:IsMetaDataVisible="true" />
</FacetCategories>
<!-- Other entries-->
<Items ImgBase="Actresses_files\go144bwo.0ao.xml" HrefBase="http://www.imdb.com/name/">
<Item Id="2" Img="#2" Name="Anna Karina" Href="nm0439344/">
<Description> She is a nice girl</Description>
<Facets>
<Facet Name="Nationality">
<LongString Value="Danish" />
</Facet>
</Facets>
</Item>
</Items>
<!-- Other entries-->
</Collection>
I can't get any functioning simple code like:
XDocument document = XDocument.Parse(e.Result);
foreach (XElement x in document.Descendants("Item"))
{
...
}
The test on a generic xml is working. The cxml file is correctly loaded in document.
While watching the expression:
document.Descendants("Item"), results
the answer is:
Empty "Enumeration yielded no results" string
Any hint on what can be the error? I've also add a quick look to get Descendants of Facet, Facets, etc., but there are no results in the enumeration. This obviously doesn't happen with a generic xml file I used for testing. It's a problem I have with .cxml.
Basically your XML defines a default namespace with the xmlns="http://schemas.microsoft.com/collection/metadata/2009" attribute:
That means you need to fully qualify your Descendants query e.g.:
XDocument document = XDocument.Parse(e.Result);
foreach (XElement x in document.Descendants("{http://schemas.microsoft.com/collection/metadata/2009}Item"))
{
...
}
If you remove the default namespace from the XML your code actually works as-is, but that is not the aim of the exercise.
See Metadata.CXML project under http://github.com/Zoomicon/Metadata.CXML sourcecode for LINQ-based parsing of CXML files.
Also see ClipFlair.Metadata project at http://github.com/Zoomicon/ClipFlair.Metadata for parsing one's CXML custom facets too
BTW, at http://ClipFlair.codeplex.com can checkout the ClipFlair.Gallery project for how to author ASP.net web-based forms to edit metadata fragments (parts of CXML files) and merge them together in a single one (that you then convert periodically to DeepZoom CXML with PAuthor tool from http://pauthor.codeplex.com).
If anyone is interested in doing nesting (hierarchy) of CXML collections see
http://github.com/Zoomicon/Trafilm.Metadata
and
http://github.com/Zoomicon/Trafilm.Gallery