/* FARGOS Development, LLC Sample Programs Copyright (C) 2002 FARGOS Development, LLC. All rights reserved. mailto:support@fargos.net for assistance. NOTE: in the future, enhanced versions of these classes may be added to the FARGOS/VISTA Object Management Environment core within the Standard namespace. Developers can avoid any potential conflict if they specify an explicit namespace when creating instances of the sample classes. */ %include class SOAPservice { /*! Provides inheritable utility functions useful for applications performing SOAP-based interactions. The class class=WSDLtoOIL2 generates OIL2 classes that utilize class=SOAPservice. !*/ oid queryObj; } inherits from Object; SOAPservice:create() { } SOAPservice:delete() { } SOAPservice:issueRequest(string targetURL, string packet) { assoc acl; any hdrs; string dest; //display("Send query to ", targetURL, "\n"); display("XML document would be:\n", packet,"\n"); dest = targetURL; acl = makeDefaultACL(); //dest = "http://localhost:4321"; queryObj = send "createObject"("HTTPrequest", acl, "POST", dest, "localhost", "80", nil, "text/xml; charset=\"utf-8\"", packet, hdrs) to ObjectCreator; return (0); } SOAPservice:receiveResponse() { any result, xml, elem; result = send "getResponse" to queryObj; queryObj = nil; // automatic delete of HTTPrequest after getResponse method display("receiveResponse result=", result, "\n"); // result[0] = MIME header; // result[1] = body of response // result[2] = HTTP response status line // TO DO: handle error cases: if (result[2] == "") { return (nil); // no response } // tokenize result[2], get status code if (findSubstring(result[1], "\n\n"; lines += "\n"; lines += " \n"; lines += " \n"; return (lines); } SOAPservice:getSOAPenvelopeClosing(string envelopeName) { set lines; lines += "