Announcement

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

    WSDL Binding Instructions

    I've been attempting to following the instructions in the SmartClient Reference WSDL Binding using the SmartClientOperations.WSDL to create the proper SOAP Envelope in .net.

    In the section Creating New WSDL Services, it says to use the wsdl.exe to create the c# stubs the you will add business logic to. I generated the class and wsdl.exe returns the following:

    Code:
    Microsoft (R) Web Services Description Language Utility
    [Microsoft (R) .NET Framework, Version 2.0.50727.1432]
    Copyright (C) Microsoft Corporation. All rights reserved.
    Schema validation error: Schema item 'complexType' named 'DSRequest' from namesp
    ace 'urn:operations.smartclient.com' is invalid. Wildcard '##any' allows element
     'startRow', and causes the content model to become ambiguous. A content model m
    ust be formed such that during validation of an element information item sequenc
    e, the particle contained directly, indirectly or implicitly therein with which
    to attempt to validate each item in the sequence in turn can be uniquely determi
    ned without examining the content or attributes of that item, and without any in
    formation about the items in the remainder of the sequence.
    Schema validation error: Schema item 'complexType' named 'DSResponse' from names
    pace 'urn:operations.smartclient.com' is invalid. Wildcard '##any' allows elemen
    t 'totalRows', and causes the content model to become ambiguous. A content model
     must be formed such that during validation of an element information item seque
    nce, the particle contained directly, indirectly or implicitly therein with whic
    h to attempt to validate each item in the sequence in turn can be uniquely deter
    mined without examining the content or attributes of that item, and without any
    information about the items in the remainder of the sequence.
    Warning: Schema could not be validated. Class generation may fail or may produce
     incorrect results.
    Writing file 'c:\sc2.cs'.
    I just want to make sure that this is an expected output and does not indicate an error.

    Next, how do I use the resultant class? The class I end up with is a partial class which inherits from SoapHttpClientProtocol. There are methods for fetch, add, remove and update but I don't quite understand how to implement them. There is no further documentation on this, so I was wondering if anyone out there has a sample of how they put this together?

    Thanks

    Paul

    #2
    ooops

    Well, no wonder I didn't know what to do with the file, I forgot the /server flag in the wsdl.exe command.

    If you could still answer the other simpler question though, DSRequest and DSResponse both produce errors. I wanted to make sure this will not create issues.

    Comment


      #3
      Wow, that error message reads like a legal contract.

      I think that's a mistake on the part of wsdl.exe - possibly only as of a recent version - because other WSDL validators have not had a problem with SmartClientOperations.wsdl, and we ship an example of this WSDL service actually working with Apache Axis.

      However I'd take a step back and ask why you want to work with WSDL :) Obtuse error messages like these are typical of WSDL and related technologies, and while we make it as simple as we can, REST-based integration via the RestDataSource is usually the easier approach so long as you are not dealing with a company-wide mandate to use WSDL.

      Comment


        #4
        Here is how I was looking at it. SmartClient uses a standard format for requests and responses from an array of data sources. This includes a standard format of startRow, endRow, totalRows, etc. The sorting and filtering have their own formats. I want to databind almost all of my objects to my server.

        I also already have Web Services with about 800 methods written to fetch(paged), add, update, delete all of our domain objects. I thought (and maybe you could give me a better idea) that I could just use the WSDL (which gives me the standard request/response that smartclient is expecting) and wrap all of my methods in generic handlers. The only other way (and this is what I have done in the past) is to reverse engineer the data structure in DSRequest and DSResponse. I used fiddler and examined the different requests/responses from the sample apps to figure out what I could expect and then wrote custom generic handlers to handle the different objects. This is enormously cumbersome.

        The one huge problem I have encountered with Smartclient is documentation/samples. The library is the most robust/thorough/usable of any I have seen. But the documentation tends to assume you already know the library and it's java centric (not that I have a problem with that). If there were a sample .net project built on say the Northwind database, all of the databinding features could be thoroughly demonstrated. This is my fourth round of "taking a crack" at integrating Smartclient with .net, so if you have any ideas, directions, samples, documentation which will help, I would be greatly appreciative.


        Thanks in advance

        Paul Perrick

        Comment


          #5
          Also, the same thing applies to the RESTdatasource. I go to look up the documentation and it's about 4-5 pages of the most simple request pattern for the library.

          Code:
          FROM: class RestDataSource	extends DataSource in references
          
           Examples
          
          XML formatted responses:
          
          RestDataSource expects a response to like the following in response to a "fetch" request:
          
           <response>
              <status>0</status>
              <data>
                <record>
                    <field1>value</field1>
                    <field2>value</field2>
                </record>
                <record>
                    <field1>value</field1>
                    <field2>value</field2>
                </record>
              </data>
           </response>
          If I wanted to implement paging using a REST datasource, where are the examples? I would have to go through the whole thing again of figuring out the standard requests of Smartclient and parsing them on the server. Or for each datasource in Smart client, write extremely cumbersome transformrequest and transformresponse functions.

          You see my quandary?

          Paul Perrick

          Comment


            #6
            Hi Paul,

            You're missing a few things which are actually documented and for which examples do actually exist...

            First, the RestDataSource tells you exactly what inbound data to expect:

            Example URL constructed with the metaDataPrefix set to "_" (the default):

            [dataURL]?field1=value1&_operationType=fetch&_startRow=0&_endRow=50&_sortBy=-field2&_dataSource=dsName
            Fully documented, no reverse engineering required - I'm not sure what you were reverse engineering before :) .. but it's possible you were trying to work with the requests that are sent when dataFormat is "iscServer" - this is an internal, undocumented format intended for the SmartClient Java Server to parse - it may change at any time and you should not write any code that depends on this format.

            Instead, the general facilities on DataSource give you the ability to take the DSRequest object and turn it into any kind of HTTP request you like, and the RestDataSource gives you a pre-built protocol.

            About building a general databinding layer for all of your domain objects - notice that the RestDataSource sends the DataSource as _dataSource. This means that a single server-side dispatcher could route requests to different domain objects based on the _dataSource parameter. This is basically how the SmartClient Java Server does request dispatching.

            Furthermore, realize that isc.DataSource and isc.RestDataSource are classes that you can extend. So, let's say you want to extend the RestDataSource protocol to add some more parameters. You could create PaulDataSource, override transformRequest() and call Super(), and return modified data. Then you could use PaulDataSource for all of your domain objects to create a consistent protocol - you don't need dozens of different transformResponse overrides.

            Finally, to enable paging for a RestDataSource, include <startRow>, <endRow> and <totalRows> elements in your responses:

            The data element contains a list of record nodes, each of which represents a record returned by the server. Additional elements for totalRows returned, startRow and endRow may also be included.
            .. an example is shown here - see country_fetch.xml

            Finally, about WSDL. If you have a set of pre-existing WSDL web services for all of your domain objects and those services are highly uniform, you may be able to write a single DataSource subclass that can talk to the whole suite of services. We do precisely this for SalesForce, and there is an extended example in smartclientSDK/examples/databinding/SalesForce.

            Note also that if you have or can generate XML Schema for your domain objects, you can turn that schema into DataSources, which could give you a DataSource for every existing domain object is one shot. See the Schema Import example.

            Comment


              #7
              Hy Paul,

              For paging:
              Code:
              <response>
              <status>0</status>
              <startRow>start_row</startRow>
              <endRow>end_row</endRow>
              <totalRows>total_rows</totalRows>
                  <data>
                    <record>
                        <field1>value</field1>
                        <field2>value</field2>
                    </record>
                    <record>
                        <field1>value</field1>
                        <field2>value</field2>
                    </record>
                  </data>
              </response>
              On RestDataSource docs http://www.smartclient.com/docs/6.5....RestDataSource you'll find an link to examples:
              http://www.smartclient.com/docs/6.5....l#restEditSave


              Later Edit: lol, this [posting at the same time] is getting awkward :))
              Last edited by JohnBlack; 12 Aug 2008, 15:11.

              Comment


                #8
                Hi Paul,

                Just wanted to check in and see if you've found your way to a solution (REST or WSDL).

                Comment

                Working...
                X