Print Page | Close Window

Using XML API and Java to retrive order details

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Using ProductCart
Forum Description: Running your store with ProductCart
URL: https://forum.productcart.com/forum_posts.asp?TID=4449
Printed Date: 04-October-2024 at 12:52pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Using XML API and Java to retrive order details
Posted By: PC7313
Subject: Using XML API and Java to retrive order details
Date Posted: 02-May-2011 at 11:10am
Hello

I am trying to write a java code to import orders automatically every hour or so using ProductCart XML API's. I wrote the java code to post the XML query to our product cart store with required ParterID, Password, PartnerKey. I receive the following response to my GetOrderDetailsRequest.

<?xml version="1.0"?>
<ProductCartResponse><RequestStatus>100</RequestStatus><ErrorList><ErrorCode>110
</ErrorCode><ErrorDesc>You do not have permission to access XML Tools. Please co
ntact the Administrator for more information.</ErrorDesc></ErrorList><RequestKey
>1H930N4AZU081BQ</RequestKey></ProductCartResponse>

Any thoughts??

Thank you




-------------
PC7313



Replies:
Posted By: PC7313
Date Posted: 09-May-2011 at 11:15am
Does anyone have any suggestions, I am still not able to find out the solution.

Thank you


-------------
PC7313


Posted By: Greg Dinger
Date Posted: 09-May-2011 at 11:21am
Have you read the XML SDK PDF instructions?
 
Have you created a PARTNER via the admin?


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: PC7313
Date Posted: 09-May-2011 at 11:27am
Yes I created the Partner. I used following java code to post request

String inputString ="<?xml version=\"1.0\"?><GetOrderDetailsRequest xmlns=\"http://www.productcart.com/schema/xmltools/v1\"><PartnerID>xxxxx</PartnerID><PartnerPassword>xxxxxx</PartnerPassword><PartnerKey>xxx-702F33V490S4763UJ921ER4011</PartnerKey><OrderID>2859</OrderID><ExportedFlag>0</ExportedFlag></GetOrderDetailsRequest>";

URL u = new URL("http://www.xxxxx.com/xxxx/xml/gateway.asp");
        URLConnection url = u.openConnection();
        url.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        url.setDoOutput(true);
      url.setDoInput(true);
     
      DataOutputStream    printout=new DataOutputStream (url.getOutputStream ());
      printout.writeBytes (inputString);
      printout.flush ();
    printout.close ();
    DataInputStream     input= new DataInputStream (url.getInputStream ());
    String str;
    while (null != ((str = input.readLine())))
    {
    System.out.println (str);
    }
    input.close ();

When I run the above code I get the following response.

<?xml version="1.0"?>
<ProductCartResponse><RequestStatus>100</RequestStatus><ErrorList><ErrorCode>110
</ErrorCode><ErrorDesc>You do not have permission to access XML Tools. Please co
ntact the Administrator for more information.</ErrorDesc></ErrorList><RequestKey
>37159641XWRR58Y</RequestKey></ProductCartResponse>

Any Help?? Thank you.


-------------
PC7313


Posted By: Greg Dinger
Date Posted: 09-May-2011 at 12:02pm
Sorry, no idea.  Might want to file a support request and talk to Early Impact directly, or engage a developer directly who will dig in and perform debugging.  There is a list of developers here:  http://www.earlyimpact.com/productcart/partners-dev.asp - http://www.earlyimpact.com/productcart/partners-dev.asp

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: PC7313
Date Posted: 10-May-2011 at 12:04pm
@Greg: Thanks for looking in to this.

I found the sample ASP code in the ProductCart XML Tools SDK. I modified it to work for me ans now this time I am getting response from server as following

<?xml version="1.0" ?>
# - - <ProductCartResponse>
  <RequestStatus>100</RequestStatus>
# - - <ErrorList>
  <ErrorCode>101</ErrorCode>
  <ErrorDesc>Invalid XML document</ErrorDesc>
  </ErrorList>
  <RequestKey>5X3SE86HC08W7Z1</RequestKey>
  </ProductCartResponse>

Below is the ASP code I used.


<%



Dim orderid, tmpBody
MethodName = "GetOrderDetailsRequest"
orderid = "2859"


PartnerID=xxxx
Password="xxxx"
PartnerKey="xxx-xxUFH3xx290Sxx60UJ9xxR40xx1"

ProductCartXMLServer="http://www.xxxxxx.com/xxxx/xml/gateway.asp"

tmpBody = "&ltOrderID&gt" & orderid & "&lt/OrderID&gt"

Set objXML = Server.CreateObject("MSXML2.serverXMLHTTP")
objXML.open "POST",ProductCartXMLServer, false

objXML.setRequestHeader "XML-Agent", "ProductCart XML Partner"
objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
requestText="&lt?xml version='1.0'? &gt&lt"&MethodName&" xmlns='http://www.productcart.com/schema/xmltools/v1' &gt&ltPartnerID&gt" & PartnerID & "&lt/PartnerID&gt&ltPartnerPassword&gt" & Password & "&lt/PartnerPassword&gt&ltPartnerKey&gt" & PartnerKey & "&lt/PartnerKey&gt" & tmpBody & "&lt/"&MethodName&"&gt"
objXML.send(requestText)
set x = objXML.responseXML
'response.write requestText
response.write x.XML
response.End()

Any help???

Thank you

%>

-------------
PC7313


Posted By: Greg Dinger
Date Posted: 10-May-2011 at 12:13pm
What XML parser is the store set to use?  If it's not 3, try 3.  If it is 3, try other choices.   If that does not work, I encourage you once again to submit a support request.


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: PC7313
Date Posted: 10-May-2011 at 12:21pm

My store is currently using the following XML Parser: MSXML2 v6.0 parser.

Does changing it to MSXML2 v3.0 parser effect anything on my store??

Thank you



-------------
PC7313


Posted By: Greg Dinger
Date Posted: 10-May-2011 at 12:26pm
it should not, and it may well resolve your issue.

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: PC7313
Date Posted: 10-May-2011 at 12:30pm
I just changed and ran the code, still get the same response. Do I have to wait for some time to get XML Parser changed??

Thank you


-------------
PC7313


Posted By: Greg Dinger
Date Posted: 10-May-2011 at 12:35pm
No, it should be immediate.  I'm sorry but this is as far as I'm able to go with this in the forum, as the easy ideas that come to mind have been exhausted.  Please submit a support request to Early Impact.

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net