java - Dictionary WebService DictService.asmx code doesn't work in Eclipse -
i'm trying compile , run following code in eclipse, doesn't work. goal make request on dictionary web service http://services.aonaware.com/dictservice/dictservice.asmx?wsdl word , definition of word user. please fix it. think plugins missing, because shows errors near import statements.
import static com.jayway.restassured.restassured.*; import static com.jayway.restassured.path.xml.xmlpath.*; import com.jayway.restassured.path.xml.element.node; // restassured source: http://grepcode.com/file/repo1.maven.org/maven2/com.jayway.restassured/rest-assured/1.6/com/jayway/restassured/restassured.java#restassured // url: http://services.aonaware.com/dictservice/dictservice.asmx/define?word=string // wsdl: http://services.aonaware.com/dictservice/dictservice.asmx?wsdl public class ratest { public static void main(string[] args) { baseuri = "http://services.aonaware.com"; port = 80; string defcandidate = "fastidious"; string xml = get("/dictservice/dictservice.asmx/define?word=" + defcandidate ).andreturn().asstring(); int items = from(xml).get("worddefinition.definitions.definition.size()"); system.out.println("\n\n"); system.out.println("number of definitions returned: " + items); for( int i=0; i<items ; i++ ) { int defnum = + 1; node def = from(xml).get("worddefinition.definitions.definition[" + + "]"); string returnedword = def.getnode("word").value(); string dictname = def.getnode("dictionary").getnode("name").value(); string definition = def.getnode("worddefinition").value(); system.out.println("definition " + defnum + ": "); system.out.println("word: " + returnedword ); system.out.println("dictionary: " + dictname ); system.out.println("definition: " + definition ); } } }
Comments
Post a Comment