Hi All,
I am trying to access XMLAPI using python. I am getting weird behavior from server, when reading response.
Code for calling XMLAPI is as follows:
headers = {'Content-type': 'application/x-www-form-urlencoded'}
request = urllib2.Request(siteXMLAPIURL,xmlStr,headers)
response = urllib2.urlopen(request)
print response.read()
In above code,
xmlStr: is String containing XML file
siteXMLAPIURL: URL of the site to send request. It is in form "https://xxx.xxx.com/XXXService/XXXService
Problem Description:
I am calling URL for creating product by passing methodname(CreateProduct), productId, productCreateDate, productCreateTime etc in XML form.
Call to XMLAPI always succeed and product is created on site. But when I call .read() method to print response, then "productCreateTimes" gets changed on server !!
For example,
Case 1: Not using .read() method. (i.e. commenting print line in above code)
Calling API by passing productCreateTime = 08/02/10 08:00:00,and then product is being created with time 08/02/10 08:00:00. i.e. everything is fine here
Now,
Case 2: Using read() method (i.e. having print line is code)
Calling API by passing productCreateTime = 08/02/10 08:00:00 and then product is being created with time 08/02/10 09:00:00. Here, server is adding one more hour to productCrateTime. Which is really strange for me!!
FYI: If I access same API with java, everything is fine all time.
I am unable to understand why read() method is changing server behavior!! Can anyone please guide me in same?
Thank you so much for your time. Hoping for reply !!
I am trying to access XMLAPI using python. I am getting weird behavior from server, when reading response.
Code for calling XMLAPI is as follows:
headers = {'Content-type': 'application/x-www-form-urlencoded'}
request = urllib2.Request(siteXMLAPIURL,xmlStr,headers)
response = urllib2.urlopen(request)
print response.read()
In above code,
xmlStr: is String containing XML file
siteXMLAPIURL: URL of the site to send request. It is in form "https://xxx.xxx.com/XXXService/XXXService
Problem Description:
I am calling URL for creating product by passing methodname(CreateProduct), productId, productCreateDate, productCreateTime etc in XML form.
Call to XMLAPI always succeed and product is created on site. But when I call .read() method to print response, then "productCreateTimes" gets changed on server !!
For example,
Case 1: Not using .read() method. (i.e. commenting print line in above code)
Calling API by passing productCreateTime = 08/02/10 08:00:00,and then product is being created with time 08/02/10 08:00:00. i.e. everything is fine here
Now,
Case 2: Using read() method (i.e. having print line is code)
Calling API by passing productCreateTime = 08/02/10 08:00:00 and then product is being created with time 08/02/10 09:00:00. Here, server is adding one more hour to productCrateTime. Which is really strange for me!!
FYI: If I access same API with java, everything is fine all time.
I am unable to understand why read() method is changing server behavior!! Can anyone please guide me in same?
Thank you so much for your time. Hoping for reply !!