eZ Community » Forums » Extensions » Soap/Wsdl loginhandler
expandshrink

Soap/Wsdl loginhandler

Soap/Wsdl loginhandler

Tuesday 22 December 2009 12:44:07 pm - 27 replies

Hi,

I'm begining with Ez

Realy good work, powerfullllframework

But to deal whith webservice it's not easy.

I'm trying to activate user login truth a wsdl webservice (the users are in an SQL server 2005)

The WSDL works fine with other systems but not ez.

In forums i saw the ezsoap is not fully compatible with wsdl.

Some topic recommend Nusoap or ggwebservices.But no doc,no explanation no "how to" to create my login function to consume a webservice.

I'll greatfull if i can have some help:

1-which file do i need

2-in which folder to put them (kernel/.... or extension)

3-what Do i have to activate? ( CURL in php.ini ....)

MyConfig:

  • Windows+Xampp
  • Php5
  • EZ 4.2

Thanks

Wednesday 23 December 2009 2:44:45 am

make sure you have php soap extension installed. curl is a bonus, and needed you have to use https.

get the ggwebservices extension

decompress it in the 'extension' folder

go to admin interface, 'setup/extensions' page and activate it

create somewhere an override file for wsproviders.ini, where you put the ip address and details of your soap server and give it a name that you will later used in your code

create an extension, inside that create a new login handler. Take code from kernel/calsses/datatypes/ezuser/ezldapuser.php as an example. If you do not find docs about creating an extension with a login handler, take an existing extension that does that as an example (search for it on projecst.ez.no)

the code for the login handler will need at some point to use the static method ggeZWebservicesClient::send() to call the soap service

Wednesday 23 December 2009 5:47:22 pm

Thanks gaetano happy.gif Emoticon really appriciate ur help.I feel less alone

I try all this tonight.
I've got you know.

Modified on Wednesday 23 December 2009 7:05:22 pm by Nabran Aboubacar

Monday 11 January 2010 10:00:45 pm

Hello
I am back
Thank you GG I finally wrote a php client that works well with my .Net web service, I can retrieve the data for each user in the sql server.

But I feel it is necessary that the user exit in DB ez.
What is contentobject and Row and ezuser In EZsystem ? 'cause my function returns a user valid according to ezuser class attributes but it doesn't works.

Some tracks?

Thanks for ur help happy.gif Emoticon

Friday 18 June 2010 3:14:03 pm

Ezcontentobject and ezuser are technically subclasses of the ezpersistentobject class (at the php level).

At the template level, they have a different definition - you can find it in the online docs at http://ez.no/doc/ez_publish/technical_manual/4_x/reference/objects.

You can convert the 'php-level' objects to their equivalent 'template-level' definition using a php function found in the ggxmlview or ezwebservicesapi extension - it is probably closer to what you want to expose to the outside world

Monday 18 October 2010 7:26:06 am

Can i have more information regarding ggwebservices.

Thanks

Monday 18 October 2010 3:14:33 pm

Namita,

Welcome to the eZ Publish Community!

Check out the ggwebservices project, http://projects.ez.no/ggwebservices

And other related documention.

http://svn.projects.ez.no/ggwebse...runk/extension/ggwebservices/INSTALL

http://svn.projects.ez.no/ggwebse...trunk/extension/ggwebservices/README

Cheers,

Heath

Modified on Monday 18 October 2010 3:15:07 pm by // Heath

Monday 18 October 2010 10:28:08 pm

@Namita: if the docs that Heath linked to are not enough, feel free to ask more specific questions here

Tuesday 19 October 2010 8:29:17 am

Thanks for ur help.

Modified on Tuesday 19 October 2010 9:06:08 am by namita varshney

Tuesday 19 October 2010 9:05:38 am

Can i have an example of ggwebservices.

Thanks for ur help.

Tuesday 19 October 2010 3:12:36 pm

XMLRPC call FAILED!

 

Fault code: [2] Reason: 'Invalid return payload: enable debugging to examine incoming payload (XML error at line 1, check URL)'

Can u say me about this error.

Tuesday 19 October 2010 10:01:12 pm

This error means that the xmlrpc client received something back from the server that is not valid xml. Most likely you are using a wrong url for your xmlrpc server, or you have some authentication problem.

To get more information about what is going on:

- increase the logging level, overriding the value for generalSettings/Logging in wsproviders.ini (set it to info)

- look at the log file: var/$siteaccess/log/webservices.log

Wednesday 20 October 2010 6:57:45 am

XMLRPC call FAILED!

 

Fault code: [5] Reason: 'Didn't receive 200 OK from remote server. (HTTP/1.0 500 Internal Server Error)'

Can u say me about this error...

Wednesday 20 October 2010 7:30:13 am

<?php
// include client classes
include_once( "/var/www/OSCAR/extension/ggwebservices/classes/ggxmlrpcclient.php" );
include_once( "/var/www/OSCAR/extension/ggwebservices/classes/ggxmlrpcrequest.php" );
include_once( "/var/www/OSCAR/extension/ggwebservices/classes/ggxmlrpcresponse.php" );
include_once( "/var/www/OSCAR/extension/ggwebservices/classes/ggwebservicesclient.php" );
// create a new client
$client = new ggXMLRPCClient("localhost","/OSCAR/extension/ggwebservices/classes/ezserver.php","80"blunk.gif Emoticon;
$namespace = "http://soapinterop.org/";
$request = new ggXMLRPCRequest("addNumbers"blunk.gif Emoticon;
$request->addParameter("valueA", 47);
$request->addParameter("valueB", 45);
// send the request to the server and fetch the response
$response = $client->send($request);
print_r($response);
// check if the server returned a fault, if not print out the result
if ( $response->isFault() )
{
print( "SOAP fault: " . $response->faultCode(). " - " . $response->faultString() . "" );
}
else
{
print( "Returned SOAP value was: \"" . $response->value() . "\"" );
}


?>

this my client side code can u say what is the problem in this code.

<?php
include_once( "/var/www/OSCAR/extension/ggwebservices/classes/ggxmlrpcserver.php" );
include_once( "/var/www/OSCAR/extension/ggwebservices/classes/ggxmlrpcrequest.php" );
$server = new ggXMLRPCServer();
$server->registerFunction( "addNumbers", array( "valueA" => "int", "valueB" => "int"blunk.gif Emoticon);
$server->processRequest();
function addNumbers($valueA, $valueB)
{

$return = $valueA + $valueB;
settype( $return, "int" );
return $return;
}

?>

admin side code.

Can u say what is the problem in this code.

By writing logging='info' its not creating the log file.

Modified on Wednesday 20 October 2010 12:54:05 pm by namita varshney

Friday 22 October 2010 2:14:57 pm

How can i integrate ggwebservices in ASP.NET?

Friday 22 October 2010 6:34:37 pm

@namita: I am under the impression that you are trying to use the ggwebservices code outside of the scope of the eZ Publish application.

If it is so, I am afraid to tell you that this is not within the goals of ggwebservices: it has been developed as an extension to the eZPublish CMS, and there is no guarantee at all that it will ever work if used standalone. It might, but it also might not - and I cannot promise to have any time to dedicate to fix any errors you encounter for such a use case.

In particular, the webservices client classes might work, but the webservices server classes need an eZPublish server to work at all.

If you just want to execute xmlrpc or jsonrpc calls, or received those calls in a php app outside of eZPublish the phpxmlrpc extension available of http://phpxmlrpc.sourceforge.net might be a better fit.

If you want to execute or receive soap calls in a php app outside of eZPublish, the NuSOAP extension or simply the php native soap support might be a better fit.

Last but not least, answering to the question "How can i integrate ggwebservices in ASP.NET?": surely not by using classes that have XMLRPC in their name. Try using the ones that have SOAP in it.

Friday 22 October 2010 6:53:53 pm

Ok, here is the sample code with a working XMLRPC client, outside the context of eZ Publish. Please note that there is no logging whatsoever done by the client in this case, as the logging is only implemented by the ggeZWebservicesClient client

<pre>
<?php
/**
 * Sample xmlrpc client that uses the ggws classes
 * The server endpoint in use is the public one of the phpxmlrpc.sourceforge.net lib
 */
 
// include client classes (this is done by autload when within an eZP context)
include_once( "ggwebservices/classes/ggwebservicesclient.php" );
include_once( "ggwebservices/classes/ggxmlrpcclient.php" );
include_once( "ggwebservices/classes/ggwebservicesrequest.php" );
include_once( "ggwebservices/classes/ggxmlrpcrequest.php" );
include_once( "ggwebservices/classes/ggwebservicesresponse.php" );
include_once( "ggwebservices/classes/ggxmlrpcresponse.php" );
include_once( "ggwebservices/classes/ggwebservicesclient.php" );
 
// create a new client
$client = new ggXMLRPCClient("phpxmlrpc.sourceforge.net", "/server.php", "80");
// define the request
$request = new ggXMLRPCRequest("examples.addtwo", array(47, 45));
 
// send the request to the server and fetch the response
$response = $client->send($request);
 
// check if the server returned a fault, if not print out the result
if ( $response->isFault() )
{
    print( "Fault: " . $response->faultCode(). " - \"" . $response->faultString() . "\"");
}
else
{
    print( "Returned value was: \"" . $response->value() . "\"" );
}
 
?>

The difference wrt your example is that you should not use named parameters for xmlrpc, as the protocol uses positional ones.

Friday 22 October 2010 7:03:05 pm

And here is the working server - basically your code was fine

<?php
/**
 * Sample xmlrpc server that uses the ggws classes
 */
 
include_once( "ggwebservices/classes/ggwebservicesserver.php" );
include_once( "ggwebservices/classes/ggxmlrpcserver.php" );
include_once( "ggwebservices/classes/ggwebservicesrequest.php" );
include_once( "ggwebservices/classes/ggxmlrpcrequest.php" );
include_once( "ggwebservices/classes/ggwebservicesresponse.php" );
include_once( "ggwebservices/classes/ggxmlrpcresponse.php" );
include_once( "ggwebservices/classes/ggwebservicesfault.php" );
 
$server = new ggXMLRPCServer();
$server->registerFunction( "examples.addtwo", array( "valueA" => "int", "valueB" => "int" ) );
$server->processRequest();
 
function examples_addtwo($valueA, $valueB)
{
    $return = (int)$valueA + (int)$valueB;
    return $return;
}
 
?>

To test if there is any fatal errors, just browse to the server page with a browser. If you get an xml response with an error message, it's ok. If you get a blank page or a php errpr msg, it is not.

NB: a visual debugger (ie. xmlrpc client) is available within the eZ Publish administration interface, when you use the extension within the CMS

Friday 22 October 2010 7:14:37 pm

And here is an example of a working soap client that interacts with a server written in asp.net

<pre>
<?php
/**
 * Sample soap client that uses the ggws classes
 * The server endpoint in use is the public one from mssoapinterop.org
 */
 
// include client classes (this is done by autload when within an eZP context)
include_once( "ggwebservices/classes/ggwebservicesclient.php" );
include_once( "ggwebservices/classes/ggphpsoapclient.php" );
include_once( "ggwebservices/classes/ggwebservicesrequest.php" );
include_once( "ggwebservices/classes/ggphpsoaprequest.php" );
include_once( "ggwebservices/classes/ggwebservicesresponse.php" );
include_once( "ggwebservices/classes/ggphpsoapresponse.php" );
include_once( "ggwebservices/classes/ggwebservicesclient.php" );
 
// create a new client
$client = new ggPhpSOAPClient("mssoapinterop.org", "/asmx/simple.asmx", 80, null, 'http://mssoapinterop.org/asmx/simple.asmx?WSDL' );
// NB: this also works:
//$client = new ggPhpSOAPClient(null, null, null , null, 'http://mssoapinterop.org/asmx/simple.asmx?WSDL');
 
// define the request
$request = new ggPhpSOAPRequest("echoInteger", array(123));
 
// send the request to the server and fetch the response
$response = $client->send($request);
 
// check if the server returned a fault, if not print out the result
if ( $response->isFault() )
{
    print( "Fault: " . $response->faultCode(). " - \"" . $response->faultString() . "\"");
}
else
{
    print( "Returned value was: \"" . $response->value() . "\"" );
}
 
?>

Modified on Friday 22 October 2010 7:21:26 pm by Gaetano Giunta

Monday 25 October 2010 8:41:27 am

my server.php is

<?php
include_once( "ggjsonrpcserver.php" );
$server = new ggJSONRPCServer();
$server->registerFunction( "addNumbers", array( "valueA" => "integer", "valueB" => "integer"blunk.gif Emoticon,"integer"blunk.gif Emoticon;
$server->processRequest();
function addNumbers($valueA, $valueB)
{
$return = (int)$valueA + (int)$valueB;
return $return;
}
?>

When i add parameters in payload in visual ws debugger in jsonrpc

as <param>
<value><int>45</int></value>
</param>
<param>
<value><int>78</int></value>
</param>

then, i got a error.

{"result":null,"error":{"faultCode":-201,"faultString":"Request received from client is not valid according to protocol format"},"id":null}

And if i run this page from browser it ask for save the page.

Thanks

Modified on Monday 25 October 2010 8:43:21 am by namita varshney

Monday 25 October 2010 11:30:21 am

Hello ,

i want to create a webservice in eZ publish and want to consume it in .Net application.

Can it be possible?

Thanks.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from