Question

I'm used to sending files via SOAP to / from C# based web services and we've always used the "byte[]" type for the contents of the file.

However, I've now got a java web service that wants a byteArrayOutputStream and I have no idea how to send it one from my C# client.

The WSDL shows it as

<xs:element name="baos" type="tns:byteArrayOutputStream" minOccurs="0" />

adding the web reference to the project generates the following empty (aside from the INotify... stuff) classes


    public partial class byteArrayOutputStream : outputStream {
    }

    public abstract partial class outputStream : object, System.ComponentModel.INotifyPropertyChanged {
       // boring INotifyPropertyChanged stuff removed
    }

This seems completely worthless / unusable, so I either need to:

  • figure out how to add the web reference differently

or

  • figure out how to use this generated class.

As a last resort I will ask the java team to just accept a byte[] instead of a ByteArrayOutputStream, but, does anyone have any idea how I can currently consume this java based web service to send files to it from my C# client?

Was it helpful?

Solution

I bet this is an Axis web service you're trying to call. Some older versions of Axis fail to define certain types in the apachesoap namespace. They may simply need to upgrade their Axis version.

Alternatively, I'd tell them what I tell .NET Web Service creators: do not return platform-specific types from a web service. Web Services are meant to be interoperable - what's the sense in returning a byteOutputStream or a Map or a DataSet to a platform which knows nothing about that type?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top