Ejemplo n.º 1
0
        public void __construct(string wsdl, [Optional] PhpArray options)
        {
            bool             enableMessageAccess = false;
            WsdlCache        wsdlCache           = WsdlCache.Both;
            X509Certificate2 certificate         = null;

            if (options != null)
            {
                object value;

                if (options.TryGetValue("trace", out value))
                {
                    enableMessageAccess = PHP.Core.Convert.ObjectToBoolean(value);
                }

                if (options.TryGetValue("cache_wsdl", out value))
                {
                    wsdlCache = (WsdlCache)value;//PHP.Core.Convert.ObjectToBoolean(value);//WsdlCache.None == 0, anything else is true
                }

                if (options.TryGetValue("exceptions", out value))
                {
                    exceptions = PHP.Core.Convert.ObjectToBoolean(value);
                }

                // certificate:
                string pass = null;

                if (options.TryGetValue("passphrase", out value))
                {
                    pass = Core.Convert.ObjectToString(value);
                }

                if (options.TryGetValue("local_cert", out value))
                {
                    var cert = Core.Convert.ObjectToString(value);
                    if (cert != null)
                    {
                        certificate = new X509Certificate2(cert, pass);
                    }
                }
            }

            try
            {
                wsp = new DynamicWebServiceProxy(wsdl, enableMessageAccess, wsdlCache, certificate);
            }
            catch (Exception exception)
            {
                SoapFault.Throw(ScriptContext.CurrentContext, "SOAP-ERROR", exception.Message, exceptions);
            }
        }
Ejemplo n.º 2
0
 public void __construct(string wsdl, [Optional] PhpArray options)
 {
     wsp = new DynamicWebServiceProxy(wsdl);
 }
Ejemplo n.º 3
0
        public void __construct(string wsdl, [Optional] PhpArray options)
        {
            bool enableMessageAccess = false;
            WsdlCache wsdlCache = WsdlCache.Both;
            X509Certificate2 certificate = null;

            if (options != null)
            {
                object value;
                
                if (options.TryGetValue("trace", out value))
                {
                    enableMessageAccess = PHP.Core.Convert.ObjectToBoolean(value);
                }

                if (options.TryGetValue("cache_wsdl", out value))
                {
                    wsdlCache = (WsdlCache)value;//PHP.Core.Convert.ObjectToBoolean(value);//WsdlCache.None == 0, anything else is true
                }

                if (options.TryGetValue("exceptions", out value))
                {
                    exceptions = PHP.Core.Convert.ObjectToBoolean(value);
                }

                // certificate:
                string pass = null;

                if (options.TryGetValue("passphrase", out value))
                {
                    pass = Core.Convert.ObjectToString(value);
                }

                if (options.TryGetValue("local_cert", out value))
                {
                    var cert = Core.Convert.ObjectToString(value);
                    if (cert != null)
                        certificate = new X509Certificate2(cert, pass);
                }
            }

            try
            {
                wsp = new DynamicWebServiceProxy(wsdl, enableMessageAccess, wsdlCache, certificate);
            }
            catch (Exception exception)
            {
                SoapFault.Throw(ScriptContext.CurrentContext, "SOAP-ERROR", exception.Message, exceptions);
            }

        }