error while sendin http PUt to creat a new page in xwiki with REST api

317 views Asked by At

i want to send a page to xwiki with

$ curl -u Admin:admin -X PUT --data-binary "@newPage.xml" -H "Content-Type: application/xml" http://localhost:8082/xwiki/rest/wikis/xwiki/spaces/Main/pages/NewPage

my xml page is like that:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page xmlns="http://www.xwiki.org"> 
    <title>Hello world</title>
    <syntax>xwiki/2.0</syntax>
    <content>This is a new page</content></page>

but this commands return a huge code error ,anyone knows thye reason why , just for information sending just the content work without problem

error:

org.restlet.ext.jaxrs.internal.exceptions.ConvertRepresentationException:   Could not convert the message body to a org.xwiki.rest.model.jaxb.Page at org.restlet.ext.jaxrs.internal.exceptions.ConvertRepresentationExcept ion.object(ConvertRepresentationException.java:58)at org.restlet.ext.jaxrs.internal.wrappers.params.EntityGetter.getValue(EntityGetter.java:115)at org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList.get(ParameterList.java:1090)at org.restlet.ext.jaxrs.internal.wrappers.AbstractMethodWrapper.internalInvoke(AbstractMethodWrapper.java:169)at org.restlet.ext.jaxrs.internal.wrappers.ResourceMethod.invoke(ResourceMethod.java:291)at org.restlet.ext.jaxrs.JaxRsRestlet.invokeMethod(JaxRsRestlet.java:1043)
    at org.restlet.ext.jaxrs.JaxRsRestlet.handle(JaxRsRestlet.java:792)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Router.doHandle(Router.java:500)
    at org.restlet.routing.Router.handle(Router.java:740)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:154)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
    at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:75)
    at org.restlet.Application.handle(Application.java:391)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Router.doHandle(Router.java:500)
    at org.restlet.routing.Router.handle(Router.java:740)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.routing.Router.doHandle(Router.java:500)
    at org.restlet.routing.Router.handle(Router.java:740)
    at org.restlet.routing.Filter.doHandle(Filter.java:159)
    at org.restlet.routing.Filter.handle(Filter.java:206)
    at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
    at org.restlet.Component.handle(Component.java:391)
    at org.restlet.Server.handle(Server.java:491)
    at org.restlet.engine.ServerHelper.handle(ServerHelper.java:74)
    at org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:153)
    at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1031)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1667)
    at org.xwiki.wysiwyg.server.filter.XWikiContextInitializationFilter.doFilter(XWikiContextInitializationFilter.java:85)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:66)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:137)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:497)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
    at java.lang.Thread.run(Unknown Source)Caused by: java.io.IOException: Could not unmarshal to org.xwiki.rest.model.jaxb.Page
    at org.restlet.ext.jaxrs.internal.provider.JaxbProvider.readFrom(JaxbProvider.java:197)
    at org.restlet.ext.jaxrs.internal.wrappers.provider.SingletonProvider.readFrom(SingletonProvider.java:304)
    at org.restlet.ext.jaxrs.internal.wrappers.params.EntityGetter.getValue(EntityGetter.java:109)
    ... 75 more

thanks everyone

1

There are 1 answers

4
Med braim On

finally done with

$ curl -X PUT -u admin:admin -T "@newPage.xml" -H "Content-Type: application/xml" http://localhost:8080/xwiki/rest/wikis/xwiki/ spaces/Main/pages/newpPage