AnsweredAssumed Answered

Invoking Project Creation with WSDL-generated Java classes

Question asked by djudju on Jan 19, 2009
Latest reply on Mar 18, 2012 by LalitSethi
Hello,  I'm working on Clarity 8.1 FP02 Hotfix. My objective : create a project in Clarity through a web service call with a Java client.  Thanks to the integration documentation, I generated a proxy API with axis for this WSDL document : http:// /niku/WSDL/Object/Projects After generating my .class and packaging them into a jar file named xoglient.jar, I started to develop my Java Client.Generated classes : Auth.java, Login.java, Logout.java, NikuDataBus.java, ProjectsPort.java, ProjectsService.java, ProjectsServiceLocator.java, ProjectsSoapBindingStub.java, XOGOutput.java This client connects to XOG webservice through the following URL ( http:// /niku/xog ), then it uses a XML input file to create a project. Note : I tested with the Clarity XOG client my XML input file, it works.  xml File writeProject.xml    
managerResourceID="admin"


pageLayoutCode="projmgr.projectPageFrame" priority="0" program="false"
name="Test"
projectID="Test" start="2008-01-01T00:00:00"
status="0" statusIndicator="1"
template="false">

deliverable      Source code of my Java Client , which calls the webservice :   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();


DocumentBuilder builder = factory.newDocumentBuilder();


String fileName = "http://localhost/niku/lectra/wsfiles/xog/writeProject.xml";


URL xml = new URL(fileName);


URLConnection connection = xml.openConnection();


connection.setDoOutput(false);


Document document =
builder.parse(xml.openStream());


/* Building soap envelope*/


MessageElement[] messageElement = new MessageElement[1];


if (document == null) {



messageElement[0] = new MessageElement("", "Empty");


} else if (document.getDocumentElement() == null) {



messageElement[0] = new MessageElement(document





.createElement("Empty"));


} else {



messageElement[0] = new MessageElement(document





.getDocumentElement());


}


/* creating nikudatabus with the input XML file */


NikuDataBus input = new NikuDataBus(messageElement);


/* connection to web service*/


ProjectsServiceLocator service = new ProjectsServiceLocator();


service.setProjectsServiceEndpointAddress("http://localhost/niku/xog");


com.niku. www.xog.Object.Auth auth = new com.niku. www.xog.Object.Auth (




sessionId, null, null);


ProjectsPort serv = service.getProjectsService();


/* Creation of the project through the web service */


XOGOutput output = serv.writeProject(input, auth);


System.out.println(output.get_any());   Result :  - the XML file is found by the client- the client connects to the XOG webservice   - the project is not created  - errors appears in app-niku.log :   ERROR 2009-01-19 07:39:31,679 [http-80-Processor6] niku.xog (admin:5007821__6f3aa631:none) Exception occurred while processing client request com.niku.xog.XOGException: The specified Action in the ActionObject root element is invalid (Read/Write).
at com.niku.xog.service.AbstractObjectHandler.process(AbstractObjectHandler.java:183)
at com.niku.xog.service.XOGDispatch.processMessage(XOGDispatch.java:114)
at com.niku.xog.service.XOGSOAPServlet.processMessage(XOGSOAPServlet.java:265)
at com.niku.xog.service.XOGSOAPServlet.doPost(XOGSOAPServlet.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.lectra.wlp.fade.HlabFilter.doFilter(HlabFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.niku.union.web.filter.CharsetFilter.doFilter(CharsetFilter.java:29)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)    I tried to change the content of my XML file => no impact on the error...  Can somebody help me? Thank you.

Outcomes