DataSets, Web Services, DiffGrams, Arrays, and Interoperability

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    DataSets, Web Services, DiffGrams, Arrays, and Interoperability

    I built the example application outlined in this artical:


    url=/library/en-us/dnservice/html/service02112003 .asp

    There were a number of questions along the same lines
    posted to the page's discussion forum but no one replied
    with a solution.

    The problem I am experiencing is with the 3rd example.

    On the server you code the following web service:

    [WebMethod()]
    [return: XmlElement(type of(Items[]))]
    public XmlDataDocument GetTypedXmlData Document()
    {
    sqlDataAdapter1 .Fill(typedData Set1);
    XmlDataDocument dataDoc
    = new XmlDataDocument (typedDataSet1) ;
    return dataDoc;
    }

    On the client, after adding a reference to the web service
    you code:

    localhost.Servi ce1 proxy = new localhost.Servi ce1();
    localhost.Items[] items = proxy.GetTypedX mlDataDocument( );
    string description;
    description = items[1].Description;

    What the example is attempting to do is to cast the
    returned XmlDataDocment xml data stream into an array of
    xml elements of type Item.

    The web service works when called with 'invoke' from the
    automatically generated test web page. Invoke uses the
    http protocol. When the web service is called using the
    Soap protocol the server returns:

    System.Web.Serv ices.Protocols. SoapException: Server was
    unable to process request. --->
    System.InvalidO perationExcepti on: There was an error
    generating the XML document. --->
    System.InvalidC astException: Specified cast is not valid.
    at
    Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializat
    ionWriter1.Writ e16_Test4Respon se(Object[] p) [...]

    Can someone point out why this error is occuring and what
    the solution is?

    At the end of the day this process creates a wsdl file
    that is properly constructed to describe the casted return
    object. How is the wsdl generated; what program\api call
    is used to generate the wsdl? Is this feature accesible
    to anyone other than microsoft and if so where is the
    documentation?

    Thanks

    Mark

  • Kevin Yu [MSFT]

    #2
    RE: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y

    Hi Mark,

    I'm currently researching on this issue and will update you as soon as I
    get any progress.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."

    --------------------
    | Content-Class: urn:content-classes:message
    | From: "Mark" <mhh@yadayada.c om>
    | Sender: "Mark" <mhh@yadayada.c om>
    | Subject: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y
    | Date: Fri, 14 Nov 2003 14:40:40 -0800
    | Lines: 63
    | Message-ID: <05a201c3ab00$5 4e5c580$a101280 a@phx.gbl>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | charset="iso-8859-1"
    | Content-Transfer-Encoding: 7bit
    | X-Newsreader: Microsoft CDO for Windows 2000
    | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    | Thread-Index: AcOrAFTlW/UOm46TQrmXZukqS D6BcQ==
    | Newsgroups: microsoft.publi c.dotnet.xml
    | Path: cpmsftngxa06.ph x.gbl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.xml:17 224
    | NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
    | X-Tomcat-NG: microsoft.publi c.dotnet.xml
    |
    | I built the example application outlined in this artical:
    |
    | http://msdn.microsoft.com/library/default.asp?
    | url=/library/en-us/dnservice/html/service02112003 .asp
    |
    | There were a number of questions along the same lines
    | posted to the page's discussion forum but no one replied
    | with a solution.
    |
    | The problem I am experiencing is with the 3rd example.
    |
    | On the server you code the following web service:
    |
    | [WebMethod()]
    | [return: XmlElement(type of(Items[]))]
    | public XmlDataDocument GetTypedXmlData Document()
    | {
    | sqlDataAdapter1 .Fill(typedData Set1);
    | XmlDataDocument dataDoc
    | = new XmlDataDocument (typedDataSet1) ;
    | return dataDoc;
    | }
    |
    | On the client, after adding a reference to the web service
    | you code:
    |
    | localhost.Servi ce1 proxy = new localhost.Servi ce1();
    | localhost.Items[] items = proxy.GetTypedX mlDataDocument( );
    | string description;
    | description = items[1].Description;
    |
    | What the example is attempting to do is to cast the
    | returned XmlDataDocment xml data stream into an array of
    | xml elements of type Item.
    |
    | The web service works when called with 'invoke' from the
    | automatically generated test web page. Invoke uses the
    | http protocol. When the web service is called using the
    | Soap protocol the server returns:
    |
    | System.Web.Serv ices.Protocols. SoapException: Server was
    | unable to process request. --->
    | System.InvalidO perationExcepti on: There was an error
    | generating the XML document. --->
    | System.InvalidC astException: Specified cast is not valid.
    | at
    | Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializat
    | ionWriter1.Writ e16_Test4Respon se(Object[] p) [...]
    |
    | Can someone point out why this error is occuring and what
    | the solution is?
    |
    | At the end of the day this process creates a wsdl file
    | that is properly constructed to describe the casted return
    | object. How is the wsdl generated; what program\api call
    | is used to generate the wsdl? Is this feature accesible
    | to anyone other than microsoft and if so where is the
    | documentation?
    |
    | Thanks
    |
    | Mark
    |
    |

    Comment

    • Yan-Hong Huang[MSFT]

      #3
      RE: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y

      Hello Mark,

      I am not sure of the first problem. However, for how to generate wsdl,
      please refer to .NET framework tool:

      Disco.exe
      Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.

      ryToolDiscoexe. asp?frame=true
      The .wsdl, .xsd, .disco, and .discomap files produced by this tool can be
      used as input to the Web Services Description Language Tool (Wsdl.exe) to
      create XML Web service clients.

      Thanks.

      Best regards,
      Yanhong Huang
      Microsoft Online Partner Support

      Get Secure! ¨C www.microsoft.com/security
      This posting is provided "AS IS" with no warranties, and confers no rights.

      Comment

      • Wasifulla Syed [MSFT]

        #4
        RE: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y

        Mark,
        I'll try to reproduce the problem here to find the cause. I'll keep you
        posted on this.

        Thanks,
        Syed ...
        Microsoft Developer Support

        Comment

        • Mark

          #5
          RE: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y

          I haven't heard anything on the status of this problem.
          Are you still looking into it?
          [color=blue]
          >-----Original Message-----
          >Mark,
          >I'll try to reproduce the problem here to find the cause.[/color]
          I'll keep you[color=blue]
          >posted on this.
          >
          >Thanks,
          >Syed ...
          >Microsoft Developer Support
          >
          >.
          >[/color]

          Comment

          • Brett Keown [MSFT]

            #6
            RE: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y

            Hi Mark,

            Yes, we are still investigating this issue. Unfortunately, with the
            holidays here, things have slowed down a bit. I have placed a call to
            check on the status of getting you a response.

            Thanks for your continued patience,

            Brett Keown
            Microsoft Support
            brettke@online. microsoft.com

            This posting is provided "AS IS" with no warranties, and confers no rights.

            Comment

            • Wasifulla Syed [MSFT]

              #7
              RE: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y

              Mark,
              Sorry for the delay. This does seem like a bug and unfortunately there
              aren't any good workarounds I could come up with, but I'm still looking and
              will let you know.

              Comment

              • Wasifulla Syed [MSFT]

                #8
                RE: DataSets, Web Services, DiffGrams, Arrays, and Interoperabilit y

                Mark,
                I've confirmed that the part of the article that casts the return from the
                webmethod to an array of items should result in a invalid cast exception.
                That section of the article needs to be changed.

                To workaround the problem:

                1. Have the webmethod return xmldocument/xmldatadocument (similar to the
                example described earlier in the same article) Or
                2. Create 2 webmethods. One webmethod that returns the class type, and the
                other that returns xml data.

                Thanks,
                syed ..
                Microsoft Developer Support

                Comment

                Working...