Example #1
0
 public string __getLastRequest()
 {
     try
     {
         return(wsp.SoapRequest);
     }
     catch (Exception exception)
     {
         SoapFault.Throw(ScriptContext.CurrentContext, "SOAP-ERROR", exception.Message, exceptions);
         return(null);
     }
 }
Example #2
0
 public object __getLastResponse()
 {
     try
     {
         return(wsp.SoapResponse);
     }
     catch (Exception exception)
     {
         SoapFault.Throw(ScriptContext.CurrentContext, "SOAP-ERROR", exception.Message, exceptions);
         return(null);
     }
 }
Example #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);
            }
        }
Example #4
0
        internal static void Throw(ScriptContext/*!*/context,
            string faultcode, string faultstring, bool throwSoapFault=true)
        {
            if (throwSoapFault)
            {
                var e = new SoapFault(context, true);
                e.__construct(context, faultcode, faultstring);

                throw new PhpUserException(e);
            }
            else
            {
                PhpException.Throw(PhpError.Error, faultstring);
            }
        }
Example #5
0
        internal static void Throw(ScriptContext /*!*/ context,
                                   string faultcode, string faultstring, bool throwSoapFault = true)
        {
            if (throwSoapFault)
            {
                var e = new SoapFault(context, true);
                e.__construct(context, faultcode, faultstring);

                throw new PhpUserException(e);
            }
            else
            {
                PhpException.Throw(PhpError.Error, faultstring);
            }
        }
Example #6
0
        public object __call(string function_name, PhpArray arguments /*, PhpArray options, PhpArray input_headers, PhpArray output_headers*/)
        {
            try
            {
                if (arguments.Count > 0)
                {
                    var item = arguments.GetArrayItem(0, true);

                    if (item != null && item.GetType() == typeof(PhpArray))
                    {
                        PhpArray arr = (PhpArray)item;
                        return(wsp.InvokeCall(function_name, arr));
                    }
                }
            }
            catch (Exception exception)
            {
                SoapFault.Throw(ScriptContext.CurrentContext, "SOAP-ERROR", exception.Message, exceptions);
            }

            return(null);
        }