Clarity

  • 1.  Invoking Project Creation with WSDL-generated Java classes

    Posted Jan 18, 2009 09:44 PM
    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.


  • 2.  Re: Invoking Project Creation with WSDL-generated Java classes
    Best Answer

    Posted Jan 18, 2009 10:11 PM
    Shame on me, I found the solution... So when you generate your proxy classes, don't forget to include the -W flag in your command. It's written in Clarity's Integration Guide :    java -classpath .;%AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java -W http://localhost/niku/wsdl/Object/Projects   Important: You must include the –W flag when generating the proxy API from the XOG WSDL definitions. This indicates that the WSDL is of style: document/literal. If you do not include the –W flag, it is assumed that the WSDL is of style: wrapped/ literal, which is incorrect. Omitting the flag will not throw an error in the proxy generation, but the resulting API will cause runtime errors when trying to communicate with the XOG interfaces.  And now it works!!! :smileyvery-happy:


  • 3.  RE: Re: Invoking Project Creation with WSDL-generated Java classes

    Posted Feb 14, 2011 05:14 PM
    Hello,

    I am trying to do something very similar. I have generated the Proxy API using Axis2 WSDL2Java. I could not use option -W. Wondering if it is different with Axis2. I am assuming this jar file should be dropped in the niku/lib folder. What about the client piece? Where should it recide and how do i invoke?

    Too many questions looking for inputs from the experts.

    Thank you,
    Rajani.


  • 4.  RE: Re: Invoking Project Creation with WSDL-generated Java classes

    Posted Feb 15, 2011 02:26 PM
    I figure it out.


  • 5.  RE: Invoking Project Creation with WSDL-generated Java classes

    Posted Mar 18, 2012 05:16 AM
    HI

    Could you please share the code as I have the same set of requirement.