Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    .NET integration again

    Hello Isomorphic,

    I bought the small vendor license about 3 weeks ago and tried to do the exercises about .NET integration shown on your examples. I have some experience in JavaScript, in Visual Studio 2005 C# and web methods, but I cannot get a fully working demo to show to my boss containing ListGrids, Details, or menus like the Demo you show on the products example. I read the documentation but there is something I am missing something for sure, or it is not clear at all how to put together this kind of integratioin. We are working on a big enterprise project using SmartClient and .NET web services but we are running out of time to show some advances. It is a great tool but I think there is some examples missing on the .NET side.

    Do you have a step by step, working example using .NET integration that I can follow?
    Please help.

    Thanks in advance for your advice.

    #2
    Hi Roberto,

    The overview on integration with .NET and other backends is here. There are examples of .NET integration based on webmethods in the isomorphicSDK/examples/databinding/dotNet of your SDK. These extend popular Visual Studio WebMethods tutorials.

    Beyond that you need to provide specific information on what issues your having before more help can be provided.

    Alternatively, contact Isomorphic about training or consulting services.

    Comment


      #3
      Hi Roberto,

      I was working through the same issues with the documentation for .net integration. I learn very quickly by example. And there are very few in the Smartclient docs. I'm working on an administration portion of an internal corporate app, so there are very few simultaneous users. What I did was write a series of ASHX apps to handle the main entities of the site. Most of the work is done in SQL. Here's an example SQL proc:

      Code:
      
      CREATE PROCEDURE dbo.spUsergroupSelectXMLForUIIsoFilter
      (
      
      		@DivID Int,
      		@startRow Int = 1,
      		@endRow Int = 50,
      		@orderColumn varchar(50) = 'groupname',
      		@filterXML xml = '<filters />'
      )
       AS
      
      --SET ARITHABORT ON 
      --SET ANSI_WARNINGS OFF
      SET NOCOUNT ON
      
      
      DECLARE @startTime DATETIME, @endTime DATETIME
      SET @startTime = GETDATE()
      
      
      DECLARE @TotalRecords Int,
      		@idoc int
      DECLARE @filters table (
      			col varchar(50),
      			startsWith bit,
      			exact bit,
      			val varchar(7800)
      		)
      
      INSERT @filters ( val, col, exact, startsWith)
      SELECT filters.filter.value('./@value', 'varchar(7800)') AS val,
      	filters.filter.value('./@columnName', 'varchar(50)') AS col,
      	filters.filter.value('./@exactMatch', 'Int') AS exact,
      	filters.filter.value('./@startsWith', 'Int') AS startsWith
      FROM @filterXML.nodes('/filters/filter') filters(filter)
      
      DECLARE @UsergroupIds TABLE (UsergroupId INT)
      
      DECLARE @globalFilter varchar(50),
      		@UsergroupIdFilter varchar(50),
      		@GroupnameFilter varchar(50),
      		@GroupDescFilter Int,
      		@NetworkAffiliationIdFilter varchar(50),
      		@ModifyDateFilter varchar(50),
      		@usersFilterExists int,
      		@registrationsFilterExists int,
      		@output xml	
      		
      DECLARE	@usersFilter TABLE(userid INT)
      DECLARE @registrationsFilter TABLE(registrationId INT)
      
      SET @globalFilter = NULL
      SET @UsergroupIdFilter = NULL
      SET @GroupnameFilter = NULL
      SET @GroupDescFilter = NULL
      SET @NetworkAffiliationIdFilter = NULL
      SET @ModifyDateFilter = NULL
      SET @usersFilterExists = 0	
      SET @registrationsFilterExists = 0
      
      
      --Assign the filters to local vars to make the where clauses easier:
      IF (SELECT COUNT(col) FROM @filters) > 0 
      BEGIN 
      	SET @UsergroupIdFilter = (SELECT dbo.ufIsoFilterSearchString(val, ISNULL(startsWith,0), ISNULL(exact,0)) FROM @filters WHERE col = 'usergroupid')
      	SET @GroupnameFilter = (SELECT dbo.ufIsoFilterSearchString(val, ISNULL(startsWith,0), ISNULL(exact,0)) FROM @filters WHERE col = 'groupname')
      	SET @GroupDescFilter = (SELECT dbo.ufIsoFilterSearchString(val, ISNULL(startsWith,0), ISNULL(exact,0)) FROM @filters WHERE col = 'groupdesc')
      	SET @globalFilter = (SELECT dbo.ufIsoFilterSearchString(val, ISNULL(startsWith,0), ISNULL(exact,0)) FROM @filters WHERE col = 'global')
      	SET @NetworkAffiliationIdFilter = (SELECT dbo.ufIsoFilterSearchString(val, ISNULL(startsWith,0), ISNULL(exact,0)) FROM @filters WHERE col = 'networkaffiliationid')
      	SET @ModifyDateFilter = (SELECT dbo.ufIsoFilterSearchString(val, ISNULL(startsWith,0), ISNULL(exact,0)) FROM @filters WHERE col = 'modifydate')
      	
      	
      	
      	
      END 
      --End the basic filter var assignments.
      
      
      INSERT @UsergroupIds (usergroupid)
      	SELECT ug.Usergroupid
      	FROM vu_Usergroups ug 
      			LEFT OUTER JOIN 
      			(SELECT DISTINCT uxu.UsergroupId 
      				FROM UserXUsergroup uxu
      				JOIN @usersFilter uf ON uf.userid = uxu.userid
      			) AS us ON ug.UsergroupId = us.UsergroupId
      			LEFT OUTER JOIN 
      			(SELECT DISTINCT rxu.UsergroupId 
      				FROM RegistrationXUsergroup rxu
      				JOIN @registrationsFilter rf ON rf.registrationid = rxu.registrationid
      			) AS us2 ON ug.UsergroupId = us2.UsergroupId
      			
      		WHERE ug.DivId = @DivId
      		AND (@GroupnameFilter IS NULL OR ug.Groupname like @GroupnameFilter) 
      		AND (@GroupDescFilter IS NULL OR ug.GroupDesc like @GroupDescFilter) 
      		AND (@globalFilter IS NULL OR 
      					ug.Usergroupid LIKE @globalFilter
      					OR ug.GroupDesc like @globalFilter
      					OR ug.Groupname like @globalFilter
      			)
      		
      
      
      
      --Get The Total Records:
      SET @TotalRecords = (
      	SELECT 
      		COUNT(ug.usergroupid)
      	FROM vu_Usergroups ug 
      			JOIN @UsergroupIds ugs ON ugs.usergroupid = ug.usergroupid
      
      )
      
      
      		;WITH u AS (
      		SELECT 
      			CASE 
      			WHEN @orderColumn = 'usergroupid' THEN ROW_NUMBER() OVER (ORDER BY ug.usergroupid ASC)
      			WHEN @orderColumn = '-usergroupid' THEN ROW_NUMBER() OVER (ORDER BY ug.usergroupid DESC)
      			WHEN @orderColumn = 'groupname' THEN ROW_NUMBER() OVER (ORDER BY ug.groupname ASC)
      			WHEN @orderColumn = '-groupname' THEN ROW_NUMBER() OVER (ORDER BY ug.groupname DESC)
      			WHEN @orderColumn = 'groupdesc' THEN ROW_NUMBER() OVER (ORDER BY ug.groupdesc)
      			WHEN @orderColumn = '-groupdesc' THEN ROW_NUMBER() OVER (ORDER BY ug.groupdesc DESC)
      			WHEN @orderColumn = 'sort' THEN ROW_NUMBER() OVER (ORDER BY ug.sort ASC)
      			WHEN @orderColumn = '-sort' THEN ROW_NUMBER() OVER (ORDER BY ug.sort DESC)
      			WHEN @orderColumn = 'networkaffiliationid' THEN ROW_NUMBER() OVER (ORDER BY ug.networkaffiliationid ASC)
      			WHEN @orderColumn = '-networkaffiliationid' THEN ROW_NUMBER() OVER (ORDER BY ug.networkaffiliationid DESC)
      			WHEN @orderColumn = 'modifydate' THEN ROW_NUMBER() OVER (ORDER BY ug.modifydate ASC)
      			WHEN @orderColumn = '-modifydate' THEN ROW_NUMBER() OVER (ORDER BY ug.modifydate DESC)
      			ELSE ROW_NUMBER() OVER (ORDER BY ug.Groupname ASC) 
      			END as Row, ug.usergroupid, REPLACE(isnull(ug.GroupName,''), 'NULL', '') AS 'GroupName', 
      				REPLACE(isnull(ug.GroupDesc,''), 'NULL', '') as 'GroupDesc', 
      				ug.sort, ug.NetworkAffiliationId,  ug.ModifyDate
      		FROM vu_Usergroups ug  
      			JOIN @UsergroupIds ugs ON ugs.usergroupid = ug.usergroupid
      
      )
      			
      		
      	SELECT 
      		1 AS Tag,
      		NULL AS Parent,
      		NULL as 'usergroups!1!',
      		@TotalRecords as  'usergroups!1!totalrecords',
      		@startRow as  'usergroups!1!startRow',
      		@endRow as  'usergroups!1!endRow',
      		@orderColumn as  'usergroups!1!sortBy',
      		NULL as 'usergroup!2!usergroupid', 
      		NULL as 'usergroup!2!groupname', 
      		NULL as 'usergroup!2!groupdesc!CDATA',
      		NULL as 'usergroup!2!sort',
      		NULL as 'usergroup!2!networkaffiliationid',
      		NULL as 'usergroup!2!modifydate',
      		NULL as 'usergroup!2!Row'
      
      		UNION ALL 
      
      		SELECT  
      		2 AS Tag,
      		1 AS Parent,
      		NULL,
      		NULL,
      		NULL,
      		NULL,
      		NULL,
      		u.usergroupid, 
      		u.groupname, 
      		u.groupdesc, 
      		u.sort, 
      		u.networkaffiliationid, 
      		isnull(u.modifydate,''),
      		row	 
      		FROM u 
      		WHERE row between @startRow and @endRow
      		ORDER BY 14
      		FOR XML EXPLICIT
      		
      SET NOCOUNT OFF
      In my .net code (which I cannot post) I have a class called isoFilterCollection which generates XML for parameters returned by Smartclient and passes it to the filterXML parameter.

      In my JS code for the smartclient app I have transform request and responses for my Datasources:

      Code:
      isc.DataSource.create({
              ID:"UserGroupsForRegDS",
              showPrompt: false,
              dataFormat: "xml",
              dataURL:"/browse/isotest/Usergroups.ashx",
              recordXPath : "//usergroup",
              fields:[
                  { name : "usergroupid", title:"GroupId", hidden: true },
                  { name : "groupname", title:"Name", width: 120},
                  { name : "groupdesc", title:"Description", hidden: true },
                  { name : "datestart", title:"Start"},
                  { name : "dateend", title:"End"},
                  { name : "networkaffiliationid", width: 75, hidden: true},
                  { name : "modifydate", title:"Modify Date", width: 150, hidden: true}
              ],
              transformRequest : function (dsRequest) {
                       if (dsRequest.operationType == "fetch") {
                          var params = {
                              startRow : dsRequest.startRow,
                              endRow : dsRequest.endRow,
                              method : "fetch_usergroupsForReg",
                              sortBy: (dsRequest.sortBy == 'undefined') ? "" : dsRequest.sortBy,
                              registrations: regId   
                          };
                          // combine paging parameters with criteria
                          return isc.addProperties({}, dsRequest.data, params);
                          }
                  },
              transformResponse: function (dsResponse,dsRequest,xmlData){
                  if (dsRequest.operationType == "fetch") {
                      if( xmlData ) {
                              dsResponse.totalRows = isc.XMLTools.selectNumber(xmlData, "//usergroups/@totalrecords");
                              dsResponse.startRow = isc.XMLTools.selectNumber(xmlData, "//usergroups/@startRow");
                              dsResponse.endRow = isc.XMLTools.selectNumber(xmlData, "//usergroups/@endRow");
                              dsResponse.sortBy = isc.XMLTools.selectNumber(xmlData, "//usergroups/@sortBy");
                          }
                      }
                      return dsResponse;
                  }
          });


      I think I may have posted the wrong Datasource code for the wrong proc so the fields may not match up, but I hope it gives you some ideas.

      Paul

      Comment


        #4
        .NET integration case

        Thanks for your message. I am working with an .NET ERP system where the web services are already defined and I cannot change the source code. I can only access the web services API. A little bit like the SalesForce example on SmartClient.

        I've been working with an example where I need to login to the system and logoff. The system has a set of web services to deal with the Logon, Logoff and GetUserProfile from a database, shown below:

        Code:
        <?xml version="1.0" encoding="utf-8"?>
        <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://www.syspro.com/ns/utilities/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
          <wsdl:types>
            <s:schema elementFormDefault="qualified" targetNamespace="http://www.syspro.com/ns/utilities/">
              <s:element name="Logon">
                <s:complexType>
                  <s:sequence>
                    <s:element minOccurs="0" maxOccurs="1" name="Operator" type="s:string" />
                    <s:element minOccurs="0" maxOccurs="1" name="OperatorPassword" type="s:string" />
                    <s:element minOccurs="0" maxOccurs="1" name="CompanyId" type="s:string" />
                    <s:element minOccurs="0" maxOccurs="1" name="CompanyPassword" type="s:string" />
                    <s:element minOccurs="1" maxOccurs="1" name="LanguageCode" type="tns:Language" />
                    <s:element minOccurs="1" maxOccurs="1" name="LogLevel" type="tns:LogDetail" />
                    <s:element minOccurs="1" maxOccurs="1" name="EncoreInstance" type="tns:Instance" />
                    <s:element minOccurs="0" maxOccurs="1" name="XmlIn" type="s:string" />
                  </s:sequence>
                </s:complexType>
              </s:element>
              <s:simpleType name="Language">
                <s:restriction base="s:string">
                  <s:enumeration value="AUTO" />
                  <s:enumeration value="ENGLISH_US" />
                </s:restriction>
              </s:simpleType>
              <s:simpleType name="LogDetail">
                <s:restriction base="s:string">
                  <s:enumeration value="ldNoDebug" />
                  <s:enumeration value="ldDebug" />
                </s:restriction>
              </s:simpleType>
              <s:simpleType name="Instance">
                <s:restriction base="s:string">
                  <s:enumeration value="EncoreInstance_0" />
                  <s:enumeration value="EncoreInstance_1" />
                  <s:enumeration value="EncoreInstanceTostring_10" />
                </s:restriction>
              </s:simpleType>
              <s:element name="LogonResponse">
                <s:complexType>
                  <s:sequence>
                    <s:element minOccurs="0" maxOccurs="1" name="LogonResult" type="s:string" />
                  </s:sequence>
                </s:complexType>
              </s:element>
              <s:element name="Logoff">
                <s:complexType>
                  <s:sequence>
                    <s:element minOccurs="0" maxOccurs="1" name="UserId" type="s:string" />
                  </s:sequence>
                </s:complexType>
              </s:element>
        ... more wsdl code...
        I copied the structure of the SalesForce example and adapted it to show as follows:
        Code:
        if (typeof LS == "undefined") {
            LS = {};
        	// Syspro web services
        	LS.utilitiesWebService = null;
        	LS.utilitiesWebServiceWDSL = "http://localhost/SysproWebServices/utilities.asmx?wsdl"
        	LS.utilitiesLoaded = function () {
        		this.utilitiesWebService = isc.WebService.get("http://www.syspro.com/ns/utilities/")
        		if (this.utilitiesWebService == null) {
        			isc.warn("There is no communication with Web Services.")
        		}
        		else {
        			LS.loginWindow.show();
        		}
        	}
        
            LS.login = function (userName, password, company, companyPassword) {
        		LS.userName = userName;
        		LS.companyID = company;
                this.utilitiesWebService.callOperation("Logon", 
                                   { Operator: userName,
                                     OperatorPassword: password,
        							 CompanyId : company,
        							 CompanyPassword:companyPassword,
        							 LanguageCode: "AUTO",
        							 LogLevel:"ldNoDebug",
        							 EncoreInstance:"EncoreInstance_0",
        							 XmlIn: ""
        							},
                                   "/LogonResponse/LogonResult",
        						   { target : this, methodName : "loginReply" },
                                   { willHandleError:true, showPrompt:true, prompt:"Logging into..." });
            };
        	
            LS.loginReply = function (data, xmlDoc, rpcResponse, wsRequest) {
                if (rpcResponse.status < 0) {
                    LS.loginForm.showItem("loginFailure");
        		} else {
        			//isc.warn("("+data.toString()+")");
              		var loginData = rpcResponse.results; // trim UserID
              		var ixStart = loginData.indexOf("<LogonResult>");
        			var ixEnd = loginData.indexOf("</LogonResult>")
                	LS.sessionID =  loginData.substring(ixStart,ixEnd);
        			LS.sessionID = LS.sessionID.substring(0,46);
        			LS.loggedIn = (LS.sessionID != null );
                    LS.loginWindow.hide();
        			LS_LoginButton.setTitle("Logoff");
        			var userData = "";
        			userData += "("+LS.sessionID+")<br>";
        			LS_UserData.setContents(userData);
        			LS_MainLayout.draw();
        			// get the user profile to show on the header
                	this.utilitiesWebService.callOperation("GetLogonProfile", 
                                   { UserID: LS.sessionID},
                                   "/GetLogonProfileResponse/GetLogonProfileResult",
                                   { target : this, methodName : "profileReply" },
                                   { willHandleError:true, showPrompt:true, prompt:"Getting user profile from..." });
        			
        		}
            };
        
            LS.profileReply = function (data, xmlDoc, rpcResponse, wsRequest) {
                if (rpcResponse.status < 0) {
        			LS_UserData.setContents("GetLogonProfileResult failure");
        		} else {
              		var loginData = rpcResponse.results; 
              		var ixStart = loginData.indexOf("<GetLogonProfileResult>");
        			var ixEnd = loginData.indexOf("</GetLogonProfileResult>")
        			var userData = "";
                	userData =  loginData.substring(ixStart,ixEnd);
        			LS_UserData.setContents(userData);
        		}
            };
        	
        	LS.logoff = function ()	{
                this.utilitiesWebService.callOperation("Logoff", 
                                   { UserId: LS.sessionID},
                                   "//LogoffResult",
                                   { target : this, methodName : "logoffReply" },
                                   { willHandleError:true, showPrompt:true, prompt:"Logging off from..." });
        		
        	}
        
            LS.logoffReply = function (data, xmlDoc, rpcResponse, wsRequest) {
                if (rpcResponse.status < 0) {
                	isc.warn("Could not logoff from...");
        		} else {
              		var loginData = rpcResponse.results; // trim UserID
              		var ixStart = loginData.indexOf("<LogoffResult>");
        			var ixEnd = loginData.indexOf("</LogoffResult>")
                	LS.sessionID =  loginData.substring(ixStart,ixEnd);
        			LS.sessionID = LS.sessionID.substring(0,46);
        			msg.setContents(ixStart.toString()+">"+LS.sessionID+"<"+ixEnd.toString());
                	LS.sessionID = null;
        			LS.loggedIn = false;
                    LS.loginForm.hideItem("loginFailure");
                    LS.loginWindow.show();
        			LS_LoginButton.title = "Login"
        		}
            };
        	
        	LS.loginForm = isc.DynamicForm.create({
        		ID:"loginForm",
            	numCols: 2,
            	autoDraw: false,
        	    autoFocus:false,
        	    saveOnEnter:true,
        	    fields : [
        	        { name:"loginFailure", type:"blurb", cellStyle:"formCellError",
        	          defaultValue: "Invalid credentials", colSpan: 2,
        	          visible:false },
        	        { name:"username", title:"Username", titleOrientation: "left", required:true},
        	        { name:"password", title:"Password", titleOrientation: "left", type:"password", required:true },
        			{ name:"company", title:"Company ID", titleOrientation: "left", type:"string", required:true}, 
        			{ name:"companyPass", title:"Company password", titleOrientation: "left", type:"password", required:true}, 
        //			{ name:"languageCode", title:"language code", titleOrientation: "left", type:"password", required:true}, 
        	        { name:"submitButton", type:"button", type:"submit", title:"Log in" }
        	    ],
        	    submit : function () {
                	LS.login(LS.loginForm.getValue("username"), LS.loginForm.getValue("password"),LS.loginForm.getValue("company"),LS.loginForm.getValue("companyPass"));
        	    }
        	});
        
        	LS.loginWindow = isc.Window.create({
        	    autoDraw:false,
        	    title: "Please log in",
        	    autoCenter: true,
        	    autoSize: true,
        	    isModal: true,
        	    items: [ LS.loginForm ]
        	});
        	
        };
        When the application starts it shows a login window with a dynamic form for the user to enter its credentials, when he post the submitt (login) button I call the this.utilitiesWebService.callOperation("Logon", in order to contact the web service and get a session ID that will further will be used to call other fucntionality and eventually to logoff from the web service.

        When the callback function (loginReply) is called the data variable is undefined and I dindt find functions to work easily with the xmlDoc variable. I used the rpcResponse.results variable to isolate the response from the server. and got a session id string. However when i try to use the same session id string to get the user profile the web service do not recognize it and give errors, even to logoff (i need to send the session id).

        I used the system developer console to call the logon web service and got the correct session id. I typed in the session id string onto the logoff service and it work on the console. What am i doing wrong in my code? This is where I say the examples are not well documented.

        Can somebody help me? My time for this project is running out at a fast rate and may be i will change to another AJAX library if i cannot make this work, even when i already paid for the small vendor licence.

        Comment


          #5
          Hi roberto,

          You can use XMLTools methods such as selectString() to extract something like a sessionId. This is shown in a couple of examples..

          On your problem calling operations after login - as the WSDL Binding overview covers, dataSource.xmlSerialize() is used to create the SOAP message, and you should adjust the data you are passing, if necessary, in order to cause a correct message to be formed.

          One place to obtain a correct sample request is the WSDL tab in the Developer Console. One way to quickly troubleshoot is to make calls to callOperation() from the Developer Console and watch the requests that are being formed by enabling the relevant log categories or by using a tool like Fiddler or Firebug.

          We'd be happy to help further, but, we're in this frustrating situation where you're complaining about problems but won't post enough information to allow us to actually solve it for you. We can't suggest corrections to your attempt to use callOperation() without seeing at least the complete WSDL file.

          Comment


            #6
            Hello Isomorphic,

            Is there a way to send you by email or upload source code files greater than 10000 characters? Because your forum does not accept messages (including code) of more than that quantity of bytes, that’s why I chopped some unimportant elements in the enumeration fields language and others. I hope the JavaScript version is less verbose than XML.

            I used the developer console to get a JavaScript version of the WSDL file as shown below. I managed to use this file and get connected to the web service. Please note that the service is installed on my local computer (localhost) and for the moment I do not have a public IP where you can connect to call the service

            Code:
            isc.SchemaSet.create({
                serviceNamespace:"http://www.syspro.com/ns/utilities/",
                schema:[
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"Logon",
                        fields:{
                            Operator:{type:"string", xmlRequired:false, name:"Operator"},
                            OperatorPassword:{type:"string", xmlRequired:false, name:"OperatorPassword"},
                            CompanyId:{type:"string", xmlRequired:false, name:"CompanyId"},
                            CompanyPassword:{type:"string", xmlRequired:false, name:"CompanyPassword"},
                            LanguageCode:{type:"Language", xmlRequired:true, name:"LanguageCode"},
                            LogLevel:{type:"LogDetail", xmlRequired:true, name:"LogLevel"},
                            EncoreInstance:{type:"Instance", xmlRequired:true, name:"EncoreInstance"},
                            XmlIn:{type:"string", xmlRequired:false, name:"XmlIn"}
                        }
                    })
            ,
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"LogonResponse",
                        fields:{
                            LogonResult:{type:"string", xmlRequired:false, name:"LogonResult"}
                        }
                    })
            ,
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"Logoff",
                        fields:{
                            UserId:{type:"string", xmlRequired:false, name:"UserId"}
                        }
                    })
            ,
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"LogoffResponse",
                        fields:{
                            LogoffResult:{type:"string", xmlRequired:false, name:"LogoffResult"}
                        }
                    })
            ,
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"GetLogonProfile",
                        fields:{
                            UserId:{type:"string", xmlRequired:false, name:"UserId"}
                        }
                    })
            ,
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"GetLogonProfileResponse",
                        fields:{
                            GetLogonProfileResult:{type:"string", xmlRequired:false, name:"GetLogonProfileResult"}
                        }
                    })
            ,
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"Run",
                        fields:{
                            UserId:{type:"string", xmlRequired:false, name:"UserId"},
                            BusinessObject:{type:"string", xmlRequired:false, name:"BusinessObject"},
                            Parameter:{type:"string", xmlRequired:false, name:"Parameter"}
                        }
                    })
            ,
                    isc.XSElement.create({
                        mustQualify:true,
                        ID:"RunResponse",
                        fields:{
                            RunResult:{type:"string", xmlRequired:false, name:"RunResult"}
                        }
                    })
            ,
                    isc.SimpleType.create({
                        inheritsFrom:"string",
                        valueMap:["AUTO", "ENGLISH_US", "FRENCH_CANADIAN", "DANISH", "DUTCH", "ENGLISH", "FINNISH", 
                         "FRENCH","GERMAN", "ITALIAN", "NORWEGIAN", "PORTUGUESE", "SPANISH", "SWEDISH"],
                        name:"Language"
                    })
            ,
                    isc.SimpleType.create({
                        inheritsFrom:"string",
                        valueMap:["ldNoDebug", "ldDebug"],
                        name:"LogDetail"
                    })
            ,
                    isc.SimpleType.create({
                        inheritsFrom:"string",
                        valueMap:["EncoreInstance_0", "EncoreInstance_1", "EncoreInstance_2", "EncoreInstance_3", 
                         "EncoreInstance_4","EncoreInstance_5", "EncoreInstance_6", "EncoreInstance_7", "EncoreInstance_8", 
                         "EncoreInstance_9","EncoreInstanceTostring_10"],
                        name:"Instance"
                    })
            
                ],
                schemaNamespace:"http://www.syspro.com/ns/utilities/",
                qualifyAll:true
            })
            
            isc.WebService.create({
                dataURL:"http://localhost/SysproWebServices/utilities.asmx",
                serviceNamespace:"http://www.syspro.com/ns/utilities/",
                soapStyle:"",
                operations:[
                    {inputEncoding:"literal", outputEncoding:"literal", soapStyle:"document", name:"Logon", 
                     inputMessage:"LogonSoapIn",soapAction:"http://www.syspro.com/ns/utilities/Logon", 
                     outputMessage:"LogonSoapOut"},
                    {inputEncoding:"literal", outputEncoding:"literal", soapStyle:"document", name:"Logoff", 
                     inputMessage:"LogoffSoapIn",soapAction:"http://www.syspro.com/ns/utilities/Logoff", 
                     outputMessage:"LogoffSoapOut"},
                    {inputEncoding:"literal", outputEncoding:"literal", soapStyle:"document", 
                     name:"GetLogonProfile",inputMessage:"GetLogonProfileSoapIn", 
                     soapAction:"http://www.syspro.com/ns/utilities/GetLogonProfile",outputMessage:"GetLogonProfileSoapOut"},
                    {inputEncoding:"literal", outputEncoding:"literal", soapStyle:"document", name:"Run", 
                     inputMessage:"RunSoapIn",soapAction:"http://www.syspro.com/ns/utilities/Run", 
                     outputMessage:"RunSoapOut"}
                ],
                messages:[
                    isc.WSDLMessage.create({
                        ID:"message:LogonSoapIn",
                        fields:{
                            Logon:{type:"Logon", xmlRequired:true, name:"Logon"}
                        }
                    })
            ,
                    isc.WSDLMessage.create({
                        ID:"message:LogonSoapOut",
                        fields:{
                            LogonResponse:{type:"LogonResponse", xmlRequired:true, name:"LogonResponse"}
                        }
                    })
            ,
                    isc.WSDLMessage.create({
                        ID:"message:LogoffSoapIn",
                        fields:{
                            Logoff:{type:"Logoff", xmlRequired:true, name:"Logoff"}
                        }
                    })
            ,
                    isc.WSDLMessage.create({
                        ID:"message:LogoffSoapOut",
                        fields:{
                            LogoffResponse:{type:"LogoffResponse", xmlRequired:true, name:"LogoffResponse"}
                        }
                    })
            ,
                    isc.WSDLMessage.create({
                        ID:"message:GetLogonProfileSoapIn",
                        fields:{
                            GetLogonProfile:{type:"GetLogonProfile", xmlRequired:true, name:"GetLogonProfile"}
                        }
                    })
            ,
                    isc.WSDLMessage.create({
                        ID:"message:GetLogonProfileSoapOut",
                        fields:{
                            GetLogonProfileResponse:{type:"GetLogonProfileResponse", xmlRequired:true, name:"GetLogonProfileResponse"}
                        }
                    })
            ,
                    isc.WSDLMessage.create({
                        ID:"message:RunSoapIn",
                        fields:{
                            Run:{type:"Run", xmlRequired:true, name:"Run"}
                        }
                    })
            ,
                    isc.WSDLMessage.create({
                        ID:"message:RunSoapOut",
                        fields:{
                            RunResponse:{type:"RunResponse", xmlRequired:true, name:"RunResponse"}
                        }
                    })
            
                ]
            })
            I will send the code in another message because there is no room for more text here…

            Comment


              #7
              Below is the main code I use to call the web services (there is only 4 services) Logon, Logoff, GetLogonProfile and Run. I managed to call the Logon and the Logoff services which return only a simple string as response. Even in that case the data[0] element that is supposed to be populated by that string is not defined when I call

              Code:
              /**
               * Configure the application 
               * @author Roberto Soto
               * @Created on 2008-03-14
               */
              
              isc.setAutoDraw(false);
              
              // Main application object and namespace 
              if (typeof LS == "undefined") {
                  LS = {};
                  LS.version = "1.1";
                  LS.showEdges = false;
                  LS.loggedIn = false;
              	LS.userName = "";
              	LS.companyID = "";
              	LS.companyName = "";
              	LS.sessionID = "";
              	LS.classificationID = "PartCategory";
              	LS.Category = "";
              	
              	LS.start =function(){
              		LS_MainLayout.draw();
              		LS.utilitiesLoaded();
              	};
              	LS.displayUserData = function (){
              		var userData = LS.userName + "<br>";
              		userData += LS.companyID + " " + LS.sessionID + "<br>";
              		userData += LS.companyName + "<br>";
              		LS_UserData.setContents(userData);
              	}
              
              	// Syspro web services
              	LS.utilitiesWebService = null;
              	LS.utilitiesWebServiceWDSL = "http://localhost/SysproWebServices/utilities.asmx?wsdl"
              	LS.utilitiesLoaded = function () {
              		this.utilitiesWebService = isc.WebService.get("http://www.syspro.com/ns/utilities/");
              		if (this.utilitiesWebService == null) {
              			isc.warn("There is no communication with Syspro Web Services.")
              		}
              		else {
              			//isc.warn("Communication ok with Syspro Web Services!!");
              			LS.loginWindow.show();
              		}
              	}
              
                  LS.login = function (userName, password, company, companyPassword) {
              		LS.userName = userName;
              		LS.companyID = company;
              		LS.companyName = "";
              		LS.sessionID = "";		
                      this.utilitiesWebService.callOperation("Logon", 
                                         { Operator: userName,
                                           OperatorPassword: password,
              							 CompanyId : company,
              							 CompanyPassword:companyPassword,
              							 LanguageCode: "AUTO",
              							 LogLevel:"ldNoDebug",
              							 EncoreInstance:"EncoreInstance_0",
              							 XmlIn: ""
              							},
                                         "/LogonResponse/LogonResult",
              						   { target : this, methodName : "loginReply" },
                                         { willHandleError:true, showPrompt:true, prompt:"Logging into Syspro..." });
                  };
              	
                  LS.loginReply = function (data, xmlDoc, rpcResponse, wsRequest) {
                      if (rpcResponse.status < 0) {
              			LS.userName = userName;
              			LS.companyID = company;
              			LS.companyName = "";
              			LS.sessionID = "";		
                          LS.loginForm.showItem("loginFailure");
              		} else {
              			LS.sessionID = getStringFromXML(rpcResponse.results,"LogonResult");
              			// show rest of application here once we are logged in
              			LS.loggedIn = (LS.sessionID != null );
                          LS.loginForm.hideItem("loginFailure");
                          LS.loginWindow.hide();
              			LS_LoginButton.setTitle("Logoff");
              			LS_ProductsButton.setVisibility((LS.loggedIn) ? "visible" : "hidden");
              			LS_MainLayout.draw();
              	        LS.showApplication("LS_MainProductsPane");
              			// get the user profile to show on the header
              
                      	this.utilitiesWebService.callOperation("GetLogonProfile", 
                                         { UserID: LS.sessionID},
                                         "//GetLogonProfileResult",
                                         { target : this, methodName : "profileReply" },
                                         { willHandleError:true, showPrompt:true, prompt:"Getting user profile from Syspro.." });
              
              		}		
              		LS.displayUserData();
                  };
              
                  LS.profileReply = function (data, xmlDoc, rpcResponse, wsRequest) {
              		alert(rpcResponse.results.data);
                      if (rpcResponse.status < 0) {
              			LS.companyName = "GetLogonProfileResult failure";
              		} else {
                    		var loginData = getStringFromXML(rpcResponse.results,"GetLogonProfileResult"); 
              		}
              		LS.displayUserData();
                  };
              
              	LS.logoff = function ()	{
                      this.utilitiesWebService.callOperation("Logoff",
                                         { UserId: LS.sessionID},
                                         "//LogoffResult",
                                         { target : this, methodName : "logoffReply" },
                                         { willHandleError:true, showPrompt:true, prompt:"Logging off from Syspro.." });
              		
              	}
              
                  LS.logoffReply = function (data, xmlDoc, rpcResponse, wsRequest) {
                      if (rpcResponse.status < 0) {
                      	isc.warn("Could not logoff from Syspro...");
              		} else {
                    		var logoffData = getStringFromXML(rpcResponse.results,"LogoffResult");
              			if (logoffData != "0") {
                      		isc.warn("Could not logoff from Syspro.(" + logoffData + ")");
              			}
               
              			// hide rest of application here once we are logged off
              			LS.loggedIn = false;
                          LS.loginForm.hideItem("loginFailure");
              			LS_LoginButton.setTitle("Login");
              			LS.sessionID = "";		
              			LS.userName = "";
              			LS.companyName = "";
              			LS.companyID = "";
              			LS_ProductsButton.setVisibility((LS.loggedIn) ? "visible" : "hidden");
              			LS_UserData.setContents("("+logoffData+")");
                      	LS.showApplication("LS_HomePagePane");
                          LS.loginWindow.show();
              			LS.displayUserData();
              		}
                  };
              	
              	LS.loginForm = isc.DynamicForm.create({
              		ID:"loginForm",
                  	numCols: 2,
                  	autoDraw: false,
              	    autoFocus:false,
              	    saveOnEnter:true,
              	
              	    fields : [
              	        { name:"loginFailure", type:"blurb", cellStyle:"formCellError",
              	          defaultValue: "Invalid credentials", colSpan: 2,
              	          visible:false },
              	        { name:"username", title:"Username", titleOrientation: "left", required:true},
              	        { name:"password", title:"Password", titleOrientation: "left", type:"password", required:true },
              			{ name:"company", title:"Company ID", titleOrientation: "left", type:"string", required:true}, 
              			{ name:"companyPass", title:"Company password", titleOrientation: "left", type:"password", required:true}
              		]
              	});
              
              	LS.loginWindow = isc.Window.create({
              	    autoDraw:false,
              	    title: "Please log in",
              	    autoCenter: true,
              	    autoSize: true,
              	    isModal: true,
              	    items: [ 
              			isc.VLayout.create({
              				layoutMargin: 10,
                  			membersMargin: 10,
                  			members: [
                      			LS.loginForm,
                      			isc.IButton.create({
                          			title: "Log in",
                          			click : function () {
                      					LS.login(LS.loginForm.getValue("username"), LS.loginForm.getValue("password"),LS.loginForm.getValue("company"),LS.loginForm.getValue("companyPass"));
                          			}
                      			})
                  			]
              			})
              		]		
              	});
              	
              	LS.showApplication = function (app) {
              	    var i = 0;
              	    for (i=0; i<LS_AppsPane.children.length; i++)
              	    {
              	            LS_AppsPane.children[i].hide();
              	    }
              	    for (i=0; i<LS_AppsPane.children.length; i++)
              	    {
              	        if (("" + app) == ("" + LS_AppsPane.children[i].ID))
              	            LS_AppsPane.children[i].show();
              	    }
              	};
              };
              //--------------------------------------------------------------------------------------------
              Again I have to send in another message…

              Comment


                #8
                Hi Roberto,

                Any time a file is too large you can email it to support@isomorphic.com. Although yes, the JS version is less verbose and may fit when the XML doesn't, and it's better if everyone can see it.

                Comment


                  #9
                  The final part of the code and the problem…
                  Code:
                  /**
                   * Helper functions and objects for the application 
                   * @author Roberto Soto
                   * @Created on 2008-03-17
                   */
                  
                  String.prototype.trim = function(){
                  	return this.replace(/^\s*/, "").replace(/\s*$/, "");
                  };
                  
                  function getStringFromXML(xmlString,xmlElement) {
                  	var result = "";
                  	if (xmlString != null && xmlElement != null) {
                  		var inString  = xmlString.toString(); // be sure it is a string
                  		var lookupString = xmlElement.toString();
                  
                  		var ixStart = inString.indexOf("<"+lookupString+">");
                  		var ixEnd = inString.indexOf("</"+lookupString+">");
                  		if (ixStart < 0 || ixEnd < 0 || ixStart >= ixEnd) {
                  			result = "";
                  		}
                  		else {
                  			ixStart += lookupString.length + 2;
                  			result = inString.substring(ixStart, ixEnd);
                  		}
                  	}
                      return result;
                  };
                  
                  
                  //----------------------------------------------
                  // Main program
                  // Other files not used here omitted for brevity
                  /**
                   * Manage the main application
                   * @author Roberto Soto
                   * @Created on 2008-02-20
                   */
                  /*=========================================================================== */
                  // Create the main layout for the page
                  /*=========================================================================== */
                  
                  // User Interface
                  // ---------------------------------------------------------------------
                  
                  isc.Button.create({
                      ID: "LS_HomeButton",
                      title: "Home",
                      baseStyle: "linkButton",
                      showRollOver: true,
                      showDisabled: true,
                      showDown: true,
                      click: function(){
                          LS.showApplication("LS_HomePagePane");
                         	LS.utilitiesWebService.callOperation("GetLogonProfile", 
                                             { UserID: LS.sessionID},
                                             "//GetLogonProfileResult",
                                             { target : LS, methodName : "profileReply" },
                                             { willHandleError:true, showPrompt:true, prompt:"Getting user profile from Syspro.." });
                      }
                  });
                  
                  isc.Button.create({
                      ID: "LS_ProductsButton",
                      title: "Products",
                      baseStyle: "linkButton",
                      showRollOver: true,
                      showDisabled: true,
                      showDown: true,
                  	visibility: "hidden",
                      click: function(){
                          LS.showApplication("LS_MainProductsPane");
                      }
                  });
                  
                  isc.Toolbar.create({
                      ID:"mainMenu",
                      width:"100%",
                      buttons: [LS_HomeButton,LS_ProductsButton]
                  });
                  
                  /*******/
                  
                  isc.Img.create({
                      ID:"LS_Logo",
                      width: 208,
                      height: 83,
                      src: "../images/mainlogo.gif"
                  });
                  
                  isc.Label.create({
                      ID: "LS_Title_T1",
                      width: "200",
                      contents: "Item Portal<br>version 1.1",
                      align: "left",
                      valign : "center"
                  });
                  
                  isc.Label.create({
                      ID: "LS_UserData",
                      width: "400",
                  	//backgroundColor:"yellow",
                      contents: "",
                      align: "left",
                      valign : "top"
                  });
                  
                  isc.Button.create({
                      ID: "LS_LoginButton",
                      title: "Login",
                   //   icon: "../images/button_logon_off.gif",
                      baseStyle: "linkButton",
                      showRollOver: true,
                      showDisabled: true,
                      showDown: true,
                      click: function(){
                  		if (LS.loggedIn) {
                  			LS.logoff();	
                  		} else {
                  			LS.loginWindow.show();	
                  		}
                      }
                  });
                  
                  isc.Canvas.create({
                      ID:"LS_MenuPane",
                      width:"80%",
                      children:[mainMenu]
                  });
                  
                  // Insert here the pane names for new applications in LS_AppsPane
                  isc.Canvas.create({
                      ID:"LS_AppsPane",
                      height:"*",
                      children:[LS_MainProductsPane]
                  });
                  
                  // Horizontal header bar
                  isc.HLayout.create({
                      ID:"LS_HeaderBar",
                      showEdges: LS.showEdges,
                      height: 85,
                      width:"100%",
                      members:[LS_Logo,LS_Title_T1,LS_MenuPane,LS_UserData,LS_LoginButton]
                  });
                  
                  // Main contents layout
                  isc.VLayout.create({
                      ID:"LS_ContentsLayout",
                      showEdges: LS.showEdges,
                      height:"100%",
                      members: [LS_HeaderBar,LS_AppsPane/*,msg*/]
                  });
                  
                  // Main pane layout
                  isc.HLayout.create({
                      ID:"LS_MainLayout",
                      width:"100%",
                      showEdges: LS.showEdges,
                      members: [LS_ContentsLayout]
                  });
                  
                  /*=========================================================================== */
                  // Start all the application rolling
                  /*=========================================================================== */
                  isc.Page.setEvent("load", "LS.start();");
                  After I call the “Logon” web service using the callOperation:
                  this.utilitiesWebService.callOperation("Logon",
                  . . .
                  { target : this, methodName : "loginReply" },
                  . . . .
                  The loginReply callback receives a data parameter with undefined value. I solved that issue calling a function I wrote to get the string from the response text returned in the other parameter (rpcResponse).
                  LS.sessionID = getStringFromXML(rpcResponse.results,"LogonResult");

                  The documentation says that you will receive the data in the array data[0],data[1], etc. anyway I found a solution for this. This function returns a string containing the session id for the logged in user. I must use this session id for all other web services as a parameter.

                  Once I am logged in, I can use the call to the web service “logoff” using as input parameter the session id I got previously. I get a correct response or an error from the web service and the program behaves ok.

                  Now when I call the web service “GetLogonProfile” which needs as input parameter the same session id as the logoff service, I got errors from the web service. The function is structured the same way as the logoff function, using the same input and returns a string. However the service returns errors and does not accept the session id as a correct input. When I test the web service outside of my application (using ASP.NET tools the web service works fine. What is wrong with my code in the profileReply function?

                  Comment


                    #10
                    One final remark reagrding the .NET integration issues I have.

                    Do not take my comments as complaints, but as oportunities to improve your otherwise excellent product. I really love the way it is structured, the user interface, the architecture of the software and other goodies. I just point out some areas where there is need for more documentation and examples that will make your software a marvel in this .NET arena. That's all.

                    Thanks for your help.

                    Comment


                      #11
                      Hi,
                      i am using .net as well so far i am able to insert new rows and fetch data with a ListGrid and still have to fix delete and update operation.
                      but was thinking since i saw many posts about smartclient usage with .net why no share information over an irc channel (something like: #smartclient) that way we can help each other and it would be faster for all of us to fix problems
                      regards

                      Comment


                        #12
                        Hi eljak,

                        Thank you very much for your insterest. Yes, I am ready to exchange information about .NET and SmartClient use with you. Just tell me how to setup the IRC channel.

                        Roberto
                        Last edited by robertosoto; 24 Mar 2008, 06:50.

                        Comment


                          #13
                          Hi Roberto,
                          i created a channel (#smartclient) on freenode server, and am online most of the time (my local time).
                          all you need to do is with an irc client (mirc, xchat, chatzilla, etc...) connect to the freenode server and join the channel
                          regards.

                          Comment


                            #14
                            Hi eljak

                            Thanks, I wil setup my software and will get to you asap.

                            Roberto

                            Comment


                              #15
                              Hi eljak,

                              I installed ChatZilla and entered to the freenode server but can't find the #smartclient channel to join. Is there anything to refresh the channel or should I create the channel (when I try to join the channel I have the option to create it, unless you alaready created it).

                              Please advise.

                              Thanks

                              Roberto

                              Comment

                              Working...
                              X