Search the web
Sign In
New User? Sign Up
yws-flickr · YDN Flickr Developer Support Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
WSDL from Flickr: unorthodox SOAP invocation?   Message List  
Reply | Forward Message #2807 of 5445 |
I've been interested in generating WSDL from the Flickr reflection
methods to generate a library that could better keep up with the
changes in the Flickr APIs. However, I've run into a problem that
stems from what I believe to be either unorthodox SOAP syntax in
Flickr -- or just the limitations in my own understanding of WSDL and
SOAP.

Here's what I did. I first set out to invoke the flickr.test.echo
mthod (http://www.flickr.com/services/api/flickr.test.echo.html) by
generating the right WSDL to call the flickr.test.echo SOAP method.
The documentation for SOAP invocation is found at
http://www.flickr.com/services/api/request.soap.html

The following SOAP message works with the Flickr SOAP endpoint
(http://api.flickr.com/services/soap/)

<?xml version='1.0' encoding='UTF-8'?>
<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<s:Body>
<x:FlickrRequest xmlns:x='urn:flickr'>
<method>flickr.test.echo</method>
<api_key>e81ef8102a5160154ef4662adcc9046b</api_key>
</x:FlickrRequest>
</s:Body>
</s:Envelope>

You can try this out with curl:

curl -d "<?xml version='1.0' encoding='UTF-8'?><s:Envelope
xmlns:s='http://www.w3.org/2003/05/soap-envelope'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><s:Body><x:FlickrRequest
xmlns:x='urn:flickr'><method>flickr.test.echo</method>
<api_key>e81ef8102a5160154ef4662adcc9046b</api_key></x:FlickrRequest></s:Body></\
s:Envelope>"
http://api.flickr.com/services/soap/

The problem I'm running into now is to how to get this SOAP call
expressed in WSDL. My first shot is:

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://mashupguide.net"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://mashupguide.net" name="FlickrService">
<message name="flickr.test.echo_Request">
<part name="method" type="xsd:string"/>
<part name="api_key" type="xsd:string"/>
</message>
<message name="flickr.test.echo_Response">
<part name="response" type="xsd:string"/>
</message>
<portType name="flickr.test.echo_PortType">
<operation name="FlickrRequest">
<input message="tns:flickr.test.echo_Request"/>
<output message="tns:flickr.test.echo_Response"/>
</operation>
</portType>
<binding name="Flickr_Binding" type="tns:flickr.test.echo_PortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="FlickrRequest">
<soap:operation soapAction="FlickrRequest"/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:flickr"/>
</input>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:flickr"/>
</output>
</operation>
</binding>
<service name="Flickr">
<documentation>WSDL File for Flickr</documentation>
<port name="Flickr_Port" binding="tns:Flickr_Binding">
<soap:address location="http://api.flickr.com/services/soap/"/>
</port>
</service>
</definitions>


which, using XML-Spy gets me a SOAP body of

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:FlickrRequest xmlns:m="urn:flickr">
<method xsi:type="xsd:string">String</method>
<api_key xsi:type="xsd:string">String</api_key>
</m:FlickrRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I then have to fill out the method -> flickr.test.echo and the api_key
-> e81ef8102a5160154ef4662adcc9046b -- and that gets me what I want
-- sorta.

The problem is that 1) I shouldn't have to fill out the method name --
that's what I want the WSDL to have to generate and 2) I can't see a
way to add other Flickr methods to the same WSDL file because they all
invoke a FlickrRequest method -- and pass the real method name as a
method parameter. I'm getting the sense that if Flickr used the
following SOAP body instead;

<?xml version='1.0' encoding='UTF-8'?>
<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<s:Body>
<x:flickr.test.echo xmlns:x='urn:flickr'>
<api_key>e81ef8102a5160154ef4662adcc9046b</api_key>
</x:flickr.test.echo>
</s:Body>
</s:Envelope>

I'd be able to generate the WSDL w/o any problem.

Do you any way around this problem? I could generate one WSDL file
for each Flickr method -- but that doesn't seem quite right either.

Thanks,
-Raymond







Mon Feb 19, 2007 2:01 am

rdhyee
Online Now Online Now
Send Email Send Email

Forward
Message #2807 of 5445 |
Expand Messages Author Sort by Date

I've been interested in generating WSDL from the Flickr reflection methods to generate a library that could better keep up with the changes in the Flickr APIs....
Raymond Yee
rdhyee
Online Now Send Email
Feb 19, 2007
2:01 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help