AXIS DIME attachments file
--------------------------
Key: AXIS-2428
URL: http://issues.apache.org/jira/browse/AXIS-2428
Project: Apache Axis
Type: Bug
Components: Basic Architecture
Versions: 1.3
Environment: Axis 1.3, Tomcat 5.0.28, JDK1.5.0_06, Windows
Reporter: hiroyuki honda
Priority: Minor
The file transmission by DIME doesn't go well in AXIS and it embarrasses it.
It doesn't go well in Tomcat5.0.28, AXIS1.3, and JDK1.5.0_06 though it goes
well in Tomcat5.0.28, AXIS1.1, and JDK1.4.2_7. When the size of the file
exceeds 1M, it seems not to be able to execute it.
Is there a solution to make it execute though it wants to use in the latest
environment?My best regards.
------------------------------------Client------------------------------------
public String go(String fileName) throws Exception
{
if(!fileName.equals(""))
{
Service service = null;
Call call = null;
service = new Service();
call = (Call)service.createCall();
call.setTargetEndpointAddress(new
URL("http://localhost/axis/sendservice_jws.jws?wsdl"));
call.setOperationName(new QName("sendservice", "hello"));
call.addParameter("fileName", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("folder", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
call.setProperty(all.ATTACHMENT_ENCAPSULATION_FORMAT,call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
AttachmentPart ap = new AttachmentPart(new DataHandler(new
FileDataSource(fileName)));
ap.setContentType("image");
call.addAttachmentPart(ap);
String ret = (String)call.invoke(new String[] {
fileName
});
return ret;
}
else
{
return "NULL";
}
}
------------------------------------Server(Jws
file)------------------------------------
public class sendservice_jws
{
public static String folderPass = "";
public String hello(String fileName)
{
String msg = "";
String extension = ".jpg";
folderPass = "C:/Files_xml/";
File dirsin = new File(folderPass);
dirsin.mkdirs();
MessageContext ctx = MessageContext.getCurrentContext();
Message message = ctx.getRequestMessage();
AttachmentPart part = (AttachmentPart)message.getAttachments().next();
String filename = fileName.substring(fileName.lastIndexOf("/") + 1);
FileOutputStream fs = null;
if(filename.indexOf(extension) !=-1)
{
try
{
fs = new FileOutputStream(folderPass + filename);
part.getDataHandler().writeTo(fs);
fs.close();
msg = "OK";
return msg;
}
catch (Exception e)
{
msg = "WriteError";
e.printStackTrace();
return msg;
}
}
else
{
msg = "ExtensionError"+extension;
return msg;
}
}
}
**********TOMCAT LOG**********
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.io.IOException: End of physical stream detected when 11 more
bytes expected.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.io.IOException: End of physical
stream detected when 11 more bytes expected.
at
org.apache.axis.attachments.DimeDelimitedInputStream._read(DimeDelimitedInputStream.java:273)
at
org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:201)
at
org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:445)
at
org.apache.axis.attachments.ManagedMemoryDataSource.<init>(ManagedMemoryDataSource.java:146)
at
org.apache.axis.attachments.MultiPartDimeInputStream.readTillFound(MultiPartDimeInputStream.java:163)
at
org.apache.axis.attachments.MultiPartDimeInputStream.readAll(MultiPartDimeInputStream.java:100)
at
org.apache.axis.attachments.MultiPartDimeInputStream.getAttachments(MultiPartDimeInputStream.java:108)
at
org.apache.axis.attachments.AttachmentsImpl.mergeinAttachments(AttachmentsImpl.java:171)
at
org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:550)
at org.apache.axis.Message.getAttachments(Message.java:689)
at sendservice_jws.hello(sendservice_jws.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
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.handlers.soap.SOAPService.invoke(SOAPService.java:453)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
{http://xml.apache.org/axis/}hostname:ws0002
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira