Announcement

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

    Problem loading DataSource from Webservice

    Hello I'm trying to load datasource from a webservice but without using server components. The error I get when try to fetch the data is
    Code:
     
    <?xml version="1.0" ?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns
    :xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="uiwebserviceapp">
    <soapenv:Body>
    <soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>soapenv:Client</faultcode>
    <faultstring>Cannot find the dispatch method</faultstring>
    </soapenv:Fault>
    </soapenv:Body>
    </soapenv:Envelope>
    I've generated .JS file with the developer console and
    here's how I'm loading the service:
    Code:
    <HTML><HEAD>
    	<SCRIPT>var isomorphicDir="isomorphic/";</SCRIPT>
        <SCRIPT SRC=isomorphic/system/modules/ISC_Core.js></SCRIPT>
        <SCRIPT SRC=isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
        <SCRIPT SRC=isomorphic/system/modules/ISC_Containers.js></SCRIPT>
        <SCRIPT SRC=isomorphic/system/modules/ISC_Grids.js></SCRIPT>
        <SCRIPT SRC=isomorphic/system/modules/ISC_Forms.js></SCRIPT>
        <SCRIPT SRC=isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
    	<SCRIPT SRC=isomorphic/skins/SmartClient/load_skin.js></SCRIPT>
    	<SCRIPT SRC=uiwebserviceapp.js></SCRIPT>	
    </HEAD><BODY BGCOLOR='#e0e0e0' MARGINHEIGHT=0 MARGINWIDTH=0 LEFTMARGIN=0 TOPMARGIN=0>
    <SCRIPT>
    isc.VLayout.create({
            height: "90%",
            width: "100%",
            top: 40,
            membersMargin: 20,
            layoutMargin: 40,
            members:[
                isc.SearchForm.create({
                    ID: "searchForm",
                    numCols: 4,
                    width: 500,
    				useFlatFields:true				
                }),
    			 isc.Button.create({
                    click: "searchResults.fetchData(searchForm.getValuesAsCriteria())", 
                    title: "Search"
                })
    			, isc.ListGrid.create({
                    ID:"searchResults",
    				showAllRecords:true,
    				useFlatFields:true
                })
    			]
        });
    	
    
    wsdlLoaded();
    
    
    function wsdlLoaded() {	
        window.service = isc.WebService.get("uiwebserviceapp");	
        if (service == null) isc.warn("WSDL not currently available (tried "+wsdlURL+")");	
    	
    	var searchDS = service.getInputDS("getTestDummyData");		
    	searchForm.setDataSource(searchDS);
    	
    	var results = isc.DataSource.create({
            serviceNamespace : service.serviceNamespace,		
            wsOperation : "getTestDummyData",
            recordName : "getTestDummyDataResponse",
    		fields : [
                    { name:"return" }             
                ]		
            });		
    	searchResults.setDataSource(results);
        
    }
    	
    </SCRIPT>
    </BODY>
    </HTML>
    And this is the .js file for the service.

    Code:
    isc.SchemaSet.create({
        schemaNamespace:"uiwebserviceapp",
        qualifyAll:false,
        schema:[
           isc.XSElement.create({
                inheritsFrom:"getTestDummyData",
                fields:{},
                ID:"getTestDummyData"
            })
    ,
            isc.XSComplexType.create({
                fields:{
                    arg0:{name:"arg0", type:"int", xmlRequired:true}
                },
                ID:"getTestDummyData"
            })
    ,
            isc.XSElement.create({
                inheritsFrom:"getTestDummyDataResponse",
                fields:{},
                ID:"getTestDummyDataResponse"
            })
    ,
            isc.XSComplexType.create({
                fields:{
                    "return":{name:"return", type:"anyType", xmlRequired:false}
                },
                ID:"getTestDummyDataResponse"
            })
    ]
    
           
    })
    
    isc.WebService.create({
        dataURL:"http://10.0.0.5:80/uiwebserviceapp/uiwebserviceapp",
        serviceNamespace:"uiwebserviceapp",
        soapStyle:"document",
        operations:[        
            {inputEncoding:"literal", outputEncoding:"literal", inputMessage:"getTestDummyData", 
             outputMessage:"getTestDummyDataResponse",name:"getTestDummyData", soapAction:""}
        ],
        messages:[
            
            isc.WSDLMessage.create({
                fields:{
                    getTestDummyData:{mustQualify:true, name:"getTestDummyData", type:"getTestDummyData", xmlRequired:true}
                },
                ID:"message:getTestDummyData"
            })
    ,
            isc.WSDLMessage.create({
                fields:{
                    getTestDummyDataResponse:{mustQualify:true, name:"getTestDummyDataResponse", type:"getTestDummyDataResponse", 
                     xmlRequired:true}
                },
                ID:"message:getTestDummyDataResponse"
            })
    
        ]
    })
    I noticed that the generated soap messages have no correct namespaces but I don't know how to solve the problem.

    This is the schema of the service
    Code:
    <?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="uiwebserviceapp" version="1.0">
    
      <xs:element xmlns:ns26="uiwebserviceapp" type="ns26:getTestDummyData" name="getTestDummyData"></xs:element>
    
      <xs:complexType name="getTestDummyData">
        <xs:sequence>
          <xs:element type="xs:int" name="arg0"></xs:element>
        </xs:sequence>
      </xs:complexType>
    
      <xs:element xmlns:ns27="uiwebserviceapp" type="ns27:getTestDummyDataResponse" name="getTestDummyDataResponse"></xs:element>
    
      <xs:complexType name="getTestDummyDataResponse">
        <xs:sequence>
          <xs:element type="xs:anyType" minOccurs="0" name="return" maxOccurs="unbounded"></xs:element>
        </xs:sequence>
      </xs:complexType>  
    </xs:schema>
    and the wsdl....
    Code:
    <?xml version="1.0" encoding="UTF-8"?><definitions xmlns:tns="uiwebserviceapp" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="uiwebserviceapp" name="UIService">
      <types>
        <xsd:schema>
          <xsd:import namespace="uiwebserviceapp" schemaLocation="http://10.0.0.5:80/uiwebserviceapp/uiwebserviceapp?xsd=1"></xsd:import>
        </xsd:schema>
      </types>
      <message name="getTestDummyData">
        <part element="tns:getTestDummyData" name="parameters"></part>
      </message>
      <message name="getTestDummyDataResponse">
        <part element="tns:getTestDummyDataResponse" name="parameters"></part>
      </message>
      <portType name="UIServiceWS">    
        <operation name="getTestDummyData">
          <input message="tns:getTestDummyData"></input>
          <output message="tns:getTestDummyDataResponse"></output>
        </operation>
      </portType>
      <binding type="tns:UIServiceWS" name="UIServiceWSPortBinding">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>   
        <operation name="getTestDummyData">
          <soap:operation soapAction=""></soap:operation>
          <input>
            <soap:body use="literal"></soap:body>
          </input>
          <output>
            <soap:body use="literal"></soap:body>
          </output>
        </operation>
      </binding>
      <service name="UIService">
        <port binding="tns:UIServiceWSPortBinding" name="UIServiceWSPort">
          <soap:address location="http://10.0.0.5:80/uiwebserviceapp/uiwebserviceapp"></soap:address>
        </port>
      </service>
    </definitions>

    #2
    Hi Boris,

    The problem is most likely that you have a xsd:complexType and xsd:element declared with the same name. This is technically legal in XML Schema and this usage is actually supported in the next version of SmartClient, however it can create a lot of confusion and we do recommend against it regardless.

    If you are working with WSDL generated by some tool and you are unable to avoid this naming collision, contact us at support@isomorphic.com about getting access to a pre-release.

    Comment


      #3
      Hello,
      I've tried to change the wsdl but I'm still getting the same error.
      I've noticed that the message sent to the server is:
      Code:
      <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                                     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Header></soap:Header>
      <soap:Body>
      <getTestDummyData>
          <arg0>1</arg0>
      </getTestDummyData>
      </soap:Body>
      </soap:Envelope>
      The namespace "uiwebserviceapp" is missing.
      Somehow the Isomorphic API is not including the namespace in the SOAP message.

      Comment


        #4
        Hello, I've managed to workaround the issue a month ago and descided to post the solution.I made some changes in the schema as you advise and combined the schema and the wsdl file in one xml file.

        Here's the changed schema:

        Code:
        <?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="uiwebserviceapp" version="1.0">
        
          <xs:element xmlns:ns26="uiwebserviceapp" type="ns26:tGetTestDummyData" name="getTestDummyData"></xs:element>
        
          <xs:complexType name="tGetTestDummyData">
            <xs:sequence>
              <xs:element type="xs:int" name="arg0"></xs:element>
            </xs:sequence>
          </xs:complexType>
        
          <xs:element xmlns:ns27="uiwebserviceapp" type="ns27:tGetTestDummyDataResponse" name="getTestDummyDataResponse"></xs:element>
        
          <xs:complexType name="tGetTestDummyDataResponse">
            <xs:sequence>
              <xs:element type="xs:anyType" minOccurs="0" name="return" maxOccurs="unbounded"></xs:element>
            </xs:sequence>
          </xs:complexType>  
        </xs:schema>
        Now when I generate the JS stub with the tool from the Developer console everything works fine.
        But it seems that the problem is not in the tool that generates the JS stub because the generated stub was not a problem but the diplicate names of the <complexType> and <element>. When the names are the same there are two JS objects (isc.XSElement and isc.XSComplexType) with the same ID which I suppose confuses JavaScript.

        So how do you plan to resolve that in the future versions. I've tried to generate this files with the latest evaluation version, downloaded from your web site - http://www.smartclient.com/download/smartclient/isc.zip?licenseType=eval&version=6.0&format=zip
        and it's still not working.
        I've tried to use the WSDL too generate requests to the web service and it returns the same error - "Cannot find the dispatch method"

        Comment


          #5
          Thanks for posting that Boris.

          Could you clarify what version of SmartClient it is where this new WSDL is working, and what version it is not working in? We're not aware of a change in behavior in any recent GA versions of SmartClient.

          As far as the colliding element vs type name issue from your previous version of the WSDL, it can be fixed internally with no change of external APIs.

          Comment


            #6
            Hi,
            The problem is present in all versions I've tried. So to summarize the problem:
            - The generated with the Developer Console JS stub is not working properly when there are "element" and "complexType" elements with the same "name" attribute.
            - The Developer Console is not including the schema in the JS stub if the schema is included in the WSDL by using the following:
            Code:
            <xsd:schema>
            <xsd:import namespace="uiwebserviceapp" schemaLocation="http://10.0.0.5:80/uiwebserviceapp/uiwebserviceapp?xsd=1"/>
            </xsd:schema>
            it works only if the schema is in the same file.

            Comment


              #7
              Hi Boris,

              1) is the known limitation previously discussed

              2) If you derive a JS file from the Developer Console from a WSDL with an external XML Schema reference, then you also have to derive a JS stub for the XML Schema, and load both. Otherwise SmartClient will not have the schema. For context, it is not a requirement that an xsd:import statement provide a working, publicly accessible URL for the schema, so there is no general way for SmartClient to follow schema links.

              Comment


                #8
                Hi,
                So about issue No 1:
                Can we expect that this will be fixed in the furute releases of Isomorphic ?

                Comment


                  #9
                  Yes, as of 6.1

                  Comment


                    #10
                    Hi Boris
                    Just a quick update to let you know that SmartClient version 6.5 is now available, and resolves this limitation.

                    Regards
                    Isomorphic Software

                    Comment


                      #11
                      Hi Isomorphic,

                      I have been using the isc.XMLTools.loadWSDL tool to load wsdl services, I am using smartclient version 'SmartClient_SC_SNAPSHOT-2010-11-08' to do so. Well I am having the same problem as Boris describes in the thread, the
                      Code:
                      <xsd:schema>
                      <xsd:import namespace="http://locahost/NodeService/" schemaLocation="http://locahost/NodeService/NodeServiceSOAPImpl?xsd=1" />
                      </xsd:schema>
                      is not working. If i add the schema to the wsdl file than it works. Is this a known issue, will it be solved.

                      Jeronimo

                      Comment


                        #12
                        Use only relative URLs. Do not use URLs that start with http://, even if they use "localhost".

                        Comment


                          #13
                          Hi,

                          I am sorry but I do not really understand. Well when I use the smarclient console to call the webservice, there is works fine and I can download the js file. If I use the loadXMLschema like

                          Code:
                          isc.XMLTools.loadXMLSchema("http://localhost:9090/Node/NodeSOAPImpl?xsd=1", function(){       isc.XMLTools.loadWSDL("http://localhost:9090/Node/NodeSOAPImpl?wsdl",
                                     "if (window.zipForm) zipForm.zipCodeService = service")
                                         }
                                     );
                          I can use my webservice without any problem. If I use the directly
                          isc.XMLTools.loadWSDL as described in an example in the feature explorer I have the problem that the schema is not read or used. To be honest I don't really understand, I have been using webservices for a while and all the tools used to generate code from wsdl files worked fine.

                          Jeronimo

                          Comment


                            #14
                            Oh, the problem is that you are not passing the parameter to loadWSDL which causes imported schema to be loaded - see the docs.

                            Comment


                              #15
                              Hi,

                              Thanks for the reply I have been reading the doc and figured out where was my problem.

                              For those who would have the same problem, here is what I did and it works for me

                              Code:
                               isc.XMLTools.loadWSDL("http://localhost:9090/Node/NodeSOAPImpl?wsdl", function(service) {service.callOperation("audit",{portId:record.id},"//message", "isc.say(data[0])")},null, true)
                              Thanks,

                              Jeronimo

                              Comment

                              Working...
                              X