//>>built
define("dojox/wire/ml/Service",["dijit","dojo","dojox","dojo/require!dijit/_Widget,dojox/xml/parser,dojox/wire/_base,dojox/wire/ml/util"],function(f,b,d){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",f._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 e=this;b.xhrGet({url:this.url,handleAs:"json",sync:!0}).addCallback(function(c){e.smd=c});this.smd&&!this.serviceUrl&&(this.serviceUrl=this.smd.serviceUrl||this.smd.serviceURL)}var a=void 0;this.handlerClass?a=d.wire._getClass(this.handlerClass):this.serviceType?(a=this._handlerClasses[this.serviceType])&&b.isString(a)&&(a=d.wire._getClass(a),this._handlerClasses[this.serviceType]=
a):this.smd&&this.smd.serviceType&&(a=this._handlerClasses[this.smd.serviceType])&&b.isString(a)&&(a=d.wire._getClass(a),this._handlerClasses[this.smd.serviceType]=a);return a?new a:null},callMethod:function(e,a){var c=new b.Deferred;this.handler.bind(e,a,c,this.serviceUrl);return c}})});