[Tutor] webservice question

Phil H philipholveck at hotmail.com
Thu Jan 29 06:37:41 CET 2015


 Looking for a little help.  I'm working on a little project and think using python would be the best way to do it.  I am a novice but have read a few beginners books.  Well to not waste everyones time i'll just get to it.  I'm looking to use web services to get and post data from a server with a java rest interface
 
This is what I have been given from the Java end
Java method
public java.lang.String getSettings (java.lang.String username, java.lang.String pass, java.lang.String key, java.lang.string tag)
 
url example http://localhost:8080/gettag/tag    (retrieve a tag from a DB)
 
i'm told it should return something like this
<?xml version="1.0" encoding="UTF-8" ?> <gettag> <response><tag> [tag''s value] </tag> </response> </gettag> 
 
So for what is working
 
--------------------------------
import urllib2
import requests

url = 'http://localhost:8080/gettag/testconnection'
response = urllib2.urlopen(url) .read()

print response
------------------------------
 
with this I get the expected response from the server
 
then I have a test to authenticate user and pass
 
url = 'http://localhost:8080/gettag/testauth?username=testuser&pass=123456'
 
and this works
 
This is where I get confused, how do I pass the variable key's value and return the variable tag's value.
 
 
Thanks in advance for any help, I've tried a bunch of stuff and its just not working.
 
Phil
 
 
 
 
 
 
 
 
 
 

 
 		 	   		  


More information about the Tutor mailing list