![]() |
Using XML API and Java to retrive order details |
Post Reply ![]() |
Page 12> |
Author | |
PC7313 ![]() Newbie ![]() Joined: 02-May-2011 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() 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
|
|
![]() |
|
PC7313 ![]() Newbie ![]() Joined: 02-May-2011 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
Does anyone have any suggestions, I am still not able to find out the solution.
Thank you |
|
PC7313
|
|
![]() |
|
Greg Dinger ![]() Certified ProductCart Developers ![]() ![]() Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
![]() ![]() ![]() ![]() ![]() |
Have you read the XML SDK PDF instructions?
Have you created a PARTNER via the admin?
|
|
![]() |
|
PC7313 ![]() Newbie ![]() Joined: 02-May-2011 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Greg Dinger ![]() Certified ProductCart Developers ![]() ![]() Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
PC7313 ![]() Newbie ![]() Joined: 02-May-2011 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
@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" ?>
<RequestStatus>100</RequestStatus> <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 = "<OrderID>" & orderid & "</OrderID>" 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="<?xml version='1.0'? ><"&MethodName&" xmlns='http://www.productcart.com/schema/xmltools/v1' ><PartnerID>" & PartnerID & "</PartnerID><PartnerPassword>" & Password & "</PartnerPassword><PartnerKey>" & PartnerKey & "</PartnerKey>" & tmpBody & "</"&MethodName&">" objXML.send(requestText) set x = objXML.responseXML 'response.write requestText response.write x.XML response.End() Any help??? Thank you %> |
|
PC7313
|
|
![]() |
|
Greg Dinger ![]() Certified ProductCart Developers ![]() ![]() Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
PC7313 ![]() Newbie ![]() Joined: 02-May-2011 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Greg Dinger ![]() Certified ProductCart Developers ![]() ![]() Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
![]() ![]() ![]() ![]() ![]() |
it should not, and it may well resolve your issue.
|
|
![]() |
|
PC7313 ![]() Newbie ![]() Joined: 02-May-2011 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
Post Reply ![]() |
Page 12> |
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |