script import mail

Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
jllort
Moderator
Moderator
Posts: 9283
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: script import mail

Post by jllort » Fri Apr 21, 2017 6:43 pm

Do you see some error from catalina.log file ?

snowman
Junior Boarder
Junior Boarder
Posts: 33
Joined: Mon Feb 21, 2011 8:32 pm

Re: script import mail

Post by snowman » Sun Apr 23, 2017 6:54 am

I can now confirm that another independent Installation shows the same behavior.

jllort
Moderator
Moderator
Posts: 9283
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: script import mail

Post by jllort » Sun Apr 23, 2017 6:25 pm

That not helps much, I'm asking about catalina.log file, is there some error while you are doing it ? if there's some error, please share with us the catalina.log file to see it.

snowman
Junior Boarder
Junior Boarder
Posts: 33
Joined: Mon Feb 21, 2011 8:32 pm

Re: script import mail

Post by snowman » Sun Apr 30, 2017 10:36 pm

HI,

I am sorry. I did not see your post. I turned on debug in catalina log and got roughly 130kB of messages. There is no ERROR line in it. I do not know what to look for.
Some interesting parts may be:

2017-05-01 00:09:32,429 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.tomcat.util.modeler.BaseModelMBean- preRegister org.apache.coyote.RequestInfo@7671c334 Catalina:type=RequestProcessor,worker="http-bio-0.0.0.0-8080",name=HttpRequest1
2017-05-01 00:09:32,450 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.tomcat.util.http.Parameters- Set query string encoding to null
2017-05-01 00:09:32,451 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.connector.CoyoteAdapter- The variable [uriBC] has value [/OpenKM/services/rest/mail/importEML]
2017-05-01 00:09:32,451 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.connector.CoyoteAdapter- The variable [semicolon] has value [-1]
2017-05-01 00:09:32,451 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.connector.CoyoteAdapter- The variable [enc] has value [ISO-8859-1]
2017-05-01 00:09:32,452 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.authenticator.AuthenticatorBase- Security checking request POST /OpenKM/services/rest/mail/importEML
2017-05-01 00:09:32,452 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.realm.RealmBase- No applicable constraints defined
2017-05-01 00:09:32,452 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.authenticator.AuthenticatorBase- Not subject to any constraint
2017-05-01 00:09:32,462 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- loadClass(org.springframework.security.web.firewall.FirewalledResponse, false)
2017-05-01 00:09:32,462 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Searching local repositories
2017-05-01 00:09:32,462 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- findClass(org.springframework.security.web.firewall.FirewalledResponse)
2017-05-01 00:09:32,466 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Loading class from local repository

[ ... there are a lot of Searching local Repositories findClass(...) ... ]

Here it starts with "not found, returning null:

2017-05-01 00:09:32,740 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- getResourceAsStream(org/apache/cxf/transport/https/Messages.properties)
2017-05-01 00:09:32,740 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Searching local repositories
2017-05-01 00:09:32,740 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- findResource(org/apache/cxf/transport/https/Messages.properties)
2017-05-01 00:09:32,741 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- --> Returning 'jar:file:/data/bin/openkm-6.3.3/tomcat/webapps/OpenKM/WEB-INF/lib/cxf-rt-transports-http-2.7.12.jar!/org/apache/cxf/transport/https/Messages.properties'
2017-05-01 00:09:32,741 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- --> Returning stream from local
2017-05-01 00:09:32,751 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- loadClass(org.apache.cxf.transport.https.Messages_de, false)
2017-05-01 00:09:32,751 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Searching local repositories
2017-05-01 00:09:32,751 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- findClass(org.apache.cxf.transport.https.Messages_de)
2017-05-01 00:09:32,751 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Delegating to parent classloader at end: org.apache.catalina.loader.StandardClassLoader@bf4b610
2017-05-01 00:09:32,751 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- getResourceAsStream(org/apache/cxf/transport/https/Messages_de.properties)
2017-05-01 00:09:32,751 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Searching local repositories
2017-05-01 00:09:32,751 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- findResource(org/apache/cxf/transport/https/Messages_de.properties)
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- --> Resource not found, returning null
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Delegating to parent classloader unconditionally org.apache.catalina.loader.StandardClassLoader@bf4b610
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- --> Resource not found, returning null
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- loadClass(org.apache.cxf.transport.https.Messages_de_DE, false)
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Searching local repositories
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- findClass(org.apache.cxf.transport.https.Messages_de_DE)
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Delegating to parent classloader at end: org.apache.catalina.loader.StandardClassLoader@bf4b610
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- getResourceAsStream(org/apache/cxf/transport/https/Messages_de_DE.properties)
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Searching local repositories
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- findResource(org/apache/cxf/transport/https/Messages_de_DE.properties)
2017-05-01 00:09:32,752 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- --> Resource not found, returning null

[... lot of Searching local repositories, it appears to end with: ]

2017-05-01 00:09:32,813 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.catalina.loader.WebappClassLoader- Loading class from local repository
2017-05-01 00:09:32,815 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.coyote.http11.Http11Protocol- Socket: [org.apache.tomcat.util.net.SocketWrapper@3ebee16e:Socket[addr=/127.0.0.1,port=48376,localport=8080]], Status in: [OPEN_READ], State out: [CLOSED]
2017-05-01 00:09:32,816 [http-bio-0.0.0.0-8080-exec-1] DEBUG org.apache.tomcat.util.threads.LimitLatch- Counting down[http-bio-0.0.0.0-8080-exec-1] latch=1

Does this help?

jllort
Moderator
Moderator
Posts: 9283
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: script import mail

Post by jllort » Mon May 01, 2017 7:52 am

Try with xml rather json ( might be there's a bug with json ? ). Use this url as a guide for it http://stackoverflow.com/questions/3007 ... mmand-line

snowman
Junior Boarder
Junior Boarder
Posts: 33
Joined: Mon Feb 21, 2011 8:32 pm

Re: script import mail

Post by snowman » Mon May 01, 2017 9:21 am

OK. I tried.
The -d option of curl does not go together with the -F option. With -d I cannot give the target path. So I guess I have to stick with -F.
Man page says there is difference if you transfer a file using -F content=@file and -F content=<file . I tried both. No success.
Then I applied all plausible mime types as -H "Content-type: XXX/YYY". No success.

As I get a 404 in the curl verbose output. I wonder if something is wrong with either my target path: dstId='/okm:root/test/', which should be the (existing) folder test directly under root. I also tried the UUID of this folder.
Or something is wrong with my url:
http://localhost:8080/OpenKM/services/r ... /importEML

I am stuck.

jllort
Moderator
Moderator
Posts: 9283
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: script import mail

Post by jllort » Wed May 03, 2017 8:21 pm

I have tested and for me it is going right.

Note:
- I have OpenKM in port 8180, you must change to your port
- Execute the command in the same folder you have the file test.eml
- Ensure you are executing OpenKM version 6.3.3 ( in previous version you do not have import mail support )

Code: Select all

curl -u okmAdmin:admin -H "Accept: application/json" -X POST -F dstId=/okm:root/ -F content=@test.eml http://localhost:8180/OpenKM/services/rest/mail/importEml
Attachments
test.eml.zip
(3.6 KiB) Downloaded 4 times

snowman
Junior Boarder
Junior Boarder
Posts: 33
Joined: Mon Feb 21, 2011 8:32 pm

Re: script import mail

Post by snowman » Fri May 05, 2017 9:36 pm

Ok. It works now. The error was trivial. The url ends with ../importEml not importEML ! Oh my.
Thank you for your patient help.

jllort
Moderator
Moderator
Posts: 9283
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: script import mail

Post by jllort » Sat May 06, 2017 3:51 pm

We are working to offering better documentation about REST webservices with some automatic tool for publishing it. Actualy we are working in professional version for it and I hope in nearly future we can release the same for community version. Best documentation of it, sure might helped you.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest