Announcement

  •  » Engine
  •  » webservices and WSDL

#1 2009-08-31 10:00:09

crc32
Member
1970-01-01
3

webservices and WSDL

Hi all,

I'd like to be able to create external tools for Piwigo, using webservices, and later on, create webservices useable for the community.

I know that webservices in Piwigo exists, via /mygallery/tools/ws.php.

BUT: right now, these webservices are not useable using regular RAD tool (like Microsoft VisualStudio or Delphi), because there is no WSDL exposed, so it makes it difficult to write webservices clients manually.

Thus, my question is : is it possible to expose Piwigo webservices using the WSDL specfications, so that it looks standard for RAD tools?

Implementing webservices using this web standard shouldn't need much more effort, compared to what was already done ; and this would be a great improvement for current developments.

One easy way I think, if you don't want to modify existing webservices, is to create a new PHP script that would do the interface (or proxy) between regular WSDL and the existing scripts (ws.php)
It would maybe be not so powerful, but very useful !

I think that a SOAP + PHP wizard could do this in one night ;-)

To Piwigo dev team :
1. what do you think?  Is it possible to implement this?
2. is there a reason why WSDL was not used in the first place?

Thanks in advance for your answers.
Christophe

Offline

 

#2 2009-08-31 23:55:51

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: webservices and WSDL

Hi crc32,

I've been working with webservices for 2.5 years approximately. As far as my knowledge currently goes, there are 2 families of webservices: SOAP and REST. (even if many people will tell you "webservice = SOAP = WSDL", I consider that SOAP and REST have the same purpose so I call them webservices in the same way)

SOAP is the long time industry standard. The purpose was to make things simple. In my opinion, they failed. You just can't use SOAP "by hand", you absolutely need a RAD and a wizard to create a stub/skeleton on your webservice. For having used it quite a lot with nusoap on PHP and SOAP::Lite with Perl, my conclusion is that I don't like SOAP.

REST is the newcomer. It's much simpler. You can code it by hand. On the client side, you perform a simple HTTP request with parameters in GET or POST. The result is in the HTTP answer body. The format is not a constraint, it can be XML, plain text, JSON, whatever. What I like most is a JSON answer. On the client side I perform a "json_decode" and I get a nice data structure.

Currently, rvelices has only implemented the REST method with several result formats. My opinion is that it is already enough.

You can see an example of how to use Piwigo web API with piwigo_remote.pl that is included in the "tools" directory of every Piwigo distribution. It's as simple as:

Code:

if ($opt{action} eq 'pwg.tags.getAdminList') {
    $query = pwg_ws_get_query(
        method => 'pwg.tags.getAdminList'
    );

    $result = $ua->get($query);
    my $tags = from_json($result->content)->{result}{tags};

    foreach my $tag (@{$tags}) {
        # print join(',', keys %{$tag}), "\n"; exit();
        printf(
            '{%u} %s ',
            $tag->{id},
            $tag->{name}
        );
    }

    print "\n";
}

It's just impossible to make it as simple with SOAP, but SOAP + wizard generated stub should be as good I think. As a lover of "hand made code" I love the REST way of doing webservices and I hate the SOAP way (that's my personnal opinion).

Offline

 

#3 2009-09-01 00:07:25

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: webservices and WSDL

I'm sorry, I realize my previous post was only to say I didn't like SOAP. I forgot to ask the important questions:

What kind of client side tool would you like to develop? (something like pLoader for example?)
Which web API methods do you need?

2. is there a reason why WSDL was not used in the first place?

I've notified rvelices about this question. He implemented the webservice architecture.

Offline

 

#4 2009-09-01 09:33:15

crc32
Member
1970-01-01
3

Re: webservices and WSDL

Hi plg,
thanks for this clear answer, which shows that the technology was choosen with care.

Actually, I also like hand-made things, that are often just the only way to do fast things.

In the company I work for, I made several frontoffice websites, and at a time, I started to use Ajax and webservices, but, found that SOAP stuff was too heavy, and decided to do my own way of doing it.
the fact is, it's much faster and easy to read that SOAP.
But on the other hand, I can't use RAD tools to connect to my webservices. I have to use my own API, and code by hand all client applications.

So, I started to admit that I had to sacrify a little on plain performance, for the sake of development simplicity, using RAD tools, instead of manual coding. Why? well, just to reduce development costs (time is money) :)

All this "bla-bla" to say that now, I start to like these standards that simplify our dev life.
I've been using Borland Delphi and other Borland tools for years now (since 90), and I started to use tools like Microsoft Visual Studio, that IMO are a real beauty, just like Delphi was in the early years of RAD.

Yes I would like to use Studio to develop tools for piwigo, because we can make powerful things with this, and I really like the multi-tier architecture for web dev.
Of course the 1st tool I think of, is an equivalent of pLoader, but I would like to go much further than that.
Also, I think that interoperability tools are important (gateways between systems).

I'm not yet a SOAP guru, as I just rely on SOAP magic using RAD tools : I just realized how easy it was, to write a webservice client application with Visual Studio, when connecting to a standard-compliant server. In a few clicks, you can start writing your client app code without reading any XML. (or JSON or whatever)

-> What I would like is to be able to use such RAD tools, to hide the complexity of the protocol, and concentrate on the IMPLEMENTATION : The client code.

I think you get the idea ;-)

Regarding Piwigo, I think that the thing I need, is a C# Class that implements the Piwigo webservice. The protocol behind, actually is not important, as the class hides this to the client code.

I could try to write such a class by hand, but I'm pretty sure that someone that knows the project better can do it much better job than me.

Kind regards
Christophe

Last edited by crc32 (2009-09-01 09:36:24)

Offline

 

#5 2009-09-01 09:38:29

crc32
Member
1970-01-01
3

Re: webservices and WSDL

Oh yes I forgot : I'm really not a PERL specialist. I can read it, but it's hard for me to get it sometimes.

Offline

 

#6 2009-09-01 17:52:49

bayral
Member
2009-09-01
14

Re: webservices and WSDL

Hi there,


I'm now working on such a library (c# proxy for piwigo web service).
The service layer may by use by any C# application.
That I need, It is a application that can syncronise any modification on the pictures or directory tree on my disk to the piwigo gallery.

A other hand of this application can be to browse the gallery in a beautifful WPF application.

The work I have achieve a this point, is that I have map session information to a C# class, and i can connect my self, and disconnect.


I may be interresting by help for completing this proxy lib, or doing the client application.

Offline

 

#7 2009-09-01 21:01:01

rvelices
Former Piwigo Team
2005-12-29
1960

Re: webservices and WSDL

In fact the "web service" in piwigo is flexible enough to allow writing new protocols on the server side with some restrictions...
It would be quite easy to implement XML RPC for example.
For SOAP it would be easy to implement the method signature (we already have introspection capabilities), however the type of return value of every method cannot be known in advance so you would still need to do some work to "decode" data.

In addition, we can extend the web service with aditionnal methods at runtime using plugins. I think this is not something that you can "RAD" with MS VS.

Offline

 

#8 2009-09-02 00:57:37

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: webservices and WSDL

bayral wrote:

I'm now working on such a library (c# proxy for piwigo web service).

If I understand correctly, you're "the one", the one crc32 was expecting to come :-)

bayral wrote:

That I need, It is a application that can syncronise any modification on the pictures or directory tree on my disk to the piwigo gallery.

A other hand of this application can be to browse the gallery in a beautifful WPF application.

[...]

I may be interresting by help for completing this proxy lib, or doing the client application.

This is very interesting. I don't have any skills in C# or Windows GUI programming, but I know Piwigo web API quite well. I'm sure that if you work on a client application you will certainly need some improvement on the GUI. Create topics on the forum to ask for API improvements, I already work this way with ron on pLoader.

If you're interested, don't hesitate to ask for a Subversion dedicated directory on Piwigo.org Subversion repository. This way you'll be able to collaborate and show your current work. Read [Forum, topic 15099] Host your extension code on Piwigo Subversion repository

Offline

 

#9 2009-09-02 00:59:34

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: webservices and WSDL

crc32 wrote:

I think that a SOAP + PHP wizard could do this in one night ;-)

Do you mean something automatic that would do 90% of the job? If yes, that's interesting of course and I would like to know more about it :-)

Offline

 

#10 2009-09-04 14:32:38

bayral
Member
2009-09-01
14

Re: webservices and WSDL

a little piece of documentation it is existing about web service, or the only documentation than I can found is the tool/ws.htm documenation provided ?

Offline

 

#11 2009-09-04 16:13:47

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: webservices and WSDL

We can translate some... (In the French Wiki, in fact I hope so).
HTH.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#12 2009-09-04 17:57:32

bayral
Member
2009-09-01
14

Re: webservices and WSDL

I'm french speaking, so french documentation is better for me, but I can't found it.

Can I ask you a url ?

Offline

 

#13 2009-09-04 18:45:08

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: webservices and WSDL

Les Web Services
in French (but samples might be useful for any language including Perl and php).

;-)


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#14 2009-09-08 16:16:47

bayral
Member
2009-09-01
14

Re: webservices and WSDL

Hello,

I have done a big part of the job of my C# proxy lib for piwigo WS.

I have all pwg.session, pwg.tags.* and pwg.category.* including the getImage working pretty good.

I have to start with the pwg.image.* functions.

I have somes questions :

1/pwg.images.add:
what is the *_sum parameters ? md5 sum of theses files ? what is the difference between file_sum and original_sum ?
tag_ids : how are code le list og tags id  ? comma separed ?
how to comptute the directory tree where the method look for the files ?

2/pwg.images.addChunk: what is these method for ?

3/pwg.images.addComment :
what is the key parameter for ?

4/pwg.images.exist
md5sum_list : it is the md5 of the original file ? the list is comma separated ?

5/ pwg.images.search
what is the correct list of field for querying ?

6/pwg.images.setPrivacyLevel
what is the correct value for level parameter ?

thank a lot.

Offline

 
  •  » Engine
  •  » webservices and WSDL

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact