CMDBuild Forum

API docs or examples

Is there any documentation or examples on how to access and use the SOAP web services of CMDBuild?  Any URLs or documentation pointers would be appreciated.  Thanks.

-Alan

We are in the process of translating all the manuals, but the Web Service manual has not been translated to English yet.

Some informations that might be useful:

Most methods have self-explanatory names and parameters. I suggest you use soapUI (http://www.soapui.org/) to play with them before you start writing any code.
 
Paolo
 

 

Having spent a while trying to decipher what is wanted by the Web service, examples seem almost imperative.  Sure, I'm looking at the WSDL, but I can't decide what is wanted by, say, getCard.  Is this the right method to find a card given a query?  There are methods that reference a "query" or "filter" object, but there's no definition on what a "filter" should look like (syntax).

I could stand even a simple example in almost any language that showed, say, how to find a card by attribute (like Serialnumber).

I could also use some info on whether a lookup of a card across a domain is possible.  Better explanation, if a Server card had a reference to an IP card, is there a syntax that would return the Server card that matched an IP address?

-Alan

 

Previously Tecnoteca wrote:

Most methods have self-explanatory names and parameters. I suggest you use soapUI (http://www.soapui.org/) to play with them before you start writing any code.
 
Paolo

 

Previously Tecnoteca wrote:

Most methods have self-explanatory names and parameters. I suggest you use soapUI (http://www.soapui.org/) to play with them before you start writing any code.
 
Paolo

 

Great joke :>
 
What return getCode() method in this sample:
Attribute[] attributes = card.getAttributeList();
for (int j = 0; j < attributes.length; j++) {
Attribute attribute = attributes[j];
System.out.println(attribute.getCode());
}
CODE? Wrong! ... some surprise number, probably id.
 
 

Krzysztof ha scritto:

Great joke :>
 
The SOAP APIs are far from being a good, and there are a few details that might not be clear, like this one or the getReference(...) method. What I meant to say is that you can write here if you find any problems, since there is no English manual yet.
 
What return getCode() method in this sample:
Attribute[] attributes = card.getAttributeList();
for (int j = 0; j < attributes.length; j++) {
Attribute attribute = attributes[j];
System.out.println(attribute.getCode());
}
CODE? Wrong! ... some surprise number, probably id.
 
I'm glad you proved me right: you found that out by playing with the API ;) That value is indeed the "Id" column in the database, that is also what you'll have to set when creating or updating a card.
 
Paolo
 

Hi,

 

I would like to bring this topic up again. I was able to call the REST Interface and getting the data and details of a card. But with SOAP UI I am only able to call "getAttributeList", "getCardList", etc. but as soon as it comes to "getCard" operation I am always getting a "Fault occured while processing". All the fields in the WSDL for the operation are Optional, Filter Operator is unclear is unclear (in the Schema it's just "String", what should I put in? "+", "AND", "OR" - everything throws an error in the log? ). I would really be happy to get the Information of a Card based on an attribute (e.g. the name). No example found so far :( And with SOAPUI I am stuck.

 

Wouldn't it be easy just to ship 3-4 examples how to use the webservices?

 

Btw: it would really help if the webservice response in case of an error gives some more information, otherwise clients will not be able to react in the right manner (retry, or which field was the problem, etc.)

 

Thanks and regards

 

 

Previously Alan wrote:

Is there any documentation or examples on how to access and use the SOAP web services of CMDBuild?  Any URLs or documentation pointers would be appreciated.  Thanks.

-Alan

 

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team

Hi,

 

I know that document. Apparently I didn't find any examples, could you pls point me to the page showing examples of the "getCard" call?

 

Thanks and regards

 

 

 

Previously Tecnoteca wrote:

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team

 

Here is a working example:
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/sessions' -H "Content-Type: application/json" --data-binary '{"username": "the user", "password": "the password"}' -X POST -v | json_pp 
[...]
{
   "data" : {
      "username" : "admin",
      "_id" : "vsde9c6q0q6ae6d7b8d9v2t8q4",
      "role" : "SuperUser",
      "availableRoles" : [
         "SuperUser"
      ]
   }
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards' -H "Content-Type: application/json" -H "CMDBuild-Authorization: vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "meta" : {
      "positions" : {},
      "total" : 10
   },
   "data" : [
      {
         "_type" : "Employee",
         "_id" : 124,
         "State" : 152,
         "Description" : "Brown Robert",
         "Email" : robert.brown@example.com",
         "Code" : "05",
         "Type" : 149,
         "Name" : "Robert",
         "Notes" : null,
         "Mobile" : "24555556",
         "Phone" : "65432",
         "Office" : 110,
         "Level" : 146,
         "Fax" : null,
         "Qualification" : 22,
         "Surname" : "Brown"
      },
      ...
   ]
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards/124' -H "Content-Type: application/json" -H "CMDBuild-Authorization:  vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "data" : {
      "Type" : 149,
      "Name" : "Robert",
      "Phone" : "65432",
      "Code" : "05",
      "Mobile" : "24555556",
      "Email" : robert.brown@example.com",
      "Qualification" : 22,
      "Surname" : "Brown",
      "Level" : 146,
      "_type" : "Employee",
      "Description" : "Brown Robert",
      "_id" : 124,
      "Office" : 110,
      "Notes" : null,
      "Fax" : null,
      "State" : 152
   }
}
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

Hi,

 

I know that document. Apparently I didn't find any examples, could you pls point me to the page showing examples of the "getCard" call?

 

Thanks and regards

 

 

 

Previously Tecnoteca wrote:

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team

 

 

Hi,

 

thanks for the example, and sorry for not being precise enough... I was looking for an example for the SOAP Interface, for the same use case. With REST I was already able to successfully get the data.

 

Thanks for helping me!

 

Regards,

Hannes

 

 

 

Previously Tecnoteca wrote:
Here is a working example:
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/sessions' -H "Content-Type: application/json" --data-binary '{"username": "the user", "password": "the password"}' -X POST -v | json_pp 
[...]
{
   "data" : {
      "username" : "admin",
      "_id" : "vsde9c6q0q6ae6d7b8d9v2t8q4",
      "role" : "SuperUser",
      "availableRoles" : [
         "SuperUser"
      ]
   }
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards' -H "Content-Type: application/json" -H "CMDBuild-Authorization: vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "meta" : {
      "positions" : {},
      "total" : 10
   },
   "data" : [
      {
         "_type" : "Employee",
         "_id" : 124,
         "State" : 152,
         "Description" : "Brown Robert",
         "Email" : robert.brown@example.com",
         "Code" : "05",
         "Type" : 149,
         "Name" : "Robert",
         "Notes" : null,
         "Mobile" : "24555556",
         "Phone" : "65432",
         "Office" : 110,
         "Level" : 146,
         "Fax" : null,
         "Qualification" : 22,
         "Surname" : "Brown"
      },
      ...
   ]
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards/124' -H "Content-Type: application/json" -H "CMDBuild-Authorization:  vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "data" : {
      "Type" : 149,
      "Name" : "Robert",
      "Phone" : "65432",
      "Code" : "05",
      "Mobile" : "24555556",
      "Email" : robert.brown@example.com",
      "Qualification" : 22,
      "Surname" : "Brown",
      "Level" : 146,
      "_type" : "Employee",
      "Description" : "Brown Robert",
      "_id" : 124,
      "Office" : 110,
      "Notes" : null,
      "Fax" : null,
      "State" : 152
   }
}
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

Hi,

 

I know that document. Apparently I didn't find any examples, could you pls point me to the page showing examples of the "getCard" call?

 

Thanks and regards

 

 

 

Previously Tecnoteca wrote:

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team

 

 

 

 

Hello,

 

to clarify, here a sample request for the example database:

 

 

----------REQUEST------------------

 

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soap.services.cmdbuild.org">

   <soap:Header>

     

   </soap:Header>

   <soap:Body>

      <soap1:getCard>

         <!--Optional:-->

         <soap1:className>Monitor</soap1:className>

      </soap1:getCard>

   </soap:Body>

</soap:Envelope>

 

 

---------RESPONSE------------------

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

   <soap:Body>

      <soap:Fault>

         <soap:Code>

            <soap:Value>soap:Receiver</soap:Value>

         </soap:Code>

         <soap:Reason>

            <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>

         </soap:Reason>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

 

 

---------REST---------------------

http://$host/cmdbuild/services/rest/v1/classes/Monitor/cards ---> works, I get data for each monitor!

 

 

---------cmdbuild.log-------------

For SOAP Request:

WARN  2016-02-01 11:14:20 [org.apache.cxf.phase.PhaseInterceptorChain] Application {http://proxy.sun.com/}$Proxy381Service#{http://soap.services.cmdbuild.org}getCard has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault

        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)

....

Caused by: java.lang.reflect.UndeclaredThrowableException

        at com.sun.proxy.$Proxy381.getCard(Unknown Source)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

        ... 61 more

Caused by: java.lang.reflect.InvocationTargetException

        at sun.reflect.GeneratedMethodAccessor394.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.cmdbuild.common.utils.NotifierProxy$1.invoke(NotifierProxy.java:102)

        ... 68 more

Caused by: java.lang.NullPointerException

        at org.cmdbuild.services.soap.WebservicesImpl.getCard(WebservicesImpl.java:35)

        ... 72 more

 

 

 

 

So what would be the right call to get the same data over SOAP as the REST interface?

 

Hello,

 

to clarify, here a sample request for the example database:

 

 

----------REQUEST------------------

 

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soap.services.cmdbuild.org">

   <soap:Header>

     

   </soap:Header>

   <soap:Body>

      <soap1:getCard>

         <!--Optional:-->

         <soap1:className>Monitor</soap1:className>

      </soap1:getCard>

   </soap:Body>

</soap:Envelope>

 

 

---------RESPONSE------------------

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

   <soap:Body>

      <soap:Fault>

         <soap:Code>

            <soap:Value>soap:Receiver</soap:Value>

         </soap:Code>

         <soap:Reason>

            <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>

         </soap:Reason>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

 

 

---------REST---------------------

http://$host/cmdbuild/services/rest/v1/classes/Monitor/cards ---> works, I get data for each monitor!

 

 

---------cmdbuild.log-------------

For SOAP Request:

WARN  2016-02-01 11:14:20 [org.apache.cxf.phase.PhaseInterceptorChain] Application {http://proxy.sun.com/}$Proxy381Service#{http://soap.services.cmdbuild.org}getCard has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault

        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)

....

Caused by: java.lang.reflect.UndeclaredThrowableException

        at com.sun.proxy.$Proxy381.getCard(Unknown Source)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

        ... 61 more

Caused by: java.lang.reflect.InvocationTargetException

        at sun.reflect.GeneratedMethodAccessor394.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.cmdbuild.common.utils.NotifierProxy$1.invoke(NotifierProxy.java:102)

        ... 68 more

Caused by: java.lang.NullPointerException

        at org.cmdbuild.services.soap.WebservicesImpl.getCard(WebservicesImpl.java:35)

        ... 72 more

 

 

 

 

So what would be the right call to get the same data over SOAP as the REST interface?

 

Previously Hannes wrote:

Hi,

 

thanks for the example, and sorry for not being precise enough... I was looking for an example for the SOAP Interface, for the same use case. With REST I was already able to successfully get the data.

 

Thanks for helping me!

 

Regards,

Hannes

 

 

 

Previously Tecnoteca wrote:
Here is a working example:
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/sessions' -H "Content-Type: application/json" --data-binary '{"username": "the user", "password": "the password"}' -X POST -v | json_pp 
[...]
{
   "data" : {
      "username" : "admin",
      "_id" : "vsde9c6q0q6ae6d7b8d9v2t8q4",
      "role" : "SuperUser",
      "availableRoles" : [
         "SuperUser"
      ]
   }
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards' -H "Content-Type: application/json" -H "CMDBuild-Authorization: vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "meta" : {
      "positions" : {},
      "total" : 10
   },
   "data" : [
      {
         "_type" : "Employee",
         "_id" : 124,
         "State" : 152,
         "Description" : "Brown Robert",
         "Email" : robert.brown@example.com",
         "Code" : "05",
         "Type" : 149,
         "Name" : "Robert",
         "Notes" : null,
         "Mobile" : "24555556",
         "Phone" : "65432",
         "Office" : 110,
         "Level" : 146,
         "Fax" : null,
         "Qualification" : 22,
         "Surname" : "Brown"
      },
      ...
   ]
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards/124' -H "Content-Type: application/json" -H "CMDBuild-Authorization:  vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "data" : {
      "Type" : 149,
      "Name" : "Robert",
      "Phone" : "65432",
      "Code" : "05",
      "Mobile" : "24555556",
      "Email" : robert.brown@example.com",
      "Qualification" : 22,
      "Surname" : "Brown",
      "Level" : 146,
      "_type" : "Employee",
      "Description" : "Brown Robert",
      "_id" : 124,
      "Office" : 110,
      "Notes" : null,
      "Fax" : null,
      "State" : 152
   }
}
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

Hi,

 

I know that document. Apparently I didn't find any examples, could you pls point me to the page showing examples of the "getCard" call?

 

Thanks and regards

 

 

 

Previously Tecnoteca wrote:

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team

 

 

 

 

 

Hello,

 

to clarify, here a sample request for the example database:

 

 

----------REQUEST------------------

 

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soap.services.cmdbuild.org">

   <soap:Header>

     

   </soap:Header>

   <soap:Body>

      <soap1:getCard>

         <!--Optional:-->

         <soap1:className>Monitor</soap1:className>

      </soap1:getCard>

   </soap:Body>

</soap:Envelope>

 

 

---------RESPONSE------------------

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

   <soap:Body>

      <soap:Fault>

         <soap:Code>

            <soap:Value>soap:Receiver</soap:Value>

         </soap:Code>

         <soap:Reason>

            <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>

         </soap:Reason>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

 

 

---------REST---------------------

http://$host/cmdbuild/services/rest/v1/classes/Monitor/cards ---> works, I get data for each monitor!

 

 

---------cmdbuild.log-------------

For SOAP Request:

WARN  2016-02-01 11:14:20 [org.apache.cxf.phase.PhaseInterceptorChain] Application {http://proxy.sun.com/}$Proxy381Service#{http://soap.services.cmdbuild.org}getCard has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault

        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)

....

Caused by: java.lang.reflect.UndeclaredThrowableException

        at com.sun.proxy.$Proxy381.getCard(Unknown Source)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

        ... 61 more

Caused by: java.lang.reflect.InvocationTargetException

        at sun.reflect.GeneratedMethodAccessor394.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.cmdbuild.common.utils.NotifierProxy$1.invoke(NotifierProxy.java:102)

        ... 68 more

Caused by: java.lang.NullPointerException

        at org.cmdbuild.services.soap.WebservicesImpl.getCard(WebservicesImpl.java:35)

        ... 72 more

 

 

 

 

So what would be the right call to get the same data over SOAP as the REST interface?

 

Previously Tecnoteca wrote:
Here is a working example:
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/sessions' -H "Content-Type: application/json" --data-binary '{"username": "the user", "password": "the password"}' -X POST -v | json_pp 
[...]
{
   "data" : {
      "username" : "admin",
      "_id" : "vsde9c6q0q6ae6d7b8d9v2t8q4",
      "role" : "SuperUser",
      "availableRoles" : [
         "SuperUser"
      ]
   }
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards' -H "Content-Type: application/json" -H "CMDBuild-Authorization: vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "meta" : {
      "positions" : {},
      "total" : 10
   },
   "data" : [
      {
         "_type" : "Employee",
         "_id" : 124,
         "State" : 152,
         "Description" : "Brown Robert",
         "Email" : robert.brown@example.com",
         "Code" : "05",
         "Type" : 149,
         "Name" : "Robert",
         "Notes" : null,
         "Mobile" : "24555556",
         "Phone" : "65432",
         "Office" : 110,
         "Level" : 146,
         "Fax" : null,
         "Qualification" : 22,
         "Surname" : "Brown"
      },
      ...
   ]
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards/124' -H "Content-Type: application/json" -H "CMDBuild-Authorization:  vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "data" : {
      "Type" : 149,
      "Name" : "Robert",
      "Phone" : "65432",
      "Code" : "05",
      "Mobile" : "24555556",
      "Email" : robert.brown@example.com",
      "Qualification" : 22,
      "Surname" : "Brown",
      "Level" : 146,
      "_type" : "Employee",
      "Description" : "Brown Robert",
      "_id" : 124,
      "Office" : 110,
      "Notes" : null,
      "Fax" : null,
      "State" : 152
   }
}
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

Hi,

 

I know that document. Apparently I didn't find any examples, could you pls point me to the page showing examples of the "getCard" call?

 

Thanks and regards

 

 

 

Previously Tecnoteca wrote:

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team

 

 

 

The card's id is missing.
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

 

Hello,

 

to clarify, here a sample request for the example database:

 

 

----------REQUEST------------------

 

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soap.services.cmdbuild.org">

   <soap:Header>

     

   </soap:Header>

   <soap:Body>

      <soap1:getCard>

         <!--Optional:-->

         <soap1:className>Monitor</soap1:className>

      </soap1:getCard>

   </soap:Body>

</soap:Envelope>

 

 

---------RESPONSE------------------

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

   <soap:Body>

      <soap:Fault>

         <soap:Code>

            <soap:Value>soap:Receiver</soap:Value>

         </soap:Code>

         <soap:Reason>

            <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>

         </soap:Reason>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

 

 

---------REST---------------------

http://$host/cmdbuild/services/rest/v1/classes/Monitor/cards ---> works, I get data for each monitor!

 

 

---------cmdbuild.log-------------

For SOAP Request:

WARN  2016-02-01 11:14:20 [org.apache.cxf.phase.PhaseInterceptorChain] Application {http://proxy.sun.com/}$Proxy381Service#{http://soap.services.cmdbuild.org}getCard has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault

        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)

....

Caused by: java.lang.reflect.UndeclaredThrowableException

        at com.sun.proxy.$Proxy381.getCard(Unknown Source)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

        ... 61 more

Caused by: java.lang.reflect.InvocationTargetException

        at sun.reflect.GeneratedMethodAccessor394.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.cmdbuild.common.utils.NotifierProxy$1.invoke(NotifierProxy.java:102)

        ... 68 more

Caused by: java.lang.NullPointerException

        at org.cmdbuild.services.soap.WebservicesImpl.getCard(WebservicesImpl.java:35)

        ... 72 more

 

 

 

 

So what would be the right call to get the same data over SOAP as the REST interface?

 

Previously Tecnoteca wrote:
Here is a working example:
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/sessions' -H "Content-Type: application/json" --data-binary '{"username": "the user", "password": "the password"}' -X POST -v | json_pp 
[...]
{
   "data" : {
      "username" : "admin",
      "_id" : "vsde9c6q0q6ae6d7b8d9v2t8q4",
      "role" : "SuperUser",
      "availableRoles" : [
         "SuperUser"
      ]
   }
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards' -H "Content-Type: application/json" -H "CMDBuild-Authorization: vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "meta" : {
      "positions" : {},
      "total" : 10
   },
   "data" : [
      {
         "_type" : "Employee",
         "_id" : 124,
         "State" : 152,
         "Description" : "Brown Robert",
         "Email" : robert.brown@example.com",
         "Code" : "05",
         "Type" : 149,
         "Name" : "Robert",
         "Notes" : null,
         "Mobile" : "24555556",
         "Phone" : "65432",
         "Office" : 110,
         "Level" : 146,
         "Fax" : null,
         "Qualification" : 22,
         "Surname" : "Brown"
      },
      ...
   ]
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards/124' -H "Content-Type: application/json" -H "CMDBuild-Authorization:  vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "data" : {
      "Type" : 149,
      "Name" : "Robert",
      "Phone" : "65432",
      "Code" : "05",
      "Mobile" : "24555556",
      "Email" : robert.brown@example.com",
      "Qualification" : 22,
      "Surname" : "Brown",
      "Level" : 146,
      "_type" : "Employee",
      "Description" : "Brown Robert",
      "_id" : 124,
      "Office" : 110,
      "Notes" : null,
      "Fax" : null,
      "State" : 152
   }
}
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

Hi,

 

I know that document. Apparently I didn't find any examples, could you pls point me to the page showing examples of the "getCard" call?

 

Thanks and regards

 

 

 

Previously Tecnoteca wrote:

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team

 

 

 

 

Thanks, that works!

 

But: most of the fields marked as optional....so not easy to find out :(

 

 

Previously Tecnoteca wrote:
The card's id is missing.
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

 

Hello,

 

to clarify, here a sample request for the example database:

 

 

----------REQUEST------------------

 

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soap.services.cmdbuild.org">

   <soap:Header>

     

   </soap:Header>

   <soap:Body>

      <soap1:getCard>

         <!--Optional:-->

         <soap1:className>Monitor</soap1:className>

      </soap1:getCard>

   </soap:Body>

</soap:Envelope>

 

 

---------RESPONSE------------------

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

   <soap:Body>

      <soap:Fault>

         <soap:Code>

            <soap:Value>soap:Receiver</soap:Value>

         </soap:Code>

         <soap:Reason>

            <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>

         </soap:Reason>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

 

 

---------REST---------------------

http://$host/cmdbuild/services/rest/v1/classes/Monitor/cards ---> works, I get data for each monitor!

 

 

---------cmdbuild.log-------------

For SOAP Request:

WARN  2016-02-01 11:14:20 [org.apache.cxf.phase.PhaseInterceptorChain] Application {http://proxy.sun.com/}$Proxy381Service#{http://soap.services.cmdbuild.org}getCard has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault

        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)

....

Caused by: java.lang.reflect.UndeclaredThrowableException

        at com.sun.proxy.$Proxy381.getCard(Unknown Source)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

        ... 61 more

Caused by: java.lang.reflect.InvocationTargetException

        at sun.reflect.GeneratedMethodAccessor394.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.cmdbuild.common.utils.NotifierProxy$1.invoke(NotifierProxy.java:102)

        ... 68 more

Caused by: java.lang.NullPointerException

        at org.cmdbuild.services.soap.WebservicesImpl.getCard(WebservicesImpl.java:35)

        ... 72 more

 

 

 

 

So what would be the right call to get the same data over SOAP as the REST interface?

 

Previously Tecnoteca wrote:
Here is a working example:
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/sessions' -H "Content-Type: application/json" --data-binary '{"username": "the user", "password": "the password"}' -X POST -v | json_pp 
[...]
{
   "data" : {
      "username" : "admin",
      "_id" : "vsde9c6q0q6ae6d7b8d9v2t8q4",
      "role" : "SuperUser",
      "availableRoles" : [
         "SuperUser"
      ]
   }
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards' -H "Content-Type: application/json" -H "CMDBuild-Authorization: vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "meta" : {
      "positions" : {},
      "total" : 10
   },
   "data" : [
      {
         "_type" : "Employee",
         "_id" : 124,
         "State" : 152,
         "Description" : "Brown Robert",
         "Email" : robert.brown@example.com",
         "Code" : "05",
         "Type" : 149,
         "Name" : "Robert",
         "Notes" : null,
         "Mobile" : "24555556",
         "Phone" : "65432",
         "Office" : 110,
         "Level" : 146,
         "Fax" : null,
         "Qualification" : 22,
         "Surname" : "Brown"
      },
      ...
   ]
}
 
$ curl 'http://demo.cmdbuild.org/cmdbuild/services/rest/v1/classes/Employee/cards/124' -H "Content-Type: application/json" -H "CMDBuild-Authorization:  vsde9c6q0q6ae6d7b8d9v2t8q4" -X GET -v | json_pp 
[...]
{
   "data" : {
      "Type" : 149,
      "Name" : "Robert",
      "Phone" : "65432",
      "Code" : "05",
      "Mobile" : "24555556",
      "Email" : robert.brown@example.com",
      "Qualification" : 22,
      "Surname" : "Brown",
      "Level" : 146,
      "_type" : "Employee",
      "Description" : "Brown Robert",
      "_id" : 124,
      "Office" : 110,
      "Notes" : null,
      "Fax" : null,
      "State" : 152
   }
}
 
Best regards.
 
-- CMDBuild Team
 
Previously Hannes wrote:

Hi,

 

I know that document. Apparently I didn't find any examples, could you pls point me to the page showing examples of the "getCard" call?

 

Thanks and regards

 

 

 

Previously Tecnoteca wrote:

You can find some informations in the Webservice Manual:

http://www.cmdbuild.org/en/documentazione/manuali

CMDBuild Team