Problem with Dime-attachments from Axis to .NET

  • Thread starter Thread starter Espen Sletteng
  • Start date Start date
E

Espen Sletteng

Hello all,


I want to create a .NET-based web service that can accept dime-based
attachments from a java (Axis)-based client. I have searched for
examples that look like this scenario, but haven't found any.

I have created the service in C#, here is the code:

HttpSoapContext.RequestContext.Path.MustUnderstand = false;
StreamReader stream = new
StreamReader(HttpSoapContext.RequestContext.Attachments[0].Stream);
// here I can do something with the stream...


From Axis, I have used the WSDL2Java tool to create the stub-code to
access the .NET web service. This is the code:

MyLocator locator = new MyLocator();
FileInputStream stream = new FileInputStream("c:\\dok1.doc");
MySoapStub archive = (MySoapStub) locator.getMySoap();
archive._setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
archive.addAttachment(stream);
int result = archive.saveDocument();


When I run this example, I get the following errorcode:
java.lang.RuntimeException: No support for attachments

What am I missing here? A code-sample would be great!

Cheers,
Espen Sletteng
 
I managed to solve the problem by adding activation.jar and mail.jar
to the Axis-client, and use DataHandler instead for FileInputStream.
It works really nice!
 
Back
Top