1
wishcraft
X-SOAP 4.2

Resized Image

What is SOAP?

SOAP (Simple Object Access Protocol) is a way for a program running in one kind of operating system (such as Windows 2000) to communicate with a progam in the same or another kind of an operating system (such as Linux) by using the World Wide Web's Hypertext Transfer Protocol (HTTP)and its Extensible Markup Language (XML) as the mechanisms for information exchange. Since Web protocols are installed and available for use by all major operating system platforms, HTTP and XML provide an already at-hand solution to the problem of how programs running under different operating systems in a network can communicate with each other. SOAP specifies exactly how to encode an HTTP header and an XML file so that a program in one computer can call a program in another computer and pass it information. It also specifies how the called program can return a response.

What Can It Do for Me?

You can link with any soap-compliant system with complete w3c standard wsdl these will be completed in version 4.0 they are more just the abstract data layers of wsdl, they still need a dynamic mime type and other system written into them which the constructs are in place. You can transfer data between any sort tunnel through most of not all firewalls and poll your XOOPS platform from with another XOOPS or CMS or even things like .NET, Delphi and many other programming languages.

X-SOAP is the quick way for cloud computing, you can link your XOOPS platform with any other computer network with this module, plug-in have complete WSDL compilation code and allow for easy and dynamic deployment.


Whats New in this release?

The bugs in the Admin have been fixed, new language files have have been introduced as well as standardisation of the <?php call in the php files.

To Download it Click here xoops2_xsoap_4.2.zip (193 Kb's).
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

2
kerkyra
Re: X-SOAP 4.2
  • 2010/1/24 19:01

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


any ideas how to use it? there is no help file! i have installed the module, set permissions etc. How can i make a call to get the data of a specific table?

3
ghia
Re: X-SOAP 4.2
  • 2010/1/25 0:18

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Do you know what SOAP is and what it is used for?
Can you make or use a SOAP client?
If one of the answers is no, uninstall the module.

4
kerkyra
Re: X-SOAP 4.2
  • 2010/1/25 13:47

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


i'm trying to make a web service using soap, so i'm fairly new to this. Thats why i'm asking for help with the module, i dont now if it is what i'm looking for or if i should write something from scratch.

5
fungus
Re: X-SOAP 4.2
  • 2010/1/26 15:53

  • fungus

  • Just popping in

  • Posts: 72

  • Since: 2002/10/15


Umm... you may want to be more specific. Examples go a long way in my experience

For example:
You want to use soap to call on database XYZ to compare the data to database MNO and write it to a third database.

I am not a soap guru either but from a support and help perspective if people can not understand what you are trying to accomplish, you are not likely to get a correct answer to what you want to do no matter how hard both side try.

6
kerkyra
Re: X-SOAP 4.2
  • 2010/1/27 14:03

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


i would like to create a service so that other portals could get data from my website. For example a list of categories, and when one of the click a list of the products it contains. Using an api perhaps?

7
wishcraft
Re: X-SOAP 4.2

Quote:

kerkyra wrote:
i would like to create a service so that other portals could get data from my website. For example a list of categories, and when one of the click a list of the products it contains. Using an api perhaps?


X-SOAP is ideal for this keryra... X-SOAP uses a plugin system to have the SOAP API Functions.

each plugin/function is represented on the SOAP port as a control device. If you want to retrieve data from X-SOAP i distributed it with some AP i Plugins that allow for database lookups and comparisons.

But you can also write your own function that is specific to your needs.

There are two common types of API, well three there is one in python as well, SOAP, JSON and the python one.

SOAP works with everything, but is more lower kernel than JSON.

All the filenames n /xsoap/plugins are soap functions that come with xsoap, i will examine for you retrieve, which will retrieve data from the database.

/xsoap/plugins/retrieve.php

function retrieve_xsd(){
    
$xsd = array();
    
$i=0;
    
$data = array();
            
$data[] = array("name" => "username""type" => "string");
            
$data[] = array("name" => "password""type" => "string");    
            
$data[] = array("name" => "tablename""type" => "string");
            
$data[] = array("name" => "clause""type" => "string");
        
$datab=array();
        
$datab[] = array("name" => "field""type" => "string");
            
$data[] = array("items" => array("data" => $datab"objname" => "data"));
                                             
    
$xsd['request'][$i]['items']['data'] = $data;
    
$xsd['request'][$i]['items']['objname'] = 'var';    
    
    
$xsd['response'][] = array("name" => "total_records""type" => "double");
    
$data = array();
        
$data[] = array("name" => "field""type" => "string");
        
$data[] = array("name" => "value""type" => "string");        
    
$i++;
    
$xsd['response'][$i]['items']['data'] = $data;
    
$xsd['response'][$i]['items']['objname'] = 'items';
    return 
$xsd;
}

function 
retrieve_wsdl(){

}

function 
retrieve_wsdl_service(){

}

// Define the method as a PHP function
function retrieve($var) {
    global 
$xoopsModuleConfig;
    if (
$xoopsModuleConfig['site_user_auth']==1){
        if (!
checkright(basename(__FILE__),$var['username'],$var['password']))
            return array(
'ErrNum'=> 9"ErrDesc" => 'No Permission for plug-in');
    }
    global 
$xoopsDB;
    if (
strlen($var['tablename'])>0) {
        
$tbl_id get_tableid($var['tablename']);
    } elseif (
$var['id']>0) {
        
$tbl_id $var['id'];
    } else {
        return array(
'ErrNum'=> 2"ErrDesc" => 'Table Name or Table ID not specified');
    }

    if (!
validate($tbl_id,$var['data'], "allowretrieve")){
        return array(
'ErrNum'=> 4"ErrDesc" => 'Not all fields are allowed retrieve');
    } else {
        
$sql "SELECT ";
        foreach (
$var['data'] as $data){
            if (
$data['field']=='*')
                return array(
'ErrNum'=> 7"ErrDesc" => 'Wildcard not accepted');                
                
            
$sql_b .= "`"$data['field']."`,";
        }
        if (
strlen($var['clause'])>0){
            if (
strpos(' '.strtolower($var['clause']),'union')>0)
                return array(
'ErrNum'=> 8"ErrDesc" => 'Union not accepted');                    
            
$sql_c .= 'WHERE '.$var['clause'] ."";
        }

        global 
$xoopsModuleConfig;
        if (
$xoopsModuleConfig['site_user_auth']==1){
            if (!
validateuser($var['username'],$var['password']))
                return 
false;
        }
        
//echo $sql." ".substr($sql_b,0,strlen($str_b)-1)." FROM ".$xoopsDB->prefix(get_tablename($tbl_id))." ".$sql_c;
        
        
$rt $xoopsDB->queryf($sql." ".substr($sql_b,0,strlen($str_b)-1)." FROM ".$xoopsDB->prefix(get_tablename($tbl_id))." ".$sql_c);

        if (!
$xoopsDB->getRowsNum($rt)){
            return array(
'ErrNum'=> 3"ErrDesc" => 'No Records Returned from Query');
        } else {
            
$rtn = array();
            while(
$row $xoopsDB->fetchArray($rt)){
                
$rdata = array();
                foreach (
$var['data'] as $data){
                    
$rdata[] = array("fieldname"=> $data['field'], "value"=>$row[$data['field']]);
                }
                
$rtn[] = $rdata;
            }
        
        }

        return array(
"total_records" => $xoopsDB->getRowsNum($rt), "items" => $rtn);
    
    }

}


This as all XSOAP Plugins have 2 main functions which all correlate to the filename which has to be unique. there are two legacy functions as well these are:

* retrieve_xsd - concurrent
* retrieve_wsdl - legacy
* retrieve_wsdl_service - legacy
* retrieve -- concurrent

if the api function was called getusers.. then the filename would be getusers.php and the functions would be

* getuser_xsd - concurrent
* getuser_wsdl - legacy
* getuser_wsdl_service - legacy
* getuser -- concurrent

Back to retrieve, see SOAP uses the WSDL Document standard to improve performance.. before 4.25 this was throwing errors which was annoying..

The WSDL Document which is written to your /modules/xsoap/ path when you activate or deactivate plugins is built from funcname_xsd which contains your SOAP API function schemer, that is the break down of what fields and variable in what tiers of array you will be sending and recieving.

retreve_xsd()

function retrieve_xsd(){
    
$xsd = array();
    
$i=0;
    
$data = array();
            
$data[] = array("name" => "username""type" => "string");
            
$data[] = array("name" => "password""type" => "string");    
            
$data[] = array("name" => "tablename""type" => "string");
            
$data[] = array("name" => "clause""type" => "string");
        
$datab=array();
        
$datab[] = array("name" => "field""type" => "string");
            
$data[] = array("items" => array("data" => $datab"objname" => "data"));
                                             
    
$xsd['request'][$i]['items']['data'] = $data;
    
$xsd['request'][$i]['items']['objname'] = 'var';    
    
    
$xsd['response'][] = array("name" => "total_records""type" => "double");
    
$data = array();
        
$data[] = array("name" => "field""type" => "string");
        
$data[] = array("name" => "value""type" => "string");        
    
$i++;
    
$xsd['response'][$i]['items']['data'] = $data;
    
$xsd['response'][$i]['items']['objname'] = 'items';
    return 
$xsd;
}


This function contains 2 parts the request, that is the question coming to the API Server and the Response -- your webservices answer..

$data = array();
            
$data[] = array("name" => "username""type" => "string");
            
$data[] = array("name" => "password""type" => "string");    
            
$data[] = array("name" => "tablename""type" => "string");
            
$data[] = array("name" => "clause""type" => "string");
        
$datab=array();
        
$datab[] = array("name" => "field""type" => "string");
            
$data[] = array("items" => array("data" => $datab"objname" => "data"));
                                             
    
$xsd['request'][$i]['items']['data'] = $data;
    
$xsd['request'][$i]['items']['objname'] = 'var';


This part of the request construction, it is a 2 tiered array, but you can tier this as many times as you want making sure you wrap the arrays into each other. as a request this contains, the -- username, password, tablename, clause, then it has an reserved word items which has an open field name for the object/array with the key name recorded with the reserved word objname

This in XML would look a bit like:

<xsoap>
    <
username></username>
    <
password></password>
    <
tablename></tablename>
    <
clause></clause>
    <
data>
        <
array_object_1>
            <
field></field>
        </
array_object_1>
        <
array_object_2>
            <
field></field>
        </
array_object_2>
        ...
    </
data>
</
xsoap>


You can see how the object data, is an endless array of field names to retrieve from the database.

Next is the response constructor.. in the funcname_xsd()

$xsd['response'][] = array("name" => "total_records""type" => "double");
    
$data = array();
        
$data[] = array("name" => "field""type" => "string");
        
$data[] = array("name" => "value""type" => "string");        
    
$i++;
    
$xsd['response'][$i]['items']['data'] = $data;
    
$xsd['response'][$i]['items']['objname'] = 'data';


This is a result from a SQL Query on your service passed to another service that may not run MySQL or even unix, could be a mainframe or a mobile computer, all part of the cloud.

in XML this piece of code looks like

<xsoap>
    <
total_records></total_records>
    <
data>
        <
record_1>
            <
array_object_1>
                <
field></field>
                <
value></value>
            </
array_object_1>
            <
array_object_2>
                <
field></field>
                <
value></value>
            </
array_object_2>
            ...
        </
record_1>
        <
record_2>
            <
array_object_1>
                <
field></field>
                <
value></value>
            </
array_object_1>
            <
array_object_2>
                <
field></field>
                <
value></value>
            </
array_object_2>
            ...
        </
record_2>
        ...
    </
data>

</
xsoap>


Essentially you will want to write your own plugin kerkyra, for a simple thing like a category list from your web service.

There is a wiki on X-SOAP:https://xoops.org/modules/mediawiki/index.php?title=X-Soap&curid=1095&oldid=4023#retrieve_-_Request

finally the function which is called when someone dials up your SOAP server. This is the same as the filename without the php extension or period.

When someone calls his function, the request is passed to it, through var or however you have constructed the inbound call and the return function passes the result (arrays are best0 back to the computer that placed the query on the SOAP Service..

Login

Who's Online

185 user(s) are online (99 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits