Jump to content
mike999

Webservice in 1.6 give The remote server returned an error: (401) Unauthorized.

Recommended Posts

Webservice: We made a new complete clean installation with 1.6.and have made new key and have keept all the "Show Get" and "Modified PUT" as it should as we had in our earlier installation when using 1.5 that worked well.



 

addresses GET

carriers Get



countries GET



customers GET

order states Get



orders GET & PUT



products GET



combinations GET


 


We can see that when using the api test it makes the the right XML in the webpage .And we on the website can se the order with product detail


 


But when the logistic compony is trying to get the order for packing. They just get as follow:'


" The remote server returned an error: (401) Unauthorized. "


 


What wrong here?


Share this post


Link to post
Share on other sites

It looks like they are not sending the username and password for the connection properly, it is denying them access because of that. 

Share this post


Link to post
Share on other sites

We have exactly the same problem. When starting fresh with Prestashop version 1.6 our program developed in .net gets error 401 from the webservice.

 

The key is correct and works in any browser, could it be a unicode problem or something?

Share this post


Link to post
Share on other sites

It appears that a year has gone by, and no one posted a solution. I am having a similar issue - the difference is that at one time, my store did connect, but that was before I completed an import of products and customers. After I had the site completely setup, I noticed that none of my shipping data was uploading, so I tested my connection again, and now the API reports the 401 error.

 

The exact error is: "We received an error testing the PrestaShop store: The remote server returned an error: (401) Unauthorized."

 

I have looked at everything our server host recommended, and also the API vendor. Nothing works. I have other PrestaShop stores connected to the same API vendor - no issues. Exact same configuration. My site is live, and we have between 5,000-10,000 visitors daily - so, a fresh re-installation just isn't feasible. This seems to be a permissions issue - just not sure where to go change permissions.

 

Any help is appreciated.

Edited by emartinez0131 (see edit history)

Share this post


Link to post
Share on other sites

Are all sites on the same server?

Share this post


Link to post
Share on other sites

What I am trying to figure out is if you have had a site on this server connect to the api. I am suspecting that your php interpreter might be different on the servers and is causing the issue. 

Share this post


Link to post
Share on other sites

The site that has the issue had originally connected successfully, however, I had a temporary URL assigned to the site during development. After the site went live, I changed the URL, and created a brand new connection to the API vendor - this time, it refused to connect, returning the 401 error I described above.

Share this post


Link to post
Share on other sites

Did you update your webservice api key with the vendor? You might try generating a new one. 

Share this post


Link to post
Share on other sites

Thank you for your insights Dh42, but after all of the time that has passed since the last post, we are no closer to solving the issue, and our vendor seems "uninterested" in finding a resolution. I have multiple sites connected on two different servers. Other sites on this same server are connected with no issues. I recreated a smaller version of my site as a sandbox/test on the same server, and it connects successfully.

 

The only conclusion I can come to is that our copy of the store has suffered some corruption in the Webservice code. We have decided that we will recreate the site manually - no imports - since every other site we've setup in this manner works flawlessly.

 

Not really sure what happened during the import, but we thought we were going to save a lot of time by bringing our 9000 + products, 12000+ customers, and partial orders (18000). We have not saved any time. By having to go back and try to fix the problems that cropped up after the massive import, we've actually lost time.

 

I just wanted to post our experiences here, in the event that someone else is finding similar issues after a data import. From what I can tell, we should not be having these issues, but that doesn't change the fact that we are. Good luck to all.

Share this post


Link to post
Share on other sites

I finally solved this issue. I hired Fred & Co. at Prestaheroes to take a look. While they couldn't find anything wrong code-wise, they did advise me to look at a secondary domain name that kept showing up. I host using cPanel/WHM, and one of the things that had been done was after the PS was fully developed and ready for "prime time," the live site's domain was "parked" on top of the development domain, and PS was told to use the live domain. Everything worked beautifully -- except, Webservice.

 

Following up on the tip from Prestaheroes, I removed the parked live domain, modified the development domain's name to the live one, and VOILA! Everything still works beautiful, and Webservice now connects to the shipping host we use. It was that simple - but it eluded me for almost a year. We did shipping manually to our shipping processor, until this week. Oh happy days!

 

Thanks to everyone for their input, advice, and overall good will. Great forum!

 

--Ed

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More