Announcement

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

    WSDL-support is incompatible with WCF

    I have a WCF service (.net 3.5sp1).
    As all WCF services it has 'types' section with imports of XSD's:
    Code:
    <wsdl:definitions name="MyService" targetNamespace="urn:MyApp">
    <wsdl:types>
    <xsd:schema targetNamespace="urn:MyApp-Imports">
      <xsd:import schemaLocation="http://myapp/MyService.svc?xsd=xsd0" namespace="urn:MyApp"/>
      <xsd:import schemaLocation="http://myapp/MyService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/Message"/>
    </xsd:schema>
    </wsdl:types>
    Just a side note: I'm impressed of nested schemas support, cool. Even not all server WS stacks support WSDLs with nested schemas.

    Here we have one XSD with types used by the service and one XSD with standard MS types. It's very common.

    Then I launch Developer Console and try to download WSDL. BTW it needs to disable HttpProxy in ISC_DeveloperConsole.js:
    Code:
    isc.RPCManager.addClassProperties({useHttpProxy: false});
    Without that DevConsole tries to post to "http://myapp/Scripts/isomorphic/HttpProxy" which doesn't exists. Why should it exist?

    So, DevConsole downloads the WSDL with all XSDs.
    But after that it says:
    Transport error - HTTP code: 0 for URL: http://myapp/MyService.svc?xsd=xsd1

    The url is correct for sure and XSD is being returned by the service, I checked it by Fiddler (sniffer).

    So there's something wrong with how SM interprets the XSD.
    Here's it:
    Code:
    <xs:schema elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Message" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/Message">
    <xs:simpleType name="StreamBody">
      <xs:restriction base="xs:base64Binary"/>
    </xs:simpleType>
    </xs:schema>

    #2
    You're providing a URL on another machine, so it can't be contacted directly without the proxy. Undo everything you've done (hacking the Dev Console) and just run the tool after starting the server (see readme in smartclientSDK).

    Comment


      #3
      What server? I don't use SmartClient Server. I have asp.net application at localhost. WCF services are in the same application.
      Dev Console has loaded from the same application (javascript:isc.showConsole in address bar)
      In Dev Console I enter wsdl-url to the same application.

      i.e.
      asp.net Application: http://localhost/sm1
      wcf/wsdl: http://localhost/sm1/MyService.svc?wsdl
      Dev Console asks: http://localhost/sm1/Scripts/isomorphic/HttpProxy

      Anyway, despite the HttpProxy issue, what can you say about the root issue with parsing WCF's WSDLs ?

      Comment


        #4
        If it's on the same server, you don't need the SmartClient server, but don't use a URL that includes localhost, use a relative URL. Yes, we know, localhost should be accessible. Use a relative URL, don't include the hostname.

        There's no evidence of an issue parsing WCF WSDL, so far, you haven't set things up such that the file can be retrieved at all.

        Comment


          #5
          the file (actually it's not a file, WCF generates WSDL/XSD dinamicly) can be retrived. I checked this in brower and checked in Fiddler that SmartClient's Dev Console gets xsd successfully.
          Do you want me to provide you a test-case? Should it be WCF-service (you'll have to use .net) or just a buch of wsdl/xsd files?

          Did you test SM with WCF?

          Comment


            #6
            You're showing a transport error contacting the service. Same problem as with loading the WSDL files - needs to be a relative URL.

            If you can't get WCF to generate the location as a relative URL, use WebService.setLocation() to correct it.

            Comment


              #7
              Thanks, it helps.
              Just a side note: If it's no possible to support absolute urls it'd be nice to reflect it in docs.

              WCF generates WSDL with impoports of XSD with absolute urls. So SM can't consume wsdls from WCF by default. Hopefully customize WSDL in WCF is pretty easy.
              I've customized WSDL generation process and now my service returns one WSDL document with embeded XSD.

              Dev Console downloads and parses it successfully. I can browse service contract.

              But (1) I'd like to generate JS proxy code and use it statically instead of generating in runtime (with XMLTools.loadWSDL).
              There's the button "Download" in Dev Console with two options: "as JS" and "as XML". What should happen when I choose some of them? In my case nothing happens. I'm using SmartClient_SC_SNAPSHOT-2010-07-21_LGPL version.
              Is there any ability to generate JS proxy code from offline/local wsd/xsd files? I mean some command line tool.

              (2) I'm a bit confused about WebService.setLocation, could you give me a hint.
              Let's assume I have such code:
              Code:
              function loadWSDLCallback(service) {
              	someForm.setDataSource(
              		service.getFetchDS("GetObjects", "XGetObjectsResponse"));
              }
              isc.XMLTools.loadWSDL("/myapp/MyService.svc?WSDL", "loadWSDLCallback(service)");
              Where and when should I call WebService.setLocation() ?
              I've tried in loadWSDLCallback:
              Code:
              function loadWSDLCallback(service) { service.setLocation("/myapp/MyService.svc"); .. }
              but it doesn't help. SM's trying to invoke the service on the url from wsdl (service/port/address/@location I guess)

              So two questions:
              - how to generate JS proxy code, especially in offline, just from a bunch of wsdl/xsd files ?
              - how to use WebService.setLocation (I've checked all examples there'e no an appropriate example) ?

              Comment


                #8
                1) Run it from the SDK with the SmartClient server running. This is in the docs for loadWsdl.

                2) that should work, but a second way is to set the dataUrl on your DataSource.

                Comment


                  #9
                  I've managed to generate JS proxy code with running SM server, thanks.

                  But my service has two ports with two different urls:
                  Code:
                  <wsdl:service name="XDomainService">
                    <wsdl:port name="BasicHttpBinding_IXGetObjectService"
                             binding="tns:BasicHttpBinding_IXGetObjectService">
                      <soap:address location="http://mysrv/MyService.svc/GetObject"/>
                    </wsdl:port>
                  
                    <wsdl:port name="BasicHttpBinding_IXSaveObjectService"
                             binding="tns:BasicHttpBinding_IXSaveObjectService">
                      <soap:address location="http://mysrv/MyService.svc/SaveObject"/>
                    </wsdl:port>
                  </wsdl:service>
                  This WSDL has become such JS code:
                  Code:
                  isc.WebService.create({
                      dataURL:"/MyService.svc/GetObject",
                      name:"MyService",
                      serviceNamespace:"http://schemas/Objects",
                      soapStyle:"",
                      portTypes:[
                          {
                              portTypeName:"IXGetObjectService",
                              operation:[ ... ]
                          },
                          {
                              portTypeName:"IXSaveObjectService",
                              operation:[ ... ]
                          },
                      messages: [...]
                  })
                  So, two ports have become one dataURL.
                  How can I call operations on the second port (MyService.svc/SaveObject) ?
                  I can't change url before each call as I supply this WebService instance to a DataSource:
                  Code:
                  var ws = isc.WebService.get("http://schemas.croc.ru/XFW3/2009/10/Domain/Objects");
                  var ds = isc.DataSource.create({
                  	serviceNamespace : ws.serviceNamespace,
                  	wsOperation : "GetObjects",
                  	recordName : "GetObjectsResult", 
                  });
                  Through "GetObject" endpoint the service provides fetch facilities and through "SaveObject" endpoint the service provides update/create/delete facilities.

                  I think it'd be reasonable to generate two different WebServices for each port in WSDL if they have different Urls.

                  Comment


                    #10
                    SmartClient 8.0 supports many more variations on WSDL declarations, so you might try that (download a nightly at smartclient.com/builds/eval). If not, try using a single port - splitting ports isn't particularly useful anyway.

                    If for whatever reason this feature is critical to you, consider Feature Sponsorship.

                    Comment


                      #11
                      I'm using the build: http://www.smartclient.com/builds/lgpl/2010-07-23/
                      Isn't this 8.0 version?

                      portType is kind of interface. Here WSDL is a bit obscure, but WSDL 2.0 is much cleaner.
                      Anyway the WSDL I showed actually has two service interfaces which implemented in one deployment unit. From client's point of view it should be two different services. WCF client facilities will consume it as two endpoints. It's absolutly correct using of WSDL. And it can be understood not only by .net WCF but also Java stacks (Metro for example).

                      Joining ports isn't an option.

                      It'd be nice to see in docs which WSDL feature are supported and which are not. And not only WSDL itself but also SOAP and different WS-* standarts.
                      There is no info now about support and versions for WSDL/SOAP/ws-addressing and other "WS-*" (http://en.wikipedia.org/wiki/List_of_Web_service_specifications)

                      Comment


                        #12
                        how to integrate smartclient in asp.net 3.5 and wcf If you are having any examples (including aspx and code behind pages along with service calling) simple project please give us check the compatibility(If you are giving like a small build project it would be better for us)

                        Comment


                          #13
                          Hi Isomorphic,
                          How to integrate smartclient in asp.net 3.5 and wcf If you are having any examples (including aspx and code behind pages along with service calling) simple project please give us check the compatibility(If you are giving like a small build project it would be better for us)

                          Comment

                          Working...
                          X