Difference between revisions of "Open-Xchange Provisioning using SOAP"

(Example code)
 
(15 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
Beneath RMI and commandline, Open-Xchange can be provisioned using SOAP.
 
Beneath RMI and commandline, Open-Xchange can be provisioned using SOAP.
  
The setup instructions for the SOAP services can be find in [http://software.open-xchange.com/OX6/doc/SOAP/admin/OX-Admin-SOAP.html this document].
+
'''PHP users, please read the PHP warning below!'''
 +
 
 +
== Installation ==
 +
 
 +
Just go ahead and install the package ''open-xchange-admin-soap'' using the package manager of your Linux system.
 +
 
 +
== Setup SOAP services on Open-Xchange ==
 +
 
 +
Nothing to be done once the package open-xchange-admin-soap has been installed. After restarting the Open-Xchange server,
 +
you can check for the SOAP services in accessing the URL http://yourox.example.com/webservices
 +
 
 +
Beginning with Open-Xchange version 6.22, the [http://axis.apache.org/axis2/java/core/ Axis2] engine has been replaced
 +
by the [http://cxf.apache.org/ CXF] engine. The corresponding package ''open-xchange-soap-cxf'' will be installed as a dependency
 +
when installing one of the admin soap packages as described above.
  
 
== Example code ==
 
== Example code ==
  
You can find Perl and PHP example code in the cvs within the repository <tt>open-xchange-admin-soap</tt>.
+
SOAP API documentation can be found in [http://software.open-xchange.com/products/appsuite/doc/SOAP/admin/OX-Admin-SOAP.html this document].
Checkout using the command
 
  
$ cvs -d :pserver:anonymous@www.open-xchange.com:/cvsroot co open-xchange-admin-soap
+
Java examples can be found here: [[Open-Xchange-SOAP-WSDL2JAVA]]
 +
 
 +
You can find Perl and PHP example code in the git repository <tt>wd/backend/com.openexchange.admin.soap</tt>.
 +
Please follow the [[SourceCodeAccess]] guide on how to access the source code.
  
 
once checked out, find examples in
 
once checked out, find examples in
  
  open-xchange-admin-soap/test/perl
+
  com.openexchange.admin.soap/test/perl
  open-xchange-admin-soap/test/php
+
  com.openexchange.admin.soap/test/php
  
 
Further documentation and examples:
 
Further documentation and examples:
  
* SOAP API documentation including examples in perl: http://software.open-xchange.com/OX6/doc/SOAP/admin/OX-Admin-SOAP.html
+
* SOAP API documentation including examples in perl: http://software.open-xchange.com/products/appsuite/doc/SOAP/admin/OX-Admin-SOAP.html
* The [http://www.apsstandard.org/app/#search=Open-Xchange OX APS Package] for Parallels contains some more examples in php.
+
* The {{APSPackage|name=Open-Xchange}} APS package for Parallels contains some more examples in php.
 +
* The {{APSPackage|name=OX as a Service}} APS package for Parallels contains examples in perl.
 +
* The guide [[OX_as_a_Service_Provisioning_using_SOAP|OX as a Service Provisioning using SOAP]] is explaining how to specifically handle OXaaS
 
* The [[Open-Xchange_cPanel_Installation|cPanel OXtender]] is also using SOAP via perl
 
* The [[Open-Xchange_cPanel_Installation|cPanel OXtender]] is also using SOAP via perl
 
* [[Open-Xchange-SOAP-C-Sharp|Provision using C#]]
 
* [[Open-Xchange-SOAP-C-Sharp|Provision using C#]]
 
* [[Open-Xchange-SOAP-WSDL2JAVA|Provisioning using Java]]
 
* [[Open-Xchange-SOAP-WSDL2JAVA|Provisioning using Java]]
 +
 +
== Short warning to PHP users ==
 +
 +
We do not recommend to use PHP when accessing our SOAP provisioning API. This is because PHP has trouble sending
 +
simple arrays in a way we can handle it. This applies to '''ALL''' Open-Xchange versions!
 +
 +
If you still want to use PHP, you might need this information:
 +
 +
instead of
 +
 +
      #$ctx = new Context();
 +
      #$ctx->id = $random_id;
 +
      #$ctx->maxQuota = 10;
 +
      #$ctx->loginMappings = array( "mapping1", "mapping2", "mapping3");
 +
 +
in php you have to do
 +
 +
      $mctx = array("id" => $random_id, "maxQuota" => 10);
 +
      $mctx["loginMappings"] = "mapping1";
 +
      $mctx["loginMappings "] = "mapping2";
 +
      $mctx["loginMappings  "] = "mapping3";
 +
 +
and then this:
 +
 +
      $result = getContextClient($SOAPHOST)->create(new SoapVar($mctx,SOAP_ENC_OBJECT), $user, getCredentialsObject($OXMASTER_ADMIN, $OXMASTER_ADMIN_PASS));
 +
 +
instead of that:
 +
 +
      #$result = getContextClient($SOAPHOST)->create($ctx, $user, getCredentialsObject($OXMASTER_ADMIN, $OXMASTER_ADMIN_PASS));
 +
 +
when using the examples from
 +
 +
com.openexchange.admin.soap/test/php
 +
 +
This information is based on this code
 +
 +
  printo_stderr("Update context aliases list\n");
 +
 +
  // XXX: OX requires all mappings entries on top level of context
 +
  // PHP SOAP serializer can't accomplish such task
 +
  // workaround problem naming keys in array with spaces:
 +
  // - transparent for XML, different for PHP
 +
  $map = array('id' => $ctx->id);
 +
  $key = 'loginMappings';
 +
  for ($i = 0; $i < count($mappings); $i++) {
 +
        $map[$key] = $mappings[$i];
 +
        $key .= ' ';
 +
  }
 +
 +
as taken from the Parallels APS package (see above).
 +
 +
[[Category: OX6]]
 +
[[Category: AppSuite]]
 +
 +
[[Category: Server]]
 +
 +
[[Category: Developer]]
 +
[[Category: Administrator]]

Latest revision as of 10:20, 24 September 2015

Provision Open-Xchange using SOAP

Beneath RMI and commandline, Open-Xchange can be provisioned using SOAP.

PHP users, please read the PHP warning below!

Installation

Just go ahead and install the package open-xchange-admin-soap using the package manager of your Linux system.

Setup SOAP services on Open-Xchange

Nothing to be done once the package open-xchange-admin-soap has been installed. After restarting the Open-Xchange server, you can check for the SOAP services in accessing the URL http://yourox.example.com/webservices

Beginning with Open-Xchange version 6.22, the Axis2 engine has been replaced by the CXF engine. The corresponding package open-xchange-soap-cxf will be installed as a dependency when installing one of the admin soap packages as described above.

Example code

SOAP API documentation can be found in this document.

Java examples can be found here: Open-Xchange-SOAP-WSDL2JAVA

You can find Perl and PHP example code in the git repository wd/backend/com.openexchange.admin.soap. Please follow the SourceCodeAccess guide on how to access the source code.

once checked out, find examples in

com.openexchange.admin.soap/test/perl
com.openexchange.admin.soap/test/php

Further documentation and examples:

Short warning to PHP users

We do not recommend to use PHP when accessing our SOAP provisioning API. This is because PHP has trouble sending simple arrays in a way we can handle it. This applies to ALL Open-Xchange versions!

If you still want to use PHP, you might need this information:

instead of

      #$ctx = new Context();
      #$ctx->id = $random_id;
      #$ctx->maxQuota = 10;
      #$ctx->loginMappings = array( "mapping1", "mapping2", "mapping3");

in php you have to do

      $mctx = array("id" => $random_id, "maxQuota" => 10);
      $mctx["loginMappings"] = "mapping1";
      $mctx["loginMappings "] = "mapping2";
      $mctx["loginMappings  "] = "mapping3";

and then this:

      $result = getContextClient($SOAPHOST)->create(new SoapVar($mctx,SOAP_ENC_OBJECT), $user, getCredentialsObject($OXMASTER_ADMIN, $OXMASTER_ADMIN_PASS));

instead of that:

      #$result = getContextClient($SOAPHOST)->create($ctx, $user, getCredentialsObject($OXMASTER_ADMIN, $OXMASTER_ADMIN_PASS));

when using the examples from

com.openexchange.admin.soap/test/php

This information is based on this code

 printo_stderr("Update context aliases list\n");

 // XXX: OX requires all mappings entries on top level of context
 // PHP SOAP serializer can't accomplish such task
 // workaround problem naming keys in array with spaces:
 // - transparent for XML, different for PHP
 $map = array('id' => $ctx->id);
 $key = 'loginMappings';
 for ($i = 0; $i < count($mappings); $i++) {
        $map[$key] = $mappings[$i];
        $key .= ' ';
 }

as taken from the Parallels APS package (see above).