You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Christian GrĂ¼ndemann <ch...@gruendemann.com> on 2002/12/05 22:45:21 UTC

Attachment problem with Squid proxy

Hello!

I know this is not the correct mailinglist for my problem, but maybe someone
of you can give me a hint to. I haven't found a  solution for quite a while.
Thanks for your cooperation.

I have found a strange behaviour when I am using the jaxm api.
As long as I am sending pure xml data everything works fine. When I try to
add jpg pictures even this works, but if I use a squid proxy I get a strange
javax.internet.mail.ParseException which is shown at the end of the mail. I
have no idea why this happens, because without the squid proxy the jpg
picture is sent correctly.

If someone of you have any idea I would really appriciate your help, because
i ran out of ideas to solve that issue.
For more information I show you now some code fragments.

I am adding the picture like that
****************
data2 = new FileInputStream(new File("c:\picture.jpg"));
DataHandler dh = new DataHandler(new BinaryDataSource(data2));
AttachmentPart attachment2 = message.createAttachmentPart(dh);
attachment2.setContentType("image/jpeg");
attachment2.setContentId("some id");
message.addAttachmentPart(attachment2);

****************
the datahandler is like this
***********************

public class BinaryDataSource implements DataSource
{
private InputStream _is;

public BinaryDataSource(InputStream is)
{
 _is = is;
}
public String getContentType()
{
 return   "application/binary";
}
public InputStream getInputStream() throws IOException
{
 return _is;
}
public String getName()
{
 return "some file";
}
public OutputStream getOutputStream() throws IOException
{
 throw new IOException("Cannot write to this file");
}
an so on...

I sniffed the soap data via axis tcpmon and the only difference is
in the HTTP header, which is normal when using a squid proxy, i guess.

** Sniffed soap data.
POST /Receiving/ReqRes HTTP/1.0
Content-Type: multipart/related; type="text/xml";
Content-Length: 106713
SOAPAction: ""
User-Agent: Java1.3.1_04
Host: x.x.x.x

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
***********
Via: 1.1 mail1.xxx.de:8081 (Squid/2.2.STABLE5)
*************
X-Forwarded-For: x.x.x.x
Cache-Control: max-age=259200
Connection: keep-alive

------=_Part_0_4283878.1038851232245

Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Header/
>
<soap-env:Body>
<m:transferData xmlns:m="urn:TransferToMatchMaker">

  <CarBean>
  .....
  </CarBean>
</m:transferData>
</soap-env:Body></soap-env:Envelope>

------=_Part_0_4283878.1038851232245
Content-Type: image/jpeg
Content-Id: image/jpeg

*******
binary data comes here
******

Thanks for your help in advance,
Christian Gruendemann


***********
The Exception that is thrown by the server.
**********
H:\download\jwsdp-1_0_01\bin>catalina.bat run
Starting service Internal Services
Java Web Services Developer Pack/1.0_01-fcs
Starting service Java Web Services Developer Pack
Java Web Services Developer Pack/1.0_01-fcs
DEBUG: Picture Servlet
javax.mail.internet.ParseException
        at javax.mail.internet.ParameterList.<init>(ParameterList.java:61)
        at javax.mail.internet.ContentType.<init>(ContentType.java:83)
        at
com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:89)
        at
com.sun.xml.messaging.saaj.soap.MessageFactoryImpl.createMessage(MessageFact
oryImpl.java:32)
        at javax.xml.messaging.JAXMServlet.doPost(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:646)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:646)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2349)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:646)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:644)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171
)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:644)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:646)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:644)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:376)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:518)
        at java.lang.Thread.run(Thread.java:479)