Options

Dumb question time...

luke_churchluke_church Registered Users Posts: 507 Major grins
Hi Guys,

Can someone point out what I'm doing wrong in trying to use the method to change the image settings... Most likely to be something chronically dumb, but I can't see it at the moment...

The below was taken off the wire by Ethereal.

Many thanks...

Luke

[PS. the Session info is stripped, but I don't think that's problem, I can do other operations fine, it's just this one that dies...]

So I have utterly failed to prevent nasty things happening to my XML. It's available here

(Editted to prevent vB massacring my XML)

XML available here:

http://www.polymorphix.net/TechResources/XMLRPCDump.txt

and (maybe) below:

[php]
POST /hack/xmlrpc/
HTTP/1.1 Content-Type: text/xml
User-Agent: XML-RPC.NET
Content-Length: 890
Expect: 100-continue
Host: api.smugmug.com
HTTP/1.1 100 Continue
<?xml version="1.0"?>
<methodCall>
<methodName>smugmug.images.changeSettings</methodName>
<params>
<param>
<value>
<string>...</string>
</value>
</param>
<param>
<value>
<i4>35089759</i4>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>Caption</name>
<value>
<string>capt</string>
</value>
</member>
<member>
<name>AlbumID</name>
<value>
<i4>790513</i4>
</value>
</member>
<member>
<name>Keywords</name>
<value>
<string>keyw</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
HTTP/1.1 200 OK
Date: Wed, 07 Sep 2005 15:35:55 GMT
Server: Apache
X-Powered-By: smugmug/1.2.0
Cache-Control: private, max-age=1, must-revalidate
Pragma:
Set-Cookie: ...; path=/; domain=.smugmug.com
ETag: sm-2beab780519903ae9dbbddf8df287383-sm
Content-Length: 151
Content-Type: text/xml
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<string/>
</value>
</param>
</params>
</methodResponse>

[/php]<?xml version="1.0" encoding="iso-8859-1"?>
<METHODRESPONSE>











<VALUE>

<STRING />
</VALUE>
</PARAM>
</PARAMS>
</METHODRESPONSE>

Comments

  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited September 7, 2005
    Th only two things..
    .. I noticed are:
    1)I think I'm using int instead of i4
    2) according to the doc, the syntax is
    String SessionID
    int ImageID
    struct
    • int "AlbumID"
    • String "Caption"
    • String "Keywords"
    In your example Caption and AlbumID are switched, Caption goes first..

    Not sure if this is the reason..

    HTH
    "May the f/stop be with you!"
  • Options
    luke_churchluke_church Registered Users Posts: 507 Major grins
    edited September 7, 2005
    Nikolai wrote:
    1)I think I'm using int instead of i4
    Yup, that's the way my XML-RPC thing talks. I believe it's part of the standard?

    www.xmlrpc.com/spec


    It seemed to work on previous calls anyhow...
    2) according to the doc, the syntax is
    String SessionID
    int ImageID
    struct
    • int "AlbumID"
    • String "Caption"
    • String "Keywords"
    I wondered about that as well. Again, O'Reilly states: 'It (XML-RPC Standard) does specify, however, that the list of members be considered unordered'

    Also if my memory serves me correctly, a previous call with these in the 'correct' order got the same result back...

    I'll see whether I can kick my XML-RPC generator into doing it in the right order again...

    Thanks for the hints anyhow, I'll see whether I can test them...

    Cheers,

    Luke
  • Options
    onethumbonethumb Administrators Posts: 1,269 Major grins
    edited September 8, 2005
    Yup, that's the way my XML-RPC thing talks. I believe it's part of the standard?

    www.xmlrpc.com/spec


    It seemed to work on previous calls anyhow...

    I wondered about that as well. Again, O'Reilly states: 'It (XML-RPC Standard) does specify, however, that the list of members be considered unordered'

    Also if my memory serves me correctly, a previous call with these in the 'correct' order got the same result back...

    I'll see whether I can kick my XML-RPC generator into doing it in the right order again...

    Thanks for the hints anyhow, I'll see whether I can test them...

    Cheers,

    Luke

    Actually, it's impossible for us (or anyone else) to use them unordered. Just look at the XML, there's no name to associate the value with.

    Only if you go with a struct containing name=value pairs can we support unordered requests. (Note that the BETA version of the API does support using named values. Of course, I can't get anyone to TEST the BETA API so we can't release it... but that's another issue entirely.)

    So you definitely need to make sure the order is correct. Lots of apps are using changeSettings, so I believe it works properly, but you never know -there might be a bug. :)

    Don
  • Options
    luke_churchluke_church Registered Users Posts: 507 Major grins
    edited September 8, 2005
    onethumb wrote:
    Actually, it's impossible for us (or anyone else) to use them unordered. Just look at the XML, there's no name to associate the value with.
    Sorry to be really dumb here, but...

    XML:
    [php]
    <struct>
    <member>
    <name>Caption</name>
    <value>
    <string>capt</string>
    </value>
    </member>
    etc...
    [/php]

    has Member, name, end name, value, end value, end member. Isn't this the name value pair?

    Note that this is for a struct definition block. What you say is obviously correct outside a struct definition and indeed the ordering was correct outside that definition...

    (As you can tell, this is the first XML-RPC code I've written, so please bear with me...)
    Only if you go with a struct containing name=value pairs can we support unordered requests. (Note that the BETA version of the API does support using named values. Of course, I can't get anyone to TEST the BETA API so we can't release it... but that's another issue entirely.)
    OK, thank you. I'll do testing on the ordering, and perhaps try against your beta interface.
    So you definitely need to make sure the order is correct. Lots of apps are using changeSettings, so I believe it works properly, but you never know -there might be a bug. :)
    Ok sure, thanks for your time. I'll look into ASAP and post with results from more agressive testing.

    Cheers,

    Luke
  • Options
    luke_churchluke_church Registered Users Posts: 507 Major grins
    edited September 8, 2005
    Seemingly it's not ordering...
    So you definitely need to make sure the order is correct.
    The issue is independent of the ordering. By manually editting my XML-RPC's library's internal generation (HHmmm... Hideous...) I forced the following to be emitted:

    URL if the below looks silly (The Gods of IT are angry with me at the moment) :uhoh :
    http://polymorphix.net/TechResources/XMLRPCDump2.txt

    [php]
    POST /hack/xmlrpc/ HTTP/1.1
    Content-Type: text/xml
    User-Agent: XML-RPC.NET
    Content-Length: 894
    Expect: 100-continue
    Host: api.smugmug.com
    <?xml version="1.0"?>
    <methodCall>
    <methodName>smugmug.images.changeSettings</methodName>
    <params>
    <param>
    <value>
    <string>...</string>
    </value>
    </param>
    <param>
    <value>
    <i4>35089313</i4>
    </value>
    </param>
    <param>
    <value>
    <struct>
    <member>
    <name>AlbumID</name>
    <value>
    <i4>790504</i4>
    </value>
    </member>
    <member>
    <name>Caption</name>
    <value>
    <string>capfdsat</string>
    </value>
    </member>
    <member>
    <name>Keywords</name>
    <value>
    <string>keyw</string>
    </value>
    </member>
    </struct>
    </value>
    </param>
    </params>
    </methodCall>
    HTTP/1.1 100 Continue
    HTTP/1.1 200 OK
    Date: Thu, 08 Sep 2005 21:06:27 GMT
    Server: Apache
    X-Powered-By: smugmug/1.2.0
    Cache-Control: private, max-age=1, must-revalidate
    Pragma:
    Set-Cookie: SMSESS=...; path=/; domain=.smugmug.com
    ETag: sm-2beab780519903ae9dbbddf8df287383-sm
    Content-Length: 151
    Content-Type: text/xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <methodResponse>
    <params>
    <param>
    <value>
    <string/>
    </value>
    </param>
    </params>
    </methodResponse>
    [/php]


    So pretty much the same as before...

    This is running against 1.1.0, I get a different set of issues against 1.1.1, if you're interested, I'll share my test results, but I was kind of working on the basis of getting it all working against 1.1.0 first...
    Lots of apps are using changeSettings, so I believe it works properly.
    Sure, I'm sure I'll be doing something daft, just a question of spotting it...

    Could you let me know of an app that I could look at the XML trace for thats using changeSettings?

    So far, I've looked at:

    S*E -> doesn't

    sendToSmugmug -> Method isn't implemented (I'm trying :-))

    FxFoto, doesn't seem to support keywords with Smugmug. Keywords didn't appear, and the command wasn't clearly called in the XML communication

    Rutt's Python script -> I couldn't see it, but I'm not (yet) a Python developer. It didn't seem to be using it though.

    Unfortunately I don't have a Mac... If it's one of them, I might be able to lean on a friend to get me an XML trace though...

    Cheers,

    Luke
  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited September 8, 2005
    Your XML is visible OK
    Just FYI..

    Cheers!

    Nik
    "May the f/stop be with you!"
  • Options
    luke_churchluke_church Registered Users Posts: 507 Major grins
    edited September 8, 2005
    I get a similar issue from REST:

    URL: (SessionID removed)
    http://api.smugmug.com/hack/rest/?method=smugmug.images.changeSettings&SessionID=...ID=35089313&AlbumID=790504&Caption=capfdsat&Keywords=keyw

    Response:
    <?xml version="1.0" encoding="utf-8" ?>
    - <rsp stat="ok">
    <method>smugmug.images.changeSettings</method>

    <result />

    </rsp>


    [/php]</FONT></SPAN>



    Which shows the same 'empty' result, and it doesn't seem to have updated the information associated with the photo...

    Nor does it matter whether the album is public or not.


    Cheers,

    Luke
  • Options
    luke_churchluke_church Registered Users Posts: 507 Major grins
    edited September 8, 2005
    REST against BETA
    However REST against BETA, returns a different error:

    http://api.smugmug.com/hack/rest/beta.mg?method=smugmug.images.changeSettings&SessionID=...&ImageID=35108687&AlbumID=790909&Caption=capfdsat&Keywords=keyw
    Returns

    [PHP] <?xml version="1.0" encoding="utf-8" ?> - <rsp stat="fail"> <err code="5" msg="system error" /> </rsp>[/PHP]

    Hope this helps,

    Luke
  • Options
    onethumbonethumb Administrators Posts: 1,269 Major grins
    edited September 8, 2005
    Sorry to be really dumb here, but...

    XML:
    [php]
    <struct>
    <member>
    <name>Caption</name>
    <value>
    <string>capt</string>
    </value>
    </member>
    etc...
    [/php]

    has Member, name, end name, value, end value, end member. Isn't this the name value pair?

    Note that this is for a struct definition block. What you say is obviously correct outside a struct definition and indeed the ordering was correct outside that definition...

    (As you can tell, this is the first XML-RPC code I've written, so please bear with me...)


    OK, thank you. I'll do testing on the ordering, and perhaps try against your beta interface.


    Ok sure, thanks for your time. I'll look into ASAP and post with results from more agressive testing.

    Cheers,

    Luke

    Woops, yes, your stuff has name=value pairs.

    Alas, the non-BETA API doesn't support this, so we just look for the values in order.

    Sorry!

    I'm taking a closer look at this when I get a chance (I'm in the process of moving, so it might not happen until Tuesday next week, but I'll do my best to do it earlier). If you send non-struct requests with the data ordered properly, it should work fine.

    Star*Explorer doesn't use changeSettings? Is that true, Nik?

    Don
  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited September 9, 2005
    changeSettings
    onethumb wrote:
    Star*Explorer doesn't use changeSettings? Is that true, Nik?
    Don
    Not yet.
    "May the f/stop be with you!"
  • Options
    luke_churchluke_church Registered Users Posts: 507 Major grins
    edited September 9, 2005
    onethumb wrote:
    Woops, yes, your stuff has name=value pairs.

    Alas, the non-BETA API doesn't support this, so we just look for the values in order.

    Sorry!
    That's fine. I can't sensibly order structs, but I can order just the data. No problem.
    I'm taking a closer look at this when I get a chance (I'm in the process of moving, so it might not happen until Tuesday next week,
    Surely. BTW, I saw the ultrasound on your website. Congrats, hope all is well.
    but I'll do my best to do it earlier). If you send non-struct requests with the data ordered properly, it should work fine.
    It doesn't seem to. I've modified the call, so it thinks it's just throwing ordered data at the API, and I get the same response:

    [php]
    <?xml version="1.0"?>
    <methodCall>
    <methodName>smugmug.images.changeSettings</methodName>
    <params>
    <param>
    <value>
    <string>...</string>
    </value>
    </param>
    <param>
    <value>
    <i4>35089313</i4>
    </value>
    </param>
    <param>
    <value>
    <i4>790504</i4>
    </value>
    </param>
    <param>
    <value>
    <string>capfdsat</string>
    </value>
    </param>
    <param>
    <value>
    <string>keyw</string>
    </value>
    </param>
    </params>
    </methodCall>
    HTTP/1.1 200 OK
    Date: Fri, 09 Sep 2005 12:22:13 GMT
    Server: Apache
    X-Powered-By: smugmug/1.2.0
    Cache-Control: private, max-age=1, must-revalidate
    Pragma:
    Set-Cookie: SMSESS=...; path=/; domain=.smugmug.com
    ETag: sm-2beab780519903ae9dbbddf8df287383-sm
    Content-Length: 151
    Content-Type: text/xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <methodResponse>
    <params>
    <param>
    <value>
    <string/>
    </value>
    </param>
    </params>
    </methodResponse>
    [/php]

    If there's any other info that I can get you, just give me a yell.

    Cheers,

    Luke
  • Options
    onethumbonethumb Administrators Posts: 1,269 Major grins
    edited September 9, 2005
    That's fine. I can't sensibly order structs, but I can order just the data. No problem.


    Surely. BTW, I saw the ultrasound on your website. Congrats, hope all is well.


    It doesn't seem to. I've modified the call, so it thinks it's just throwing ordered data at the API, and I get the same response:

    [php]
    <?xml version="1.0"?>
    <methodCall>
    <methodName>smugmug.images.changeSettings</methodName>
    <params>
    <param>
    <value>
    <string>...</string>
    </value>
    </param>
    <param>
    <value>
    <i4>35089313</i4>
    </value>
    </param>
    <param>
    <value>
    <i4>790504</i4>
    </value>
    </param>
    <param>
    <value>
    <string>capfdsat</string>
    </value>
    </param>
    <param>
    <value>
    <string>keyw</string>
    </value>
    </param>
    </params>
    </methodCall>
    HTTP/1.1 200 OK
    Date: Fri, 09 Sep 2005 12:22:13 GMT
    Server: Apache
    X-Powered-By: smugmug/1.2.0
    Cache-Control: private, max-age=1, must-revalidate
    Pragma:
    Set-Cookie: SMSESS=...; path=/; domain=.smugmug.com
    ETag: sm-2beab780519903ae9dbbddf8df287383-sm
    Content-Length: 151
    Content-Type: text/xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <methodResponse>
    <params>
    <param>
    <value>
    <string/>
    </value>
    </param>
    </params>
    </methodResponse>
    [/php]

    If there's any other info that I can get you, just give me a yell.

    Cheers,

    Luke

    Think I found a bug! Give it a shot now.

    (Should, at the very least, return a non-empty result in case of error, I hope.)

    Don
  • Options
    luke_churchluke_church Registered Users Posts: 507 Major grins
    edited September 9, 2005
    Don,

    Sorry for the delay, had a network outage at this end...

    Sorry, no change:

    [php]
    <?xml version="1.0"?>
    <methodCall>
    <methodName>smugmug.images.changeSettings</methodName>
    <params>
    <param>
    <value>
    <string>...</string>
    </value>
    </param>
    <param>
    <value>
    <i4>35089313</i4>
    </value>
    </param>
    <param>
    <value>
    <i4>790504</i4>
    </value>
    </param>
    <param>
    <value>
    <string>capfdsat</string>
    </value>
    </param>
    <param>
    <value>
    <string>keyw</string>
    </value>
    </param>
    </params>
    </methodCall>HTTP/1.1 200 OK
    Date: Fri, 09 Sep 2005 20:20:46 GMT
    Server: Apache
    X-Powered-By: smugmug/1.2.0
    Cache-Control: private, max-age=1, must-revalidate
    Pragma:
    Set-Cookie: SMSESS=...; path=/; domain=.smugmug.com
    ETag: sm-2beab780519903ae9dbbddf8df287383-sm
    Content-Length: 151
    Content-Type: text/xml

    <?xml version="1.0" encoding="iso-8859-1"?>
    <methodResponse>
    <params>
    <param>
    <value>
    <string/>
    </value>
    </param>
    </params>
    </methodResponse>
    [/php]
    onethumb wrote:
    Think I found a bug! Give it a shot now.

    (Should, at the very least, return a non-empty result in case of error, I hope.)

    Don
Sign In or Register to comment.