12-12-2011 02:20 AM - edited 12-12-2011 03:25 AM
Hi,
I am trying to execute a script on a device using Junos rest api "/api/space/script-management/scripts/exec-deploy"
For this I created a queue as this is a asynchronus call. My JSON input for this is as below:
{"exec-deply":[{"scriptMgmt": {"script":{"@href":"/api/space/script-management/s
Script Id and Device Id already exists in the system. When I try to execute POST request on this API, I get message as below:
message javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"exec-deploy"). Expected elements are <{}scriptMgmt>,<{}scriptMgmts>,<{}scriptParam>
description The request sent by the client was syntactically incorrect (javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"exec-deploy"). Expected elements are <{}scriptMgmt>,<{}scriptMgmts>,<{}scriptParam>).
It seems the request parameter has some problems. I used the JSON input as per given in Junos Space SDK help.
Please help to resolve this issue.
Thanks
12-13-2011 01:00 AM
Hi Satish,
We recommend using Space SDK 11.3 version. Can you please test the same and let me know are you still facing the issue.
Regards,
Vimala.
12-13-2011 01:06 AM
Hi Vimala,
I tried this using Junos Space 11.3 also, but I am getting the same error.
Thanks,
Satish
12-14-2011 10:49 PM
Hi Satish,
There is spell error in your input which you have specified. You have given "exec-deply" it should be "exec-deploy".
{"exec-deploy":[{"scriptMgmt":
{"script":{"@href":"/api/space/script-management/
"scriptVersionSelected":"1.1", "device":{"@href":"/api/space/device-management/de
"scriptParams": [{"scriptParam":{"paramName":"test","paramValue":"
Regards,
Vimala.
12-14-2011 11:20 PM
Hi Vimala,
I checked my script again, and there is no mistake in script. There might be typo error while putting it in forum.
My script contents are :
{"exec-deploy":[{"scriptMgmt":{"script":{"@href":"
Here is the full log:
configureRouter- Base URL of the Server http://10.5.11.160:8080
2011-12-15 07:13:00,985 DEBUG [vnd.techmjunosteam.vpnconfigurations.rest.v1.VPNC
configureRouter - script content {"exec-deploy":[{"scriptMgmt":{"script":{"@href":"
2011-12-15 07:13:01,040 WARN [org.jboss.resteasy.core.SynchronousDispatcher] (http-0.0.0.0-8080-4
Failed executing POST /scripts/exec-deploy
org.jboss.resteasy.plugins.providers.jaxb.JAXBUnma
- with linked exception:
[javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"exec-deploy"). Expected elements are <{}scriptMgmt>,<{}scriptMgmts>,<{}scriptParam>]
at org.jboss.resteasy.plugins.providers.jaxb.Abstract
at org.jboss.resteasy.core.interception.MessageBodyRe
at org.jboss.resteasy.plugins.interceptors.encoding.G
at org.jboss.resteasy.core.interception.MessageBodyRe
at org.jboss.resteasy.core.messagebody.ReaderUtility.
at org.jboss.resteasy.core.messagebody.ReaderUtility.
at org.jboss.resteasy.core.MessageBodyParameterInject
at org.jboss.resteasy.core.MethodInjectorImpl.injectA
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(
at org.jboss.resteasy.core.ResourceMethod.invokeOnTar
at org.jboss.resteasy.core.ResourceMethod.invoke(Reso
at org.jboss.resteasy.core.ResourceMethod.invoke(Reso
at org.jboss.resteasy.core.SynchronousDispatcher.getR
at org.jboss.resteasy.core.SynchronousDispatcher.invo
at org.jboss.resteasy.core.SynchronousDispatcher.invo
at org.jboss.resteasy.plugins.server.servlet.ServletC
at org.jboss.resteasy.plugins.server.servlet.HttpServ
at org.jboss.resteasy.plugins.server.servlet.HttpServ
at javax.servlet.http.HttpServlet.service(HttpServlet
at org.apache.catalina.core.ApplicationFilterChain.in
at org.apache.catalina.core.ApplicationFilterChain.do
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF
at org.apache.catalina.core.ApplicationFilterChain.in
at org.apache.catalina.core.ApplicationFilterChain.do
at org.apache.catalina.core.StandardWrapperValve.invo
at org.apache.catalina.core.StandardContextValve.invo
at org.jboss.web.tomcat.security.SecurityAssociationV
at org.jboss.web.tomcat.security.JaccContextValve.inv
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke
at org.jboss.web.tomcat.service.jca.CachedConnectionV
at org.jboss.web.tomcat.service.sso.ClusteredSingleSi
at org.apache.catalina.core.StandardEngineValve.invok
at org.apache.catalina.connector.CoyoteAdapter.servic
at org.apache.coyote.http11.Http11Processor.process(H
at org.apache.coyote.http11.Http11Protocol$Http11Conn
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(
at java.lang.Thread.run(Thread.java:619)
Thanks,
Satish
12-14-2011 11:35 PM
Hi Satish,
Send me the complete details. 1) REST URL passed 2) Input passed 3) HTTP Method 4) content-type sepecified.
Regards, Vimala.
12-15-2011 12:31 AM
Hi Vimala,
Here are the complete details
1) REST URL - http://10.5.11.160:8080/api/space/script-managemen
2) Input Passed :
{"exec-deploy":[{"scriptMgmt":{"script":{"@href":"
3) HTTP Method : POST
4) Content-Type: "application/vnd.net.juniper.space.script-manageme
Thanks,
Satish
12-15-2011 12:33 AM
Hi Satish,
This is version 2 API and your are using version 1. Modify it to version 2 and execute.
Regards,
Vimala.
12-15-2011 12:53 AM
Hi Vimala,
As I am refering to API's in the eclipse help, API version for /api/space/script-management/scripts POST method is version 1 and API version for /api/space/script-management/scripts/exec-deploy POST method is version 2. If I go with this, then I get version mismatch error. Hence I used version 1 for deploy as well.
Thanks,
Satish
12-15-2011 10:17 PM
Hi Satish,
As discussed in the call yesteraday the input varies from version 1 to version 2. Pl. refer to the documentation and ensure you use the exact input XML format.
Regards,
vimala.