Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

DIME attachments using Apache Axis

843834Apr 16 2004 — edited Mar 9 2007
Hi everybody!

I'm developing an application that must consume some .NET Web Services, sending and receving binary information(files). It seems that the way to do this is using DIME attachments, supported by both Apache Axis on Java side and .NET.

In order to test the message creation, I used a prototype that send a SOAP request for a .NET web service and display the result, adding some code to create the DIME attachments. But I got the error below. Does anybody know how to use it properly. I also included my code after the error message.

Thanks a lot!

Sergio

Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.RuntimeException: No support for attachments
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: java.lang.RuntimeException: No
support for attachments
at org.apache.axis.client.Call.setRequestMessage(Call.java:1998)
at org.apache.axis.client.Call.invoke(Call.java:2243)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at testClient2.main(testClient2.java:76)


java.lang.RuntimeException: No support for attachments
at org.apache.axis.AxisFault.makeFault(AxisFault.java:129)
at org.apache.axis.client.Call.invoke(Call.java:2251)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at testClient2.main(testClient2.java:76)
Caused by: java.lang.RuntimeException: No support for attachments
at org.apache.axis.client.Call.setRequestMessage(Call.java:1998)
at org.apache.axis.client.Call.invoke(Call.java:2243)


============================================================================


import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;

import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;

import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.attachments.Attachments;
import org.apache.axis.attachments.AttachmentPart;

import javax.xml.soap.SOAPMessage;

public class testClient2
{
public static void main(String [] args) throws Exception {

Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://www.catalin.com/webservices/", "addNumbers") );
call.addParameter( "numberOne", org.apache.axis.Constants.XSD_DOUBLE, ParameterMode.IN );
call.addParameter( "numberTwo", org.apache.axis.Constants.XSD_DOUBLE, ParameterMode.IN );
call.setReturnType( org.apache.axis.Constants.XSD_DOUBLE);
call.setSOAPActionURI( "http://www.catalin.com/webservices/addNumbers");
System.out.println(call.getProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT));

// Attachment

call.addAttachmentPart(new String("Test"));

//Invoke
Double ret = (Double) call.invoke(new Object[] {new Double(7),new Double(2)});
System.out.println("Echo : " + ret);
}
}

Comments

843834
hi sergio

i hat a very similar problem today with axis running on jetty

2 suggestions which may help you:

use activation.jar and mail.jar provided by sun appserver SUNWappserver/lib (those jar-files are bigger than those you get if you follow the download instructions on axis happiness page)

place them in the webapps/axis/WEB-INF/lib directory
(i hat them in jetty/ext first)
843833
Hi all,
I have a .Net web service and a java client. I need to add DIME attachments in my java client and send it to .Net service.
How to do this????

Please do reply soon....

Thx in advance
Mithun K
843833
Hi MithunK,

We are in the same requirement which you have searched earlier?....
Can you please help me in doing the same?.
Currently we are using MIME SOAP to subit request and attachment to the .NET webservice from JAVA service. Now we need to use DIME to send larger attachments.

Can you please help me?

Thanks,
Subbu
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 6 2007
Added on Apr 16 2004
3 comments
1,231 views