[BUG][YAXO][3.4a] version madness
Laurence Rozier
laurencerozier at yahoo.com
Thu Nov 14 18:10:38 UTC 2002
Hi,
... and all the time I thought I was the one going
mad! I ran into similar sounding problems after
grabbing the XML-RPC client from:
http://www.langreiter.com/space/SqXR
late last month. After a bunch of head scratching, I
thought that a simple switch from entityAt: to
elementAt: would solve the problem but it didn't. In
addition to entityAt: there's also entities vs
elements. For some reason I can't recall now from
glancing at the code, I ended up using firstTagNamed:
and have been using XML-RPC reliably since. Hopefully
the attached changeset will help you out. Please keep
me posted on how you resolve this. I'd like to put my
app on SqueakMap soon and this seems like it could
prove to be an interesting gotcha.
Regards,
Laurence
--- Avi Bryant <avi at beta4.com> wrote:
>
> On Wed, 13 Nov 2002, Michael Rueger wrote:
> > Well, not really. The date in the change set is
> much newer, but the
> > contents are identical to the code in 3.4 (initial
> release + fixes). (I
> > just did a diff against each other)
>
> Ah, I was getting confused by the changeset date (I
> was working with
> several different images and versions of YAXO this
> morning trying to get
> XML-RPC to work). The changeset I have that has a
> similar date to that in
> 3.4 uses #entityAt: instead of #elementAt:, but the
> code in 3.4 doesn't.
>
> Even so, YAXO is definitely a great candidate to be
> extracted.
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
--0-1724721028-1037297438=:22395
Content-Type: text/plain; name="FIX Synerge-XML-RPC .1.cs"
Content-Description: FIX Synerge-XML-RPC .1.cs
Content-Disposition: inline; filename="FIX Synerge-XML-RPC .1.cs"
'From Squeak3.2 of 11 July 2002 [latest update: #4956] on 14 November 2002 at 12:36:25 pm'!
!XMLRPCDecoder methodsFor: 'as yet unclassified' stamp: 'lpr 11/1/2002 17:26'!
decode: anXMLElement
(anXMLElement firstTagNamed: #value) elements isEmpty
ifTrue: [^ (anXMLElement firstTagNamed: #value) contentString].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #string
ifTrue: [^ ((anXMLElement firstTagNamed: #value)
firstTagNamed: #string) contentString].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #i4
ifTrue: [^ SmallInteger readFrom: ((anXMLElement firstTagNamed: #value)
firstTagNamed: #i4) contentString readStream].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #int
ifTrue: [^ SmallInteger readFrom: ((anXMLElement firstTagNamed: #value)
firstTagNamed: #int) contentString readStream].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #double
ifTrue: [^ Float readFrom: ((anXMLElement firstTagNamed: #value)
firstTagNamed: #double) contentString readStream].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #base64
ifTrue: [^ Base64MimeConverter mimeDecodeToBytes: ((anXMLElement firstTagNamed: #value)
firstTagNamed: #base64) contentString readStream].
((anXMLElement firstTagNamed: #value) elements at: 1) name = (('dateTime.iso8601') asSymbol)
ifTrue: [^ self decodeDateTime: ((anXMLElement firstTagNamed: #value)
firstTagNamed: ('dateTime.iso8601' asSymbol)) contentString].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #boolean
ifTrue: [((anXMLElement firstTagNamed: #value)
firstTagNamed: #boolean) contentString = '1'
ifTrue: [^ True]
ifFalse: [^ False]].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #array
ifTrue: [^ self decodeArray: anXMLElement].
((anXMLElement firstTagNamed: #value) elements at: 1) name = #struct
ifTrue: [^ self decodeStruct: anXMLElement]! !
!XMLRPCDecoder methodsFor: 'as yet unclassified' stamp: 'lpr 11/4/2002 01:23'!
decodeArray: anXMLElement
| coll |
coll _ OrderedCollection new.
(((anXMLElement firstTagNamed: #value)
firstTagNamed: #array)
firstTagNamed: #data) elements
do: [:xmlElem | coll
add: (self
decode: (XMLDocument new addElement: xmlElem ))].
^ coll asArray!
]style[(13 12 4 5 4 4 3 17 10 12 16 6 19 6 19 5 18 9 2 4 11 4 16 11 17 7 9 4 8)f1b,f1cblue;b,f1,f1cblue;i,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cblue;i,f1,f1c200200124,f1,f1c200200124,f1,f1c200200124,f1,f1cred;,f1,f1cblue;i,f1,f1cmagenta;,f1,f1cmagenta;,f1,f1cblue;i,f1,f1cblue;i,f1! !
!XMLRPCDecoder methodsFor: 'as yet unclassified' stamp: 'lpr 11/1/2002 19:51'!
decodeStruct: anXMLElement
| dict |
dict _ Dictionary new.
((anXMLElement firstTagNamed: #value)
firstTagNamed: #struct)
elementsDo: [:each | dict
at: (each firstTagNamed: #name) contentString
put: (self decode: (each firstTagNamed: #value))].
^ dict! !
!XMLRPCRequest methodsFor: 'as yet unclassified' stamp: 'lpr 11/1/2002 18:08'!
execute
| s cmd crlf req list xmldoc |
s _ HTTPSocket initHTTPSocket: endpoint ifError: 'XML-RPC Transport Layer Error'.
crlf _ String crlf.
req _ self build.
cmd _ 'POST ' , endpoint fullPath , ' HTTP/1.0' , crlf , 'User-Agent: synerge SqXR' , crlf , 'Host: ' , endpoint authority , crlf , 'Content-type: text/xml' , crlf , 'Content-length: ' , req size asString , crlf , crlf , req.
s sendCommand: cmd.
list _ s getResponseUpTo: crlf , crlf ignoring: String cr.
"list = header, CrLf, CrLf, beginningOfData"
xmldoc _ XMLDOMParser parseDocumentFrom: (s
getRestOfBuffer: (list at: 3)) contents readStream.
((xmldoc firstTagNamed: #methodResponse) elements at: 1) name = #fault
ifTrue: [self error: 'XML-RPC error: '
, (XMLRPCDecoder new
decode: ((((((xmldoc firstTagNamed: #methodResponse) elements at: 1) elements at: 1) elements at: 1) elements at: 2) elements at: 2))].
^ XMLRPCDecoder new
decode: (((xmldoc firstTagNamed: #methodResponse)
firstTagNamed: #params)
firstTagNamed: #param)"^ cmd, crlf, '- - - ', crlf, (s getRestOfBuffer: (list at: 3)) contents."! !
More information about the Squeak-dev
mailing list
|