RickStrahl / MarkdownMonster

An extensible Markdown Editor, Viewer and Weblog Publisher for Windows
https://markdownmonster.west-wind.com
Other
1.59k stars 236 forks source link

Error when posting via Weblog API #7

Closed weggetor closed 8 years ago

weggetor commented 8 years ago

2016-06-09_10-56-41

09.06.2016 10:56:11 - Server returned a fault exception: [0] request contains int value where string expected [request : parameter 1]

CookComputing.XmlRpcV2
   bei CookComputing.XmlRpc.XmlRpcResponseDeserializer.DeserializeFault(IEnumerator`1 iter)
   bei CookComputing.XmlRpc.XmlRpcResponseDeserializer.DeserializeResponse(XmlReader rdr, Type returnType)
   bei CookComputing.XmlRpc.XmlRpcClientProtocol.ReadResponse(XmlRpcRequest req, WebResponse webResp, Stream respStm)
   bei CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, MethodInfo mi, Object[] parameters)
   bei XmlRpcProxy1e78ecc9-3c84-4ab5-9d36-d10a88f47fe9.NewMediaObject(Int32 blogId, String username, String password, XmlRpcMediaObject mediaObject)
   bei JoeBlogs.MetaWeblogWrapper.NewMediaObject(MediaObject mediaObject)
   bei WeblogAddin.WebLogAddin.SendImages(String html, String filename, MetaWeblogWrapper wrapper)
   bei WeblogAddin.WebLogAddin.SendPost(WeblogTypes type)
   bei WeblogAddin.WebLogForm.<>c__DisplayClass7_0.<ButtonPostBlog_Click>b__0()
   bei System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
   bei System.Windows.Threading.DispatcherOperation.InvokeImpl()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei WeblogAddin.WebLogForm.<ButtonPostBlog_Click>d__7.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
RickStrahl commented 8 years ago

Ah yes, that's a problem with the MetaWebLogApi which doesn't have a fixed type definition for the post ID. The client library I'm using is using int for the post ID. I played around with switching to string, but then other blogs were breaking. I have to take a look and see how this could be resolved with a non-specific type.

What engine are you publishing to?

RickStrahl commented 8 years ago

Hmmm... also noticing the icons are missing on the buttons in your screen shot. Are the icons showing up in your toolbar?

weggetor commented 8 years ago

Hi Rick. Icons in the toolbar are OK: 2016-06-10_08-55-12 Publishing engine... It's Peter Donkers Blog module for DotNetNuke (see: https://github.com/DNN-Connect/DNN-Blog)

RickStrahl commented 8 years ago

Looks like they are not using MetaWebLogApi or WordPress but blogMl which is yet another format that's currently not supported.

I'm still looking at finding a library that can handle different engines (which apparently doesn't exist). I may end up writing a library for this stuff but at this point that's not high on the list unfortunately since the most common MetaWebLogApi and Wordpress work.

weggetor commented 8 years ago

Hi Rick. Don't think so because it could be used with windows Live Writer (see: https://github.com/DNN-Connect/DNN-Blog/blob/master/_Documentation/Manual.md#wlw)

RickStrahl commented 8 years ago

Yes, but Live Writer supports BlogMl if I recall.

weggetor commented 8 years ago

I asked Peter, he is using MetaWebLog API (see:https://github.com/DNN-Connect/DNN-Blog/tree/master/Components/Services/WLW). He implemented BlogML too but only for importing / exporting blog posts.

RickStrahl commented 8 years ago

Thanks Torsten. I'll look at it and see if I can figure out a way so post uploads can work with string and int postids. So much for a spec that's clear :-) Heck there's no real spec that I can even find anywhere just implementations which vary between the two.

You don't by chance have the ability to set up a test account in your DNN setup?

weggetor commented 8 years ago

Hi Rick, I set up a demo DNN website with blog module on http://demo.indisoftware.de. The MetaWeblog URL is: http://demo.indisoftware.de/DesktopModules/Blog/BlogPost.ashx?portalid=0&tabid=59&moduleid=414 , user / pw is horst / dnnhorst . Please let me know when you finished testing so that I can delete this instance

RickStrahl commented 8 years ago

Awesome - thanks Torsten - appreciate it. One less thing to set up for me... Aloha.

RickStrahl commented 8 years ago

... and we have lift off :-)

So the issue was indeed the silly typing of the blog and post ids. I changed the API to use object and default to strings now, which works with the three things I've tested with so far:

The wrapper lib I've been using was using ints for everything and while that's legal, it is likely to cause problems because most MetaWebLogApi implementations either use strings or object with an expectation of strings.

Can you give it a try with v0.30 (just uploaded). It worked for this: http://demo.indisoftware.de/Home/Post/192

Thanks for making the link avalaible. If you don't mind leave it running for a little while longer. There are a few more things to figure out. You may have to configure the Blog ID explicitly (it defaults to 1 which is probably fine).

weggetor commented 8 years ago

Hi Rick, wanted to update but could not find version 0.30 (neither me nor your software). 2016-06-11_21-57-59 2016-06-11_21-58-18

RickStrahl commented 8 years ago

Not sure why that wouldn't work. From what I can tell the download links are all working. Just tried updating from test machine that's still running an older version and it seems to work and the installer is launched.

Does it seem like the download is working (ie. some delay while the file is downloaded and then it fails)? Maybe check the error log and see whether it's failing on the download or on the file execution when trying to launch the installer.

FWIW, you can also grab it from the download site:.

http://markdownmonster.west-wind.com/download.aspx

and install manually from there.

weggetor commented 8 years ago

Hi Rick, no the error comes immediatly. Seems that it looks on the wrong URL ? I have had a look with fiddler in your xml containing the latest version info. There was no file URL, so this may be the reason ?

weggetor commented 8 years ago

Another thing: I tried now the version 0.30 and it works fine with DNN blog. But only if I give it a blog Url (=1) and a post ID of an existing post. Do I have to create a post first on the website and then fill it with Markdown Monster ? If I leave the PostId field empty I get an error:

Error sending post to Weblog: Server returned a fault exception: [0] Your access to this blog is not permitted. Please check your credentials.

Errorlog shows the following:

CookComputing.XmlRpcV2
   bei CookComputing.XmlRpc.XmlRpcResponseDeserializer.DeserializeFault(IEnumerator`1 iter)
   bei CookComputing.XmlRpc.XmlRpcResponseDeserializer.DeserializeResponse(XmlReader rdr, Type returnType)
   bei CookComputing.XmlRpc.XmlRpcClientProtocol.ReadResponse(XmlRpcRequest req, WebResponse webResp, Stream respStm)
   bei CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, MethodInfo mi, Object[] parameters)
   bei XmlRpcProxy3e8413f0-4d58-4ecc-b7b9-ecee115eaf95.EditPost(String postid, String username, String password, XmlRpcPost post, Boolean publish)
   bei WebLogAddin.MetaWebLogApi.MetaWeblogWrapper.EditPost(Post post, Boolean publish)
   bei WeblogAddin.WebLogAddin.SendPost(WeblogTypes type)
weggetor commented 8 years ago

And another suggestion: In DNN Blog it is possible to add a "Post image" (shown in the list of posts as teaser image and in the post details as header image). Would be nice to define this with MM too because at the moment this image is deleted every time I update the post from MM

RickStrahl commented 8 years ago

Torsten - The blog id is something I'll have to figure out yet - for now you have to set it to match your blog id (which appears is a static 1). I think most sites don't actually use the blog id - the end point determines where the post is going usually.

I can see the same error you are showing when posting a new entry. Appears to be some regression with the changes I made - most likely due to the blogId. Should be an easy fix. I'll keep you posted.

re: Post Image.Not sure how that would work. Does that work with Live Writer? Is it a special meta tag that's used?

I think the issue there is really that the server framework is overwriting the value when you update a post, when it really shouldn't (if it's missing from the client).

RickStrahl commented 8 years ago

Ok, as expected, logic error introduced by the type change in the add-in. Fixed now - you should now be able to post new entries and update again.

v0.31 is up.

FWIW, I just updated several versions using the Check Version feature and had no issues. If you still have problems can you hook up fiddler and send me the relevant HTTP requests for the MM update (right click and Save | Selected Sessions | Text)

weggetor commented 8 years ago

2016-06-12_23-28-56 2016-06-12_23-31-31 2016-06-12_23-32-32

Nope , update does not work for me. See attached Fiddler file 2_Full.txt

RickStrahl commented 8 years ago

Hmmm... it's sending you to the wrong url for sure as it's going the download HTML page. Which means it's probably a config setting that's not set correctly. Can you check the config file and see if you have a InstallerDownloadUrl reference in your settings and remove that key? It shouldn't be there (previous bug). Most likely that's what's pointing at the wrong location.

Goto Tools | Settings then look for that key.

The value shouldn't be in the config and if it is it should be pointing to: http://west-wind.com/files/MarkdownMonsterSetup.exe

The config file should be self-healing if you make a change and save the file is re-written with the correct keys (which should remove that key).

weggetor commented 8 years ago

It's not in there, so maybe the self-healing did the job. Awaiting the next update to check this

RickStrahl commented 8 years ago

So does your posting work with a new post now?

weggetor commented 8 years ago

Yes works perfect! At the moment I'm dealing with the code highlighter themes (DNN Blog is working with SyntaxHighlighter and I need to make it work with your highlight.pack.js - but this is not your business ;-) ). Did you have a thought about the "Post image" - thing ?

RickStrahl commented 8 years ago

I mentioned it above a few responses back. But... can you break out each issue into a separate thread? It'll be easier to track this way.

I'm closing this issue since the posting is working for you now.