This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Axis 1.4 Problem with DIME attachment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis 1.4 Problem with DIME attachment" Watch "Axis 1.4 Problem with DIME attachment" New topic
Author

Axis 1.4 Problem with DIME attachment

Surbjeeet Dutta
Greenhorn

Joined: Jul 28, 2011
Posts: 1
Dear Firiends,

I am facing a strange issue with my Java web service client. My findings are; whenever I send attachment more than 1 MB it give 400 Bad request (HTTP) error, small attachmets are working fine. The web service here i am using is .NET based and using a .NET client am able to attach more than 1 MB, but not from my Java client. Below is the snippet of the code to send attachment using Axis 1.4
This issue is coming production so i need to fix it urgently, looking forward for some useful information Thank

===========
public java.lang.String hellowWorld(List files,java.lang.String nocxml) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("http://tempuri.org/testService/hellowWorld");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://tempuri.org/testService", "hellowWorld"));
_call.setProperty(org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMAT,
org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
DataSource ds = null;
DataHandler dh = null;
if(files != null && files.size() > 0){


Iterator itrFiles = files.iterator();
int _i = 0;
while(itrFiles.hasNext()){
File fileObj = (File)itrFiles.next();
ds = null;
dh = null;
File f =(File)files.get(_i);
_i++;
if(fileObj.isFile())
{
System.out.print("file is there -----------------------");
ds = new FileDataSource(fileObj);
dh = new DataHandler(ds);
org.apache.axis.attachments.AttachmentPart ap = new org.apache.axis.attachments.AttachmentPart(dh);
ap.setContentType("application/octet-stream");
ap.setContentId(fileObj.getName());
_call.addAttachmentPart(ap);
}
}
}

setRequestHeaders(_call);
setAttachments(_call);
try {
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {nocxml});

if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
axisFaultException.printStackTrace();
throw axisFaultException;
}

}

==========

Below is the error i am getting

|AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (400)Bad Request
faultActor:
faultNode:
faultDetail:
{}:return code: 400

{http://xml.apache.org/axis/}HttpErrorCode:400

(400)Bad Request
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
...........

=========
Nimishaa Garg
Greenhorn

Joined: Oct 19, 2011
Posts: 7
Hi Surbjeeet Dutta
were you able to find the resolution for this issue .
I am also getting the same error

rg.apache.axis.Message setup InvocationTargetException:
java.lang.reflect.InvocationTargetExceptionCaused by: java.io.IOException: DIME version received "7" greater than current supported
version "1".
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.attachments.AttachmentsImpl.<init>(AttachmentsImpl.java:149)
... 14 more
Caused by: java.io.IOException: DIME version received "7" greater than current supported version "1".
at org.apache.axis.attachments.DimeDelimitedInputStream.readHeader(DimeDelimitedInputStream.java:329)
at org.apache.axis.attachments.DimeDelimitedInputStream.<init>(DimeDelimitedInputStream.java:123)
at org.apache.axis.attachments.MultiPartDimeInputStream.<init>(MultiPartDimeInputStream.java:60)
at org.apache.axis.attachments.AttachmentsImpl.<init>(AttachmentsImpl.java:146)


Plesae let me knwo If any 1 has idea about this issue
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis 1.4 Problem with DIME attachment
 
Similar Threads
Consuming Webservice in Java
org.apache.axis.client.Call 's invoke method
Axis 1.4 username/password auth with stubs
client code to connect to Web services
unable to run the Axis client