//>>built
define("dojox/wire/ml/Service",["dojo","dijit","dojox","dojo/require!dijit/_Widget,dojox/xml/parser,dojox/wire/_base,dojox/wire/ml/util"],function(b,e,c){b.provide("dojox.wire.ml.Service");b.require("dijit._Widget");b.require("dojox.xml.parser");b.require("dojox.wire._base");b.require("dojox.wire.ml.util");b.declare("dojox.wire.ml.Service",e._Widget,{url:"",serviceUrl:"",serviceType:"",handlerClass:"",preventCache:!0,postCreate:function(){this.handler=this._createHandler()},_handlerClasses:{TEXT:"dojox.wire.ml.RestHandler",
XML:"dojox.wire.ml.XmlHandler",JSON:"dojox.wire.ml.JsonHandler","JSON-RPC":"dojo.rpc.JsonService"},_createHandler:function(){if(this.url){var f=this;b.xhrGet({url:this.url,handleAs:"json",sync:!0}).addCallback(function(a){f.smd=a});this.smd&&!this.serviceUrl&&(this.serviceUrl=this.smd.serviceUrl||this.smd.serviceURL)}var a=void 0;this.handlerClass?a=c.wire._getClass(this.handlerClass):this.serviceType?(a=this._handlerClasses[this.serviceType])&&b.isString(a)&&(a=c.wire._getClass(a),this._handlerClasses[this.serviceType]=
a):this.smd&&this.smd.serviceType&&(a=this._handlerClasses[this.smd.serviceType])&&b.isString(a)&&(a=c.wire._getClass(a),this._handlerClasses[this.smd.serviceType]=a);return a?new a:null},callMethod:function(c,a){var d=new b.Deferred;this.handler.bind(c,a,d,this.serviceUrl);return d}})});