Published on WSO2 Oxygen Tank (http://wso2.org)

How do I do a simple HTTP GET?

By vbp
Created 2008-01-29 00:53

I started playing with the Mashup Server tonight and I am about to go to bed without having been able to do a simple HTTP get. With some luck, a kind soul will be able to help. Here is what I tried:

function getPage() {

    var request = new WSRequest();
    var options = new Array();
    // options.useBinding = "HTTP";
    options.useSOAP = false;
    options.HTTPMethod = "GET";

    try {
        version.open(options, "http://wso2.com/", false);
        version.send();
        result = version.responseText;
    } catch (e) {
        print(e);
    }
    return this.result;
}

I consistently get a (null) result. I tried both useBinding and useSOAP to no avail. I tried to put a TCPMon tunnel in the middle to see the outgoing HTTP request, but it never even make it to my TCPMon listener (BTW, I noticed that you ship the TCPMon jar, so at that point you might as well provide a tcpmon.bat or tcpmon.sh in /bin to make it easy for people).

Thanks.


Source URL:
http://wso2.org/forum/thread/3135