Re: How to Return an XML Doc via a Web Method

From: charlie (spamnongrata_at_yahoo.com)
Date: 04/29/04

  • Next message: Jared Jensen: "Sending objects from .NET client to SOAP::Lite web service"
    Date: 29 Apr 2004 12:52:22 -0700
    
    

    Tom,

    There can be issues getting your .NET WSDL recognized in something
    other than a .Net language for certain datatypes. If all you want to
    do is transfer an XML document you could perform this quite simply by
    sending the file as an array of bytes - example (quickly cobbled
    together from an existing app so it may not be 100% syntactically
    correct):

    public class Document
    {
        public byte[] GetXMLDocumentBase64(string fileName)
        {
            public byte[] base64 = new byte[]{ 0x1, 0x2, 0x3, 0x4, 0x5 };
            try
            {
                FileStream fs = new FileStream(fileName,FileMode.Open);
                BinaryReader reader = new BinaryReader(fs);
                reader.BaseStream.Seek(0, SeekOrigin.Begin);
                long lLength = reader.BaseStream.Length;
                int nLength = System.Convert.ToInt32(lLength);
                base64 = reader.ReadBytes(nLength);

                fs.Close();
                reader.Close();
            }
            catch (Exception)
            {
                base64 = new byte[]{ 0x1, 0x2, 0x3, 0x4, 0x5 };
            }

        return base64;
      }
    }

    This particular service also uses DIME attachments to return documents
    but if you are interfacing with Java that is not an option (that I
    know of). Finally, if your XML is quite large this may not be very
    efficient. I have tested this on document transfers up to 2 mb.

    Good luck.
    Charlie
    "Tom Ficker" <tomficke@ages.com> wrote in message news:<eWeUEtGLEHA.1340@TK2MSFTNGP12.phx.gbl>...
    > Hello,
    > I am trying to return an xml document from a asp .net web service. I am
    > using the XMLDocument object and it works fine within .NET, but I cannot
    > read the
    > WSDL file from a java client.
    > Basically it tells me that "the XML Node type is not included". From
    > what I have read the last few days, it looks like I have to create a complex
    > data type in the WSDL file.
    >
    > If you have any advise on returning XML from a [webmethod], please let
    > me know. I figured it would be simple to transfer XML between .NET and Java
    > (Eclipse), but it is proving to be more difficult...
    >
    > Thank you
    > Tom Ficker


  • Next message: Jared Jensen: "Sending objects from .NET client to SOAP::Lite web service"

    Relevant Pages

    • Re: WSDL Generated Proxy Classes?
      ... WSDL file is that each client can download the WSDL file and generate ... But what proxy classes do, the same can be done using business objects. ... Both Web Services & business objects require compiled objects that are ...
      (microsoft.public.dotnet.framework.aspnet)
    • How do you transparently implement the same web service (WSDL) with java axis and .NET ?
      ... When I have tried to generate java and C# servers/clients from the same ... WSDL as described further below, these are the results I have been able ... When I try to invoke a C# web service with a java axis client I get the ... ..NET that are supporting the same WSDL and to be able to reuse client ...
      (microsoft.public.dotnet.framework.aspnet.webservices)
    • Re: How do you transparently implement the same web service (WSDL) with java axis and .NET ?
      ... > When I have tried to generate java and C# servers/clients from the same ... > WSDL as described further below, these are the results I have been able ... > When I try to invoke a C# web service with a java axis client I get the ... > .NET that are supporting the same WSDL and to be able to reuse client ...
      (microsoft.public.dotnet.framework.aspnet.webservices)
    • Separate WSDL File
      ... I've created my own WSDL file and referenced an XSD file too. ... I've then set the Binding for the class and methods and set the ... up, add the reference, and all is ok. ...
      (microsoft.public.dotnet.xml)
    • Re: WSDL Generated Proxy Classes?
      ... Namespace lines) is encapsulated in an ASMX file after which WSDL is ... WSDL is Web Service Description Language. ... The advantage of generating a WSDL file is that each client can download the WSDL file and generate proxy "on the fly". ... However, there are also other consumers of web services, and they also create proxies in JavaScript dynamically using the WSDL file. ...
      (microsoft.public.dotnet.framework.aspnet)