Cmdbuild installation and acquisition of the WebService interface

Source: Internet
Author: User
Tags soap stub apache tomcat wsdl

The recent project group has been used before the Onecmdb has a problem, in addition and deletion to change the data when unusually slow, so consider whether you can optimize the Onecmdb, because I have limited level, the Onecmdb code-level optimization temporarily still a bit difficult. Therefore, the existing open source CMDB research, the first is Cmdbuild (official website).

For Cmdbuild, the first conclusion.

Advantages and Disadvantages
    • Fully Autonomous System configuration
    • The interface is cool and beautiful, Ajax makes it easy to operate.
    • Free customization of data formats (in GLPI, the data format of the asset is already defined and the user is difficult to modify)
    • There is a dedicated team in the ongoing maintenance, the latest version is released in June 2015 2.3.2
    • Built-in workflow engine, you can create workflows
    • Reporting System: Support JasperReports, Alfresco
    • Provides soap and rest-based WebService interfaces
Disadvantages
    • Less information on the Web, very little! Almost only installation of the introduction!
    • The official code sample is almost no, which lets the developer find out for themselves? Or did I not find it?
    • The WebService interface provided is in the form of WSDL and WADL, and cannot be given a jar package?
Installation

Reference:
Http://www.cnblogs.com/supakito/p/cmdbuild_install.html
http://20988902.blog.51cto.com/805922/1541289

Installation Requirements
    • Hardware:
      • Server-class Computer (modern architecture)
      • 4GB of RAM
      • GB of available hard disk space
    • Software:
      • Any OS that supports the following applications (Linux recommended)
      • PostgreSQL 9.0 or higher (PostgreSQL 9.3 recommended)
      • Apache Tomcat 6.0 or higher (as if 7.0 not supported)
      • JDK 1.6
Installation steps
    1. Installation jdk , tomcat (not repeat)
    2. Install PostgreSQL and configure
    3. Will download the good cmdbuild-2.3.2.zip unzip, the file directory as shown,
    4. cmdbuild-2.3.2.warcopy it to the Tomcat WebApps folder and rename it tocmdbuild.war
    5. cmdbuild-2.3.2\extras\tomcat-libs\6.0Copy the below postgresql-9.1-901.jdbc4.jar to the Tomcat Lib folder
    6. Start Tomcat and start parsingcmdbuild.war
    7. After Tomcat is successfully launched, enter the following interface in the Address bar localhost:8080/cmdbuild :
    8. Click Next to enter the next screen
    9. Depending on the configuration, you can test whether the database connection is possible. If there is no error, then you can go to the main interface, cool!

At this point, the installation of Cmdbuild is complete.

Acquisition of the WebService interface

In looking for Cmdbuild interface but a great effort, finally found a little trace in a corner, http://hostname:port/cmdbuild/services/rest/v1 and then in accordance with this address stitching their own get address: http://localhost:8080/cmdbuild/services , so finally found the so-called WebService interface. But soap is in the form of WSDL, and rest is in WADL form. So, thinking about how to wsdl turn the interface into java .

Wsdl2java

With the tools that are available from the JDK, wsimport.exe you can:

wsimport http://127.0.0.1/TicketMobile/services/Cococ?wsdl  com.llg.ws2 -s g:/ws

Parameter description

  • Wsimport this is a must. Name of the tool
  • http://127.0.0.1/TicketMobile/services/Cococ?wsdl WSDL File links
  • -keep whether to generate source files
  • -P COM.LLG.WS2 Java package name after generation
  • -S G:/ws which directory is generated after

So, you can wsdl turn the interface into java , then follow the example of the document on the happy start to knock code ...

There is only such a bit of code on official documents:

//1. Create an instance in the Configurationcontext class and indicate in it where the repository directory is. In the repository directory there is 2 directories:the modules directory which contains the Rampart.mar file, and the CO NF Directory which contains the file to define the safety policy which should is adopted.Configurationcontext configcontext = configurationcontextfactory. Createconfigurationcontextfromfilesystem ("/path/to/repository",//                                                    NULL);////2. Instance the Webservicesstub class moving in it the Configurationcontext just createdWebservicesstub stub =NewWebservicesstub (Configcontext);//3.Set The authentication credentialsStaxombuilder Builder =NewStaxombuilder ("/path/to/repository/conf/policy.xml");//Options options = Stub._getserviceclient (). GetOptions (); Options.setusername ("username"); Options.setpassword ("Password"); Options.setproperty (//Rampartmessagedata.key_rampart_policy,//Policyengine.getpolicy (Builder.getdocumentelement ()//));//4.Instance a Getcardlist object and call the serverGetcardlist list =NewGetcardlist (); List.setclassname ("Computer"); Getcardlistresponse response = stub.getcardlist (list); card[] Card = Response.get_return ();//5.At This point can iterate on the array card content and extract the most interesting values. For example, if you want to recover the description of every computer, the following method would be enough:System.out.println (Card[i].getdescription ());

At this point, the official code is available, but WebServicesStub where did it come from? Other classes can also find relevant jar packages via Google, but where do they WebServicesStub come from?

The story of Webservicesstub

Finally, all kinds of online search Ah, all relevant data are tried, and finally in the stub call WebService here to find a way to work.

Use the Wsdl2java.bat command provided by AXIS2 to generate code that calls WebService based on the WSDL file

The specific operation, download installs the Axis2 not to say.

Go to %AXIS2_HOME%\bin\ , execute

http://localhost:8080/cmdbuild/services/soap/Webservices?wsdl -p client -s -o stub

Where -url parameters specify the path to the WSDL file, either a local or a network path. -pparameter specifies the package name of the generated Java class, and the -o parameter specifies the root directory where the generated series of files are saved.

After executing the above command, the reader will find that in the current directory is more than a stub directory, in the stub/src/client directory can find a $Proxy146ServiceStub.java file (strange name, because it is the name of the WSDL file provided), the file complex call WebService, The reader can use this class directly in the program.

Finally, finally, it can be used WebServicesStub , but the problem is still there, and so I toss it first. What questions can be discussed directly with a message.

Summarize

Cmdbuild is an open source CMDB product developed by an Italian company, with little information on the web, less information in Chinese, and only a few simple installation articles, with little information on how it is used, and only the official manuals. However, it only gives the interface of the WSDL format of soap, there is no other jar file, and in its official user manual only simple use of the sample code, for some of the source of the class is not given, there is no perfect API development documentation, so to really use it has some difficulties, Code-level testing is not yet possible.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Cmdbuild installation and acquisition of the WebService interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.