Hi!
I'm having a problem on production, and I can't fix it... I have to make a HTTP request to get some data for OpenID, This is my call: askRpxData: token ^PlatformSupport current httpPostDocument: self authUrl args: (Dictionary new at: 'apiKey' put: self apiKey; at: 'token' put: token; at: 'format' put: 'xml'; yourself) request: '' ...and this is the method who makes the request httpPostDocument: urlString args: aDictionary request: contents | url request result parameters bodyContents | url := HyURI fromStream: urlString readStream. request := HTTPPost usingURI: url. parameters := String streamContents: [ :stream | aDictionary associations do: [ :each | stream nextPutAll: each key; nextPut: $=; nextPutAll: each value ] separatedBy: [ stream nextPut: $& ] ]. bodyContents := parameters, String crlf, String crlf, contents. request headers addField: (HTTPHostField new hostName: url hostname); addField: (HTTPAcceptField new addMediaType: 'text/html'; addMediaType: '*/*'; yourself); addField: (HTTPContentLengthField new contentLength: bodyContents size); addField: (ContentTypeField new mediaType: 'application/x-www-form-urlencoded'). request entityBody: bodyContents. result := (HyHTTPClient new forRequest: request) response. ^result messageBody entityBody asString should be working, but no success :( I think the post is wrong created, but I can't find the error. Please, any help will be very welcome. Thanks, Esteban |
Esteban,
I'm headed out on vacation today (leaving shortly), but I'll try to take a look at this problem a little bit this evening... Dale Esteban Lorenzano wrote: > Hi! > I'm having a problem on production, and I can't fix it... I have to make a HTTP request to get some data for OpenID, This is my call: > > askRpxData: token > ^PlatformSupport current > httpPostDocument: self authUrl > args: (Dictionary new > at: 'apiKey' put: self apiKey; > at: 'token' put: token; > at: 'format' put: 'xml'; > yourself) > request: '' > > ...and this is the method who makes the request > > httpPostDocument: urlString args: aDictionary request: contents > | url request result parameters bodyContents | > > url := HyURI fromStream: urlString readStream. > request := HTTPPost usingURI: url. > > parameters := String streamContents: [ :stream | > aDictionary associations > do: [ :each | stream nextPutAll: each key; nextPut: $=; nextPutAll: each value ] > separatedBy: [ stream nextPut: $& ] ]. > > bodyContents := parameters, String crlf, String crlf, contents. > > request headers > addField: (HTTPHostField new hostName: url hostname); > addField: (HTTPAcceptField new > addMediaType: 'text/html'; > addMediaType: '*/*'; > yourself); > addField: (HTTPContentLengthField new contentLength: bodyContents size); > addField: (ContentTypeField new mediaType: 'application/x-www-form-urlencoded'). > > request entityBody: bodyContents. > result := (HyHTTPClient new forRequest: request) response. > ^result messageBody entityBody asString > > should be working, but no success :( > I think the post is wrong created, but I can't find the error. > > Please, any help will be very welcome. > > Thanks, > Esteban |
Thanks, Dale
El 28/06/2010, a las 3:28p.m., Dale Henrichs escribió: > Esteban, > > I'm headed out on vacation today (leaving shortly), but I'll try to take a look at this problem a little bit this evening... > > Dale > > Esteban Lorenzano wrote: >> Hi! >> I'm having a problem on production, and I can't fix it... I have to make a HTTP request to get some data for OpenID, This is my call: askRpxData: token >> ^PlatformSupport current httpPostDocument: self authUrl args: (Dictionary new >> at: 'apiKey' put: self apiKey; >> at: 'token' put: token; >> at: 'format' put: 'xml'; >> yourself) request: '' >> ...and this is the method who makes the request >> httpPostDocument: urlString args: aDictionary request: contents >> | url request result parameters bodyContents | >> url := HyURI fromStream: urlString readStream. >> request := HTTPPost usingURI: url. >> parameters := String streamContents: [ :stream | >> aDictionary associations >> do: [ :each | stream nextPutAll: each key; nextPut: $=; nextPutAll: each value ] >> separatedBy: [ stream nextPut: $& ] ]. >> bodyContents := parameters, String crlf, String crlf, contents. >> request headers >> addField: (HTTPHostField new hostName: url hostname); >> addField: (HTTPAcceptField new >> addMediaType: 'text/html'; >> addMediaType: '*/*'; >> yourself); >> addField: (HTTPContentLengthField new contentLength: bodyContents size); >> addField: (ContentTypeField new mediaType: 'application/x-www-form-urlencoded'). >> request entityBody: bodyContents. >> result := (HyHTTPClient new forRequest: request) response. >> ^result messageBody entityBody asString >> should be working, but no success :( I think the post is wrong created, but I can't find the error. >> Please, any help will be very welcome. Thanks, >> Esteban "Querer es suscitar las paradojas" Camus - El mito de SÃsifo |
Free forum by Nabble | Edit this page |