PDA

View Full Version : Dumb question time...


luke_church
Sep-07-2005, 07:46 AM
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:


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>

<?xml version="1.0" encoding="iso-8859-1"?>
<METHODRESPONSE>











<VALUE>

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

Nikolai
Sep-07-2005, 09:02 AM
.. 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

luke_church
Sep-07-2005, 09:11 AM
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 (http://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

onethumb
Sep-08-2005, 09:57 AM
Yup, that's the way my XML-RPC thing talks. I believe it's part of the standard?

www.xmlrpc.com/spec (http://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

luke_church
Sep-08-2005, 10:47 AM
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:

<struct>
<member>
<name>Caption</name>
<value>
<string>capt</string>
</value>
</member>
etc...


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

luke_church
Sep-08-2005, 01:42 PM
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


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>



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

Nikolai
Sep-08-2005, 02:16 PM
Just FYI..

Cheers!

Nik

luke_church
Sep-08-2005, 02:49 PM
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" ?>
- (http://api.smugmug.com/hack/rest/?method=smugmug.images.changeSettings&SessionID=4ae276dfe9011479477c2a04e6ad8aee&ImageID=35108687&AlbumID=790909&Caption=capfdsat&Keywords=keyw#) <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

luke_church
Sep-08-2005, 02:56 PM
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

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

Hope this helps,

Luke

onethumb
Sep-08-2005, 07:47 PM
Sorry to be really dumb here, but...

XML:

<struct>
<member>
<name>Caption</name>
<value>
<string>capt</string>
</value>
</member>
etc...


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

Nikolai
Sep-08-2005, 08:06 PM
Star*Explorer doesn't use changeSettings? Is that true, Nik?
Don
Not yet.

luke_church
Sep-09-2005, 04:41 AM
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:


<?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>


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

Cheers,

Luke

onethumb
Sep-09-2005, 09:18 AM
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:


<?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>


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

luke_church
Sep-09-2005, 12:22 PM
Don,

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

Sorry, no change:


<?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>


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