Announcement

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

    WSDLDataBinding problem

    Hi,

    Following your WSDLDataBinding example in the ShowCase I'm trying to consume the web services in our wsdl.
    the wsdl is loaded correctly with XMLTools.loadWSDL, but when I click on the button, trying to bind the datasource to the grid, I get a javascript null error.

    In the code you'll see this line commented out:
    // searchForm.fetchData();
    When this line is active, I can see the data correctly fetched from the soap service! (see "searchForm fetch from Dev Console.txt")
    Then the problem is the binding with the grid through resultDS. Here is a code excerpt (see attachments).

    Code:
                                    final String wsdlURL = "http://usdev-o03.dotomi.com:8080/axis2/services/CompanyAdministrationService?wsdl";
                                    final String namespaceURL = "http://Objects.webservice.dotomi.com/xsd";
                                    final String wsOperation = "listAllCompanies";
    
                                    SC.showPrompt("Loading WSDL from: " + wsdlURL);
                                    XMLTools.loadWSDL(wsdlURL, new WSDLLoadCallback() {
                                                    public void execute(WebService service) {
                                                                    if(service == null) {
                                                                                    SC.warn("WSDL not currently available from DOTOMI (tried "+ wsdlURL+ ")", new BooleanCallback() {
                                                                                                    public void execute(Boolean value) {
                                                                                                    }
                                                                                    });
                                                                                    return;
                                                                    }
    
                                                                    DataSource inputDS = service.getInputDS(wsOperation);
    
                                                                    XmlNamespaces ns = new XmlNamespaces();
                                                                    ns.addNamespace("ax21", namespaceURL);
    
                                                                    DataSource resultDS = new DataSource();
                                                                    resultDS.setServiceNamespace(namespaceURL);
                                                                    resultDS.setXmlNamespaces(ns);
                                                                    resultDS.setRecordName("companyList");
                                                                    OperationBinding opb = new OperationBinding(DSOperationType.FETCH, wsdlURL);
                                                                    opb.setXmlNamespaces(ns);
                                                                    opb.setWsOperation(wsOperation);
                                                                    opb.setRecordName("companyList");
                                                                    resultDS.setOperationBindings(opb);
    
                                                                    resultDS.setFields(
                                                                                                    new DataSourceField("companyID", FieldType.INTEGER),
                                                                                                    new DataSourceField("companyMagic", FieldType.TEXT),
                                                                                                    new DataSourceField("companyName", FieldType.TEXT),
                                                                                                    new DataSourceField("companyStatus", FieldType.INTEGER),
                                                                                                    new DataSourceField("companyURL", FieldType.TEXT),
                                                                                                    new DataSourceField("externalID", FieldType.TEXT),
                                                                                                    new DataSourceField("tier", FieldType.INTEGER)
                                                                    );
    
                                                                    VLayout layout = new VLayout(20);
                                                                    layout.setWidth100();
                                                                    layout.setHeight100();
                                                                    layout.setLayoutMargin(40);
    
                                                                    final DynamicForm searchForm = new DynamicForm();
                                                                    searchForm.setNumCols(7);
                                                                    searchForm.setWidth(500);
                                                                    searchForm.setDataSource(inputDS);
                                                                    
                                                                    // this shows that the data is fetched ok
                                                                    // searchForm.fetchData();
    
                                                                    final ListGrid searchResults = new ListGrid();
                                                                    searchResults.setWidth100();
                                                                    searchResults.setDataSource(resultDS);
    
                                                                    IButton searchButton = new IButton("Search");
                                                                    searchButton.addClickHandler(new ClickHandler() {
                                                                                    public void onClick(ClickEvent event) {
                                                                                                    searchResults.fetchData(searchForm.getValuesAsCriteria());
                                                                                    }
                                                                    });
    Thanks in advance.



    =====

    We are using smartgwt 3.0 power version
    Attached Files
    Last edited by ewilliams; 15 May 2012, 17:06. Reason: adding attachements

    #2
    Adding additional attachments to this issue.
    Please notice that all the requested information to get support help are provided.
    Looking forward for anybody to help.

    Thanks
    Vittorio
    Attached Files

    Comment


      #3
      Before we dig into what may be wrong with either your WSDL or code - you are aware that using a generated WSDL service is the very last choice amongst all the databinding approaches we offer? More detail in this FAQ - same reason applies to generated WSDL interfaces, only moreso (greater complexity).

      Comment


        #4
        We already have a web-service infrastructure and methods implemented for which we would like to use the documented SmartGWT capabilities to build a client side GUI.

        Comment


          #5
          Right; given that starting point the FAQ lists out all the reasons why it's almost always a better idea to use RestDataSource or the SmartClient Server.

          It's a good idea to really carefully consider each point - otherwise you could end up spending a lot of extra, unnecessary effort on WSDL binding, have to rebuild several features which are built into the framework, end up with a result that is clearly worse in many ways, and possibly scrap and rebuild the whole thing later on once all these deficiencies become clearer.

          Also - if the point of the WSDL services was shared services (SOA) see the QuickStart section that mentioned RestHandler. Service sharing is built in and automatic when using server-based data binding.

          Comment


            #6
            While there may be benefits to using other databinding techniques, we'd like to be able to use our existing web services and build a client in smartgwt.

            Comment


              #7
              Just want to clarify one last time, because while there may be concerns you have not shared, from what you've shared so far its very very obvious that using WSDL-based databinding is bad idea: you will not be "reusing" your web services in any meaningful way. What you will actually be doing is writing a lot of extra, unnecessary code that would not be needed if you just connected to the Java objects that provide these web services using the server-based databinding approaches provided by the licenses you already have.

              So rather than "reuse" you will just be writing a bunch of extra code and maintaining it.

              Also, not only will you write more code now, you will also have to reinvent every feature provided by the server system, including queuing (needed for transactional saves), support for various types of exports (Excel, PDF, etc), auto-generation of DataSources from beans, serverCustom validators - that's just the tip of the iceberg.

              And again the result will be worse in terms of performance as well.

              Anyway.. the first problem with your code is that you have specified "recordName" as companyList but that doesn't actually exist as a type in your WSDL. The <companyList> elements are given "anyType". This means you'll need to specify a recordXPath to select them, or correct the WSDL generation to provide an actual type definition here - this latter approach would eliminate the need to hand-specify fields on the ResultDS, because they could come from the companyList type instead.

              Also, note that you can enable the "xmlSelect" log category to troubleshoot any problems of this kind.

              Comment

              Working...
              X