예제 #1
0
 public void load_Wsdl_From_Assembly(Assembly wsdlAssembly)
 {
     if (wsdlAssembly.notNull())
     {
         Methods_TreeView.clear();
         "Loading Wsdl from Assembly: {0} at {1}".info(wsdlAssembly.str(), wsdlAssembly.Location);
         WsdlAssembly = wsdlAssembly;
         var soapMethods = WsdlAssembly.webService_SoapMethods();
         "Found {0} Web Service methods:{0}".info(soapMethods.size());
         Methods_TreeView.add_Nodes(soapMethods, (method) => ((this.ShowFullMethodSignatures)
                                                                                                                                         ? method.str()
                                                                                                                                         : method.Name));
         Methods_TreeView.selectFirst();
     }
     else
     {
         "Provided Assembly was null".error();
     }
     markGuiAs_OK();
 }
예제 #2
0
 public void markGuiAs_OK()
 {
     Methods_TreeView.backColor(Color.White);
 }
예제 #3
0
 public void markGuiAs_Busy()
 {
     Methods_TreeView.backColor(Color.LightPink);
 }
예제 #4
0
        public ascx_WSDL_Creation_and_Execution buildGui()
        {
            var topPanel = this.add_Panel();

            topPanel.insert_Below(100).add_LogViewer();
            //var assemblyInvoke = topPanel.add_Control<O2.External.SharpDevelop.Ascx.ascx_AssemblyInvoke>();
            //assemblyInvoke.loadAssembly("OnlineStorage.dll".assembly());
            //var methodProperties = topPanel.add_DataGridView();
            var methodProperties = topPanel.add_GroupBox("Request Data").add_Control <ascx_ObjectViewer>();

            methodProperties.showSerializedString().createObjectWhenNull().simpleView();

            Methods_TreeView           = methodProperties.parent().insert_Left("Soap Methods").add_TreeView().sort();
            ExecutionResult            = methodProperties.parent().insert_Below(150).add_GroupBox("Web Service Invocation Response Data").add_TextArea();
            ExecutionResult_Properties = ExecutionResult.insert_Right().add_PropertyGrid();
            ExecutionResult_TreeView   = ExecutionResult_Properties.insert_Below().add_TreeView();
            ExecuteSoapRequest_Button  = methodProperties.insert_Below(40)
                                         .add_Button("Execute Soap request")
                                         .font_bold()
                                         .fill();

            Methods_TreeView.afterSelect <MethodInfo>(
                (methodInfo) => {
                CurrentMethod = methodInfo;
                "Current Method: {0}".info(CurrentMethod.Name);
                "Current Method: Signature = {0}".info(CurrentMethod.str());
                "Current Method: DeclaringType = {0}".info(CurrentMethod.DeclaringType.FullName);
                SoapParametersObject = methodInfo.create_LiveObject_From_MethodInfo_Parameters("Soap_Invocation_Parameters");
                if (SoapParametersObject.notNull())
                {
                    methodProperties.visible(true);
                    methodProperties.show(SoapParametersObject);
                }
                else
                {
                    methodProperties.visible(false);
                }
                //new O2FormsReflectionASCX().loadMethodInfoParametersInDataGridView(methodInfo, methodProperties);
            });

            ExecuteSoapRequest_Button.onClick(
                () => {
                //var parameters = new O2FormsReflectionASCX().getParameterObjectsFromDataGridColumn(methodProperties, "Value");
                var invocationParameters = new List <object>();
                foreach (var property in SoapParametersObject.type().properties())
                {
                    invocationParameters.add(SoapParametersObject.property(property.Name));
                }

                ExecutionResult.set_Text("[{0}] Executing method : {1}".line().format(DateTime.Now, CurrentMethod.Name));

                var liveObject = CurrentMethod.DeclaringType.ctor();
                ExecutionResult.append_Line("Created dynamic proxy object of type: {0}".format(liveObject));

                try
                {
                    var o2Timer  = new O2Timer("Method execution time: ").start();
                    ResultObject = CurrentMethod.Invoke(liveObject, invocationParameters.ToArray());
                    ExecutionResult.append_Line("Method execution time: {0}".format(o2Timer.stop()));
                    ExecutionResult.append_Line("Method Executed OK, here is the return value:");
                    ExecutionResult.append_Line(ResultObject.str().lineBeforeAndAfter());
                    ExecutionResult_Properties.show(ResultObject);
                    ExecutionResult_TreeView.xmlShow(ResultObject.serialize());
                }
                //catch(System.Web.Services.Protocols.SoapException ex)
                //{

                //}
                catch (Exception ex)
                {
                    ExecutionResult.append_Line((ex.InnerException.property("Detail") as System.Xml.XmlElement).OuterXml);
                    ExecutionResult.append_Line(ex.InnerException.Message);
                    ExecutionResult.append_Line(ex.InnerException.StackTrace);
                    //show.info(ex);
                    //ex.details();
                }

                //currentMethod.invoke(parameters);

                ExecutionResult.append_Line("Execution complete");
            });


            Methods_TreeView.insert_Below(20)
            .add_CheckBox("Show Full Method Signatures", 0, 0, (value) => ShowFullMethodSignatures = value)
            .autoSize()
            .parent <Panel>()
            .add_CheckBox("Cache WSDL Dll", 0, 200, (value) => Cache_WSDL_Dll = value)
            .autoSize()
            .check();


            //.append_Link("Delete cached compiled dll", deleteCachedFile);

            ExecutionResult.insert_Below(20)
            .add_Link("View serialized string of response object", 0, 0,
                      () => {
                var serializedResponse = ResultObject.serialize(false);
                if (serializedResponse.notNull())
                {
                    "".showInCodeViewer().set_Text(serializedResponse, "a.xml");
                }
            });

            TestWebServices = topPanel.insert_Above(22).add_ComboBox();

            WsdlLocation = topPanel.insert_Above(22)
                           .add_LabelAndTextAndButton("Load Custom WSDL from location (file or url)", "", "Load", (value) => open(value))
                           .control <TextBox>();
            ExtraWsdlParameres = topPanel.insert_Above(22).add_Label("Extra wsdl.exe parameters").left(WsdlLocation.Left).top(2)
                                 .append_TextBox("").align_Right(topPanel);
            addScriptingSupport();


            add_TestWebServices();

            return(this);
        }