Question

Welcome everybody! I'm new here and I looking for the solution of my problem with Prestashop webservice and Android. I have to write an application for android, which parse XML from prestashop web service, and I don't know how to do it. Offcourse, I set up the webservice in the prestashop, which generate a xml. Finally, I have a xml:

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">  
   <api shop_name="myShop">
     <addresses xlink:href="https://myshop.pl/api/addresses" get="true" put="false" post="true" delete="false" head="true">
       <description xlink:href="https://myshop.pl/api/addresses" get="true" put="false" post="true" delete="false" head="true">The Customer, Manufacturer and Customer addresses</description>
       <schema xlink:href="https://myshop.pl/api/addresses?schema=blank" type="blank"/>
       <schema xlink:href="https://myshop.pl/api/addresses?schema=synopsis" type="synopsis"/>
     </addresses> 
   </api> 
</prestashop>

I try to use this tutorial to parse the above xml, but is the problem java.io.FileNotFoundException in the line where is InputStream stream = conn.getInputStream().

Does anyony Who can help me?

Sorry for my english, if there are any mistakes in the text.

Was it helpful?

Solution

I resolved the problem, through adding this line before connect() method:

String userpassword = "key_authentication"+":"+""; // empty password should not be missed
String encoded = new String(Base64.encode(userpassword.getBytes(), Base64.DEFAULT));
connection.setRequestProperty("Authorization", "Basic " + encoded);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top