Re: How to Return an XML Doc via a Web Method
From: charlie (spamnongrata_at_yahoo.com)
Date: 04/29/04
- Previous message: charlie: "Puzzling SOAP Error..."
- In reply to: Tom Ficker: "How to Return an XML Doc via a Web Method"
- Messages sorted by: [ date ] [ thread ]
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
- Previous message: charlie: "Puzzling SOAP Error..."
- In reply to: Tom Ficker: "How to Return an XML Doc via a Web Method"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|