Uploading product XML files automatically

General ShopSite user discussion

Uploading product XML files automatically

Postby Stan Shaul » Fri Apr 07, 2006 4:13 pm

Does anyone know what parameters need to be passed to dbupload.cgi (i.e. in
the URL) in order to specify the MIME product file to be uploaded from a
local path? An example would be great.

I am trying to have MS Access upload product data automatically and have
tried FTP'ing the file up to the server and then running dbupload.cgi but I
am getting authentication issues when dbupload.cgi redirects to dbmake.cgi
(doesn't pass on my authentication with the redirect). If I can call
dbupload.cgi with a MIME version of the xml file and authenticate, have it
return the parameters to pass to dbmake.cgi, and then call dbmake.cgi with
the parameter list and authenticate, I think I can get around this.

Any help would be appreciated.

Thanks,

Stan Shaul
sportsflix.com
Stan Shaul
 

Re: Uploading product XML files automatically

Postby Jim » Mon Apr 10, 2006 9:56 am

Have you checked the online help at
http://www.shopsite.com/help/8.0/en-US/ ... pload.html
and the sdk documentation at
http://www.shopsite.com/help/8.0/en-US/ ... L_SDK.html
There is a link on that page to a sample perl program.

Jim

Stan Shaul wrote:
Does anyone know what parameters need to be passed to dbupload.cgi (i.e. in
the URL) in order to specify the MIME product file to be uploaded from a
local path? An example would be great.

I am trying to have MS Access upload product data automatically and have
tried FTP'ing the file up to the server and then running dbupload.cgi but I
am getting authentication issues when dbupload.cgi redirects to dbmake.cgi
(doesn't pass on my authentication with the redirect). If I can call
dbupload.cgi with a MIME version of the xml file and authenticate, have it
return the parameters to pass to dbmake.cgi, and then call dbmake.cgi with
the parameter list and authenticate, I think I can get around this.

Any help would be appreciated.

Thanks,

Stan Shaul
sportsflix.com

Jim
 

Re: Uploading product XML files automatically

Postby Stan Shaul » Wed Apr 19, 2006 4:32 pm

Jim,

Thanks for the reply but those are the specs. I used to write my code. The
URL I build will work directly in the browser because I can enter my
credentials twice - the first time for dbupload.cgi and the second when
dbupload.cgi redirects to dbmake.cgi. When I try to do the same thing using
the WinHttpReq objects (see example below - which work directly with IE) - I
get a 401 authorization error. Although the credentials get passed correctly
to dbmake.cgi they don't get passed to dbmake.cgi (called from dbmake.cgi as
a redirect) which causes the credentials error.

If I can break the the call into two seperate calls (see
http://www.shopsite.com/help/8.0/en-US/ ... pload.html
for MIME example) then I can get around this. The problem is that I don't
find an example URL which show dbmake.cgi how to select the MIME folder on
your local machine - I'm sure there is a set of parameters to do this but I
don't see them in the documentation. The example has the path in the MIME
file but you have to point to the MIME file first in the dbmake.cgi URL.

Sample Javascript to import a file which has already been FTP'd to the
server in the correct location - uses IE and passes on credentials (Gives a
401 authorization error):
------------------------------------------------------------------------------------------------------------------------------------------
<SCRIPT language="JavaScript">

var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
var URL = "http://www.testsite.com/shopsite_sc/ss/dbupload.cgi";
var Parameters =
"clientApp=1&dbname=products&filename=products_3242006_24041AM.xml&uniqueName=SKU&checkpoint=500&newRecords=yes&use_optimizer=no&defer_linking=no";

WinHttpReq.Open("POST", URL, false);
WinHttpReq.SetCredentials("login","password",0);
WinHttpReq.Send(Parameters);

document.write(WinHttpReq.GetAllResponseHeaders);
document.write(WinHttpReq.ResponseText);

</SCRIPT>

------------------------------------------------------------------------------------------------------------------------------------------

Sample Javascript to rebuild site (works correctly with credentail passed
thru becuase there is no redirect):
------------------------------------------------------------------------------------------------------------------------------------------
<SCRIPT language="JavaScript">

var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
var URL =
"http://www.testsite.com/shopsite_sc/ss/generate.cgi?clientApp=1&htmlpages=1&custompages=1&index=1&regen=1"

WinHttpReq.Open("GET", URL, false);
WinHttpReq.SetCredentials("login","password",0);
WinHttpReq.Send();

document.write(WinHttpReq.GetAllResponseHeaders);
document.write(WinHttpReq.ResponseText);

</SCRIPT>

------------------------------------------------------------------------------------------------------------------------------------------

Any further help would be appreciated.

Thanks,

Stan

"Jim" <jstavast@xmission.com> wrote in message
news:e1e2k4$c8r$1@eval.shopsite.com...
Have you checked the online help at
http://www.shopsite.com/help/8.0/en-US/ ... pload.html
and the sdk documentation at
http://www.shopsite.com/help/8.0/en-US/ ... L_SDK.html
There is a link on that page to a sample perl program.

Jim

Stan Shaul wrote:
Does anyone know what parameters need to be passed to dbupload.cgi (i.e.
in the URL) in order to specify the MIME product file to be uploaded from
a local path? An example would be great.

I am trying to have MS Access upload product data automatically and have
tried FTP'ing the file up to the server and then running dbupload.cgi but
I am getting authentication issues when dbupload.cgi redirects to
dbmake.cgi (doesn't pass on my authentication with the redirect). If I
can call dbupload.cgi with a MIME version of the xml file and
authenticate, have it return the parameters to pass to dbmake.cgi, and
then call dbmake.cgi with the parameter list and authenticate, I think I
can get around this.

Any help would be appreciated.

Thanks,

Stan Shaul
sportsflix.com
Stan Shaul
 

Re: Uploading product XML files automatically

Postby loren_d_c » Wed Apr 19, 2006 4:58 pm

"The problem is that I don't find an example URL which show dbmake.cgi
how to select the MIME folder on your local machine"

The cgi on the server cannot access files or directories on your local
desktop computer, your program has to pass the contents of the file itself.

When you upload a file to a server-based application from your web
browser and specify a file path in the process (which is done with a
special form input field of type=file), that file path is used by your
browser to locate the file which it then passes to the server, the path
is not provided to the server so the server application can go grab that
file from your desktop computer (which would be a huge browser security
hole if it were possible).

-Loren



Stan Shaul wrote:
Jim,

Thanks for the reply but those are the specs. I used to write my code. The
URL I build will work directly in the browser because I can enter my
credentials twice - the first time for dbupload.cgi and the second when
dbupload.cgi redirects to dbmake.cgi. When I try to do the same thing using
the WinHttpReq objects (see example below - which work directly with IE) - I
get a 401 authorization error. Although the credentials get passed correctly
to dbmake.cgi they don't get passed to dbmake.cgi (called from dbmake.cgi as
a redirect) which causes the credentials error.

If I can break the the call into two seperate calls (see
http://www.shopsite.com/help/8.0/en-US/ ... pload.html
for MIME example) then I can get around this. The problem is that I don't
find an example URL which show dbmake.cgi how to select the MIME folder on
your local machine - I'm sure there is a set of parameters to do this but I
don't see them in the documentation. The example has the path in the MIME
file but you have to point to the MIME file first in the dbmake.cgi URL.

Sample Javascript to import a file which has already been FTP'd to the
server in the correct location - uses IE and passes on credentials (Gives a
401 authorization error):
------------------------------------------------------------------------------------------------------------------------------------------
SCRIPT language="JavaScript"

var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
var URL = "http://www.testsite.com/shopsite_sc/ss/dbupload.cgi";
var Parameters =
"clientApp=1&dbname=products&filename=products_3242006_24041AM.xml&uniqueName=SKU&checkpoint=500&newRecords=yes&use_optimizer=no&defer_linking=no";

WinHttpReq.Open("POST", URL, false);
WinHttpReq.SetCredentials("login","password",0);
WinHttpReq.Send(Parameters);

document.write(WinHttpReq.GetAllResponseHeaders);
document.write(WinHttpReq.ResponseText);

/SCRIPT

------------------------------------------------------------------------------------------------------------------------------------------

Sample Javascript to rebuild site (works correctly with credentail passed
thru becuase there is no redirect):
------------------------------------------------------------------------------------------------------------------------------------------
SCRIPT language="JavaScript"

var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
var URL =
"http://www.testsite.com/shopsite_sc/ss/generate.cgi?clientApp=1&htmlpages=1&custompages=1&index=1&regen=1"

WinHttpReq.Open("GET", URL, false);
WinHttpReq.SetCredentials("login","password",0);
WinHttpReq.Send();

document.write(WinHttpReq.GetAllResponseHeaders);
document.write(WinHttpReq.ResponseText);

/SCRIPT

------------------------------------------------------------------------------------------------------------------------------------------

Any further help would be appreciated.

Thanks,

Stan

"Jim" <jstavast@xmission.com> wrote in message
news:e1e2k4$c8r$1@eval.shopsite.com...
Have you checked the online help at
http://www.shopsite.com/help/8.0/en-US/ ... pload.html
and the sdk documentation at
http://www.shopsite.com/help/8.0/en-US/ ... L_SDK.html
There is a link on that page to a sample perl program.

Jim

Stan Shaul wrote:
Does anyone know what parameters need to be passed to dbupload.cgi (i.e.
in the URL) in order to specify the MIME product file to be uploaded from
a local path? An example would be great.

I am trying to have MS Access upload product data automatically and have
tried FTP'ing the file up to the server and then running dbupload.cgi but
I am getting authentication issues when dbupload.cgi redirects to
dbmake.cgi (doesn't pass on my authentication with the redirect). If I
can call dbupload.cgi with a MIME version of the xml file and
authenticate, have it return the parameters to pass to dbmake.cgi, and
then call dbmake.cgi with the parameter list and authenticate, I think I
can get around this.

Any help would be appreciated.

Thanks,

Stan Shaul
sportsflix.com

loren_d_c
 
Posts: 2569
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere


Return to User Forum

Who is online

Users browsing this forum: No registered users and 166 guests