Skip to content

Instantly share code, notes, and snippets.

@djangofan
Created May 22, 2012 04:38

Revisions

  1. djangofan revised this gist May 22, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -27,11 +27,11 @@ public static void main(String[] args) {
    "</soap12:Envelope>";

    Map<String, String> authhdrs = new HashMap<String, String>();
    authhdrs.put("SOAPAction", "authenticate");
    authhdrs.put("SOAPAction", "Define");
    //authhdrs.put("Content-Length", Integer.toString( myEnvelope.length() ) );
    String xml = given().request().headers(authhdrs)
    .contentType("application/soap+xml; charset=UTF-8;").body( myEnvelope )
    .when().post( "/DictService/DictService.asmx?op=Define" ).andReturn().asString();
    .when().post( "/DictService/DictService.asmx" ).andReturn().asString();

    String prettyXML = with(xml).prettyPrint();
    System.out.println( prettyXML );
  2. djangofan revised this gist May 22, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,7 @@ public class SOAPDictionary {
    public static void main(String[] args) {

    // http://services.aonaware.com/DictService/DictService.asmx?op=Define
    // http://services.aonaware.com/DictService/DictService.asmx?wsdl

    baseURI = "http://services.aonaware.com";
    port = 80;
  3. djangofan created this gist May 22, 2012.
    38 changes: 38 additions & 0 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    package test.ra;

    import static com.jayway.restassured.RestAssured.*;
    import static com.jayway.restassured.path.xml.XmlPath.*;

    import java.util.HashMap;
    import java.util.Map;

    public class SOAPDictionary {

    public static void main(String[] args) {

    // http://services.aonaware.com/DictService/DictService.asmx?op=Define

    baseURI = "http://services.aonaware.com";
    port = 80;
    String word = "hand";

    String myEnvelope = "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
    "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">" +
    "<soap12:Body>" +
    "<Define xmlns=\"http://services.aonaware.com/webservices/\">" +
    "<word>" + word + "</word>" +
    "</Define>" +
    "</soap12:Body>" +
    "</soap12:Envelope>";

    Map<String, String> authhdrs = new HashMap<String, String>();
    authhdrs.put("SOAPAction", "authenticate");
    //authhdrs.put("Content-Length", Integer.toString( myEnvelope.length() ) );
    String xml = given().request().headers(authhdrs)
    .contentType("application/soap+xml; charset=UTF-8;").body( myEnvelope )
    .when().post( "/DictService/DictService.asmx?op=Define" ).andReturn().asString();

    String prettyXML = with(xml).prettyPrint();
    System.out.println( prettyXML );
    }
    }