Authorization issues with XML and JSON using VW vs Dolphin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Authorization issues with XML and JSON using VW vs Dolphin

Deanna Simpson
We're trying to interface to Shopify, and one of our developers has written some Dolphin JSON and XML code, each of which successfully make a call to Shopify. However, using the same login in VW code, we get a 401 Unauthorized error.

This is the Dolphin code  in both XML and JSON, each of which work:

XML
 (HttpsClient forUrl: 'https://blob.myshopify.com/')
    setBasicAuthorizationUsername: 'username'
    password: 'XXX';
    get: '/admin/products/count.xml'.
RESPONSE XML content
'<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">3</count>'

JSON
 (HttpsClient forUrl: 'https://blob.myshopify.com/')
    setBasicAuthorizationUsername: 'username'
    password: 'XXX';
    get: '/admin/products/count.json'.
RESPONSE JSON content
'{"count":3}'



This is the VW code that should give the same result but doesn't work:
(HttpsURL
    host: 'blob.myshopify.com'
    pathString: 'admin/products/count.xml')
        username: 'username'
        password: 'XXX';
        get

I get response:
HTTP/1.1 401 Unauthorized
Server: nginx
Date: Wed, 23 Jan 2013 02:11:18 +0000
Content-type: application/xml;charset=utf-8
Connection: keep-alive
Status: 401 Unauthorized
Www-authenticate: Basic realm="Shopify API Authentication"
Cache-control: no-cache
X-request-id: 4910b6432db339524d1974770c63c179
X-ua-compatible: IE=Edge,chrome=1
X-runtime: 0.017365


Can anyone provide insight?


Thank you,

Deanna





_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Authorization issues with XML and JSON using VW vs Dolphin

Kogan, Tamara

Hi Deanna,

 

I don’t have an account on this site and can’t verify what exactly happened.

I loaded and opened LoggingTool to check the client-server communication. The message log shows that our client tried to send “Basic” authorization data.

1.       Load LoggingTool

2.       LoggingTool open

3.       Set Trace on

4.       Set Http messages Client and Server on.

5.       Set TLS/SSL cobnnection messages on

 

In my case:

Client:

GET /admin/products/count.xml HTTP/1.1

Host: blob.myshopify.com

Content-length: 0

 

 

Server:

HTTP/1.1 401 Unauthorized

Server: nginx

Date: Wed, 23 Jan 2013 17:33:07 -0500

Content-type: application/xml;charset=utf-8

Connection: keep-alive

Status: 401 Unauthorized

Www-authenticate: Basic realm="Shopify API Authentication"

Cache-control: no-cache

X-request-id: 4d127307c6a765e124ce9da62b97df4c

X-ua-compatible: IE=Edge,chrome=1

X-runtime: 0.033428

 

Client sends Basic authorization:

GET /admin/products/count.xml HTTP/1.1

Host: blob.myshopify.com

Authorization: Basic dXNlcm5hbWU6WFhY

Content-length: 0

 

The server returns 401 which is right. The password and username were bogus.

HTTP/1.1 401 Unauthorized

Server: nginx

Date: Wed, 23 Jan 2013 17:33:07 -0500

Content-type: application/xml;charset=utf-8

Connection: keep-alive

Status: 401 Unauthorized

Www-authenticate: Basic realm="Shopify API Authentication"

Cache-control: no-cache

X-request-id: 1dec5c3034231b6106a7bad2d29a7f31

X-ua-compatible: IE=Edge,chrome=1

X-runtime: 0.017325

 

Tamara Kogan

Smalltalk Development

Cincom Systems

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Deanna Simpson
Sent: Wednesday, January 23, 2013 2:17 PM
To: [hidden email]
Subject: [vwnc] Authorization issues with XML and JSON using VW vs Dolphin

 

We're trying to interface to Shopify, and one of our developers has written some Dolphin JSON and XML code, each of which successfully make a call to Shopify. However, using the same login in VW code, we get a 401 Unauthorized error.

This is the Dolphin code  in both XML and JSON, each of which work:


XML
 (HttpsClient forUrl: 'https://blob.myshopify.com/')
    setBasicAuthorizationUsername: 'username'

    password: 'XXX';
    get: '/admin/products/count.xml'.
RESPONSE XML content
'<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">3</count>'

JSON
 (HttpsClient forUrl: 'https://blob.myshopify.com/')
    setBasicAuthorizationUsername: 'username'
    password: 'XXX';
    get: '/admin/products/count.json'.
RESPONSE JSON content
'{"count":3}'


This is the VW code that should give the same result but doesn't work:
(HttpsURL
    host: 'blob.myshopify.com'
    pathString: 'admin/products/count.xml')
        username: 'username'
        password: 'XXX';
        get


I get response:
HTTP/1.1 401 Unauthorized
Server: nginx
Date: Wed, 23 Jan 2013 02:11:18 +0000
Content-type: application/xml;charset=utf-8
Connection: keep-alive
Status: 401 Unauthorized
Www-authenticate: Basic realm="Shopify API Authentication"
Cache-control: no-cache
X-request-id: 4910b6432db339524d1974770c63c179
X-ua-compatible: IE=Edge,chrome=1
X-runtime: 0.017365

Can anyone provide insight?

Thank you,

Deanna

 

 

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Authorization issues with XML and JSON using VW vs Dolphin

Yanni Chiu
In reply to this post by Deanna Simpson
On 23/01/13 2:17 PM, Deanna Simpson wrote:
>
> This is the VW code that should give the same result but doesn't work:
> */(HttpsURL /**/
> /**/    host: 'blob.myshopify.com <http://all-can.myshopify.com>' /**/
> /**/    pathString: 'admin/products/count.xml') /**/
> /**/        username: 'username' /**/
> /**/        password: 'XXX';/**/
> /**/        get/*/

Is "admin" a typo, or should it be "/admin", like you have in the
Dolphin code?
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Authorization issues with XML and JSON using VW vs Dolphin

Deanna Simpson
Hi Yanni,

I tried both ways, and that wasn't the issue. The issue is that VW didn't accept basic authentication fields longer than 76 chars. Tamara at Cincom (bless her!) sent me a fix for it. I'm not sure if it's appropriate for me to post the patch here, but the AR number is 67230, and it should be available as a fix on Cincom's site.


On Wed, Jan 23, 2013 at 11:46 PM, Yanni Chiu <[hidden email]> wrote:
On 23/01/13 2:17 PM, Deanna Simpson wrote:

This is the VW code that should give the same result but doesn't work:
*/(HttpsURL /**/
/**/    host: 'blob.myshopify.com <http://all-can.myshopify.com>' /**/
/**/    pathString: 'admin/products/count.xml') /**/
/**/        username: 'username' /**/
/**/        password: 'XXX';/**/
/**/        get/*/

Is "admin" a typo, or should it be "/admin", like you have in the Dolphin code?


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc