public void ScriptGenerator()
        {
            var s = ProxyGenerator.GetClientProxyScript(typeof(IHogeService), "/js", false);

            Assert.IsTrue(s.IndexOf("IHogeService") > 0, "#1");
            Assert.IsTrue(s.IndexOf("Join") > 0, "#2");
            s = ProxyGenerator.GetClientProxyScript(typeof(IHogeService), "/jsdebug", true);
            Assert.IsTrue(s.IndexOf("IHogeService") > 0, "#3");
            Assert.IsTrue(s.IndexOf("Join") > 0, "#4");
        }
Beispiel #2
0
        public object Invoke(object instance, object[] inputs, out object[] outputs)
        {
            outputs = null;

            var request     = System.ServiceModel.Web.WebOperationContext.Current.IncomingRequest;
            var endpointUrl = RewriteUri(this.Endpoint.Address.Uri, request.Headers["HOST"]).AbsoluteUri;
            var requestUrl  = RewriteUri(OperationContext.Current.IncomingMessageProperties.Via, request.Headers["HOST"]).AbsoluteUri;
            var scriptUrl   = endpointUrl + (endpointUrl.EndsWith("/", StringComparison.OrdinalIgnoreCase) ? WfWebScriptBehavior.METADATA_ENDPOINT_SUFFIX
                                : "/" + WfWebScriptBehavior.METADATA_ENDPOINT_SUFFIX);
            var scriptDebugUrl = endpointUrl + (endpointUrl.EndsWith("/", StringComparison.OrdinalIgnoreCase) ? WfWebScriptBehavior.DEBUG_METADATA_ENDPOINT_SUFFIX
                                : "/" + WfWebScriptBehavior.DEBUG_METADATA_ENDPOINT_SUFFIX);

            if (requestUrl == scriptUrl || requestUrl == scriptDebugUrl)
            {
                Message replyMsg = null;
                if (IsServiceUnChanged())
                {
                    replyMsg = CreateNotModifiedMessage();
                }
                else
                {
                    string scriptContent = ProxyGenerator.GetClientProxyScript(this.Endpoint.Contract.ContractType,
                                                                               endpointUrl, false, this.Endpoint);

                    replyMsg = CreateMetadataMessage(scriptContent);
                }
                return(replyMsg);
            }

            if (inputs == null)
            {
                inputs = new object[1];
            }
            inputs[0] = OperationContext.Current.RequestContext.RequestMessage;;

            return(this.DefaultUnhandledDispatchOperation.Invoker.Invoke(instance, inputs, out outputs));
        }
Beispiel #3
0
 public string Get()
 {
     return(ProxyGenerator.GetClientProxyScript(type, path, debug));
 }