Re: [axis2]axis2 + mtom
Hi, yes I wrote the previous mail before being well familiar with the problem I'm using axis2 1.0 as you suggested... also I saw there was a similar thread in the developer mailing list -> http://marc.theaimsgroup.com/?l=axis-dev&m=114127380803712&w=2 and i also tried using the same javamail implementation in the client and the server side... again no use. Every time the same exception thrown in the ContentType constructor... actually in the content type costructor the content type is correctly parsed as multipart/related but then from the rest of the string while populating the ParameterList a ParseException is thrown. I wasn't able to see on which exactly parameter... somehow the values of the variables are not shown in eclipse while debugging... actually I checked out the glassfish project and there is no debuglevel set in the compile task of the ant script... anyway maybe I'm doing sth wrong... I tried several versions of sun's javamail implementation but this part is all the same... for now I have no idea what to do except for using geronimo implementation... I haven't tried sun's WS implementation but I plan to look through java wsdp 2.0 and see how are attachments dealt with there... after all my http header looks fine: POST /services/WSMTOMTest HTTP/1.1 User-Agent: Axis/2.0 Host: 127.0.0.1:8011 Content-Length: 1660 Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_F23678BB911F58EC2511473375344002; type="application/xop+xml"; start="<0.urn:uuid:[EMAIL PROTECTED]>"; start-info="application/soap+xml"; charset=UTF-8;action=; and I'm curious what would a similar header generated with their ws framework look like. Thanks for the reply again! Best wishes! Stefan > Have you tried with Axis2 1.0.. I fixed a content type issue lately, but > wasn't able to check whether it'll solve the Java Mail issue... > > Gerenimo java Mail & Sun's Java mail are different implementations of Java > Mail spec. We can't use Sun's Java mail through Maven repositories due to > licensing issues... > > ~Thilina > > On 5/10/06, Stefan Vladov <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> sorry to bother you again with the same old stuff... my problem was the >> javamail implementation... an exception of type ParseException is thrown >> somewhere in >> javax.mail.internet.ContentType#ContentType(String type) >> , which is called by >> public Attachments(InputStream inStream, String contentTypeString, >>boolean fileCacheEnable, String >> attachmentRepoDir, >>String fileThreshold) >> in org.apache.axiom.attachments.Attachments, >> called from TransportUtils and so on... >> I wasn't able to debug javamail further to see the exact cause. >> Anyway my question is: is MTOM in axis2 meant to work only with geronimo >> mail implementation and if you are familiar with the issue, have you >> come up with some workaround. >> As I am totally unfamiliar with the differences between geronimo's and >> sun's implementations I thought the problem might be in the registered >> handlers in the mailcap-s of the jars, however now I saw that the code >> is >> different althogh packages, classes and methods are the same :( . >> geronimo source is looks like that: >> >> public ContentType(String type) >> throws ParseException >> { >> int slash = type.indexOf("/"); >> int semi = type.indexOf(";"); >> >> try >> { >> _major = type.substring(0, slash); >> if(semi == -1) >> { >> _minor = type.substring(slash + 1); >> } else >> { >> _minor = type.substring(slash + 1, semi); >> _list = new ParameterList(type.substring(semi + >> 1)); >> } >> } >> catch(StringIndexOutOfBoundsException e) >> { >> throw new ParseException("Type invalid: " + type); >> } >> } >> ,whereas sun's javamail 1.4 as well as 1.3.1 are: >> >> public ContentType(String s) >> throws ParseException >> { >> HeaderTokenizer headertokenizer = new HeaderTokenizer(s, >> "()<>@,;:\\\"\t []/?="); >> HeaderTokenizer.Token token = headertokenizer.next(); >> if(token.getType() != -1) >> throw new ParseException(); >> primaryType = token.getValue(); >> token = headertokenizer.next(); >> if((char)token.getType() != '/') >> throw new ParseException(); >> token = headertokenizer.next(); >> if(token.getType() != -1) >> throw new ParseException(); >> subType = token.getValue(); >> String s1 = headertokenizer.getRemainder(); >> if(s1 != null) >> list = new ParameterList(s1); >> } >> Anyway I am
Re: [axis2]axis2 + mtom
Have you tried with Axis2 1.0.. I fixed a content type issue lately, but wasn't able to check whether it'll solve the Java Mail issue... Gerenimo java Mail & Sun's Java mail are different implementations of Java Mail spec. We can't use Sun's Java mail through Maven repositories due to licensing issues... ~ThilinaOn 5/10/06, Stefan Vladov <[EMAIL PROTECTED]> wrote: Hi,sorry to bother you again with the same old stuff... my problem was thejavamail implementation... an exception of type ParseException is thrownsomewhere injavax.mail.internet.ContentType#ContentType (String type), which is called bypublic Attachments(InputStream inStream, String contentTypeString, boolean fileCacheEnable, String attachmentRepoDir, String fileThreshold)in org.apache.axiom.attachments.Attachments,called from TransportUtils and so on...I wasn't able to debug javamail further to see the exact cause.Anyway my question is: is MTOM in axis2 meant to work only with geronimo mail implementation and if you are familiar with the issue, have youcome up with some workaround.As I am totally unfamiliar with the differences between geronimo's andsun's implementations I thought the problem might be in the registered handlers in the mailcap-s of the jars, however now I saw that the code isdifferent althogh packages, classes and methods are the same :( .geronimo source is looks like that:public ContentType(String type) throws ParseException{int slash = type.indexOf("/");int semi = type.indexOf(";");try{ _major = type.substring(0, slash);if(semi == -1){_minor = type.substring(slash + 1);} else{_minor = type.substring(slash + 1, semi);_list = new ParameterList(type.substring(semi + 1));}}catch(StringIndexOutOfBoundsException e){throw new ParseException("Type invalid: " + type);}},whereas sun's javamail 1.4 as well as 1.3.1 are:public ContentType(String s)throws ParseException {HeaderTokenizer headertokenizer = new HeaderTokenizer(s,"()<>@,;:\\\"\t []/?=");HeaderTokenizer.Token token = headertokenizer.next();if(token.getType() != -1) throw new ParseException();primaryType = token.getValue();token = headertokenizer.next();if((char)token.getType() != '/')throw new ParseException();token = headertokenizer.next();if(token.getType() != -1)throw new ParseException();subType = token.getValue();String s1 = headertokenizer.getRemainder();if(s1 != null) list = new ParameterList(s1);}Anyway I am serving the web services on Jetty embedded in an application(which actually provides the services ) and I somehow don't want to switchto geronimo's implementation, so please if somebody has been through this HEEELP!> I have fixed the SOAP version issue+ a potential content type issue> recently.> Are you using Sun's impl of Java Mail?>> Please try with the latest svn heads.. Even the latest Axis2 RC + Axiom > RC would be fine..>> ~Thilina>>> On 5/2/06, Stefan Vladov <[EMAIL PROTECTED]> wrote: Hi guys, This is probably a very stupid problem, however since I consider myself>> a>> newbie and I've been using web services for about 2-3 weeks the issue>> has>> turned out to be quite a bottleneck for me. So here is my problem: I was >> trying to make the following scenario with apache axis2 0.95 - a client>> requests a file from by providing a name and a web service sends it (the>> file) as a binary attachment. However since things did not work I tried >> rewriting the sample and I still have the same problem. My version that>> is>> quite similar to the original looks like that: public class MTOMClient>> { >>private static EndpointReference targetEPR = new>> EndpointReference("http://localhost:8011/services/WSMTOMTest");>>private static imageFileName = "some image name"; public static void main (String[] args)>>{>>try>>{>>OMFactory fac = OMAbstractFactory.getOMFactory();>>OMNamespace omNs = fac.createOMNamespace("http://blabla",>> "bla");>>OMElement method = fac.createOMElement("handle", omNs);>>Image image;>>image = new ImageIO().loadImage(new>> FileInputStream(imagefilename));>>ImageDataSource dataSource = new >> ImageDataSource("calendar.jpg",image);>>DataHandler dataHandler = new DataHandler(dataSource);>>OMText textData = fac.createText(dataHandler, true);>>OMElement imageElement = fac.createOMElem
Re: [axis2]axis2 + mtom
Hi, sorry to bother you again with the same old stuff... my problem was the javamail implementation... an exception of type ParseException is thrown somewhere in javax.mail.internet.ContentType#ContentType(String type) , which is called by public Attachments(InputStream inStream, String contentTypeString, boolean fileCacheEnable, String attachmentRepoDir, String fileThreshold) in org.apache.axiom.attachments.Attachments, called from TransportUtils and so on... I wasn't able to debug javamail further to see the exact cause. Anyway my question is: is MTOM in axis2 meant to work only with geronimo mail implementation and if you are familiar with the issue, have you come up with some workaround. As I am totally unfamiliar with the differences between geronimo's and sun's implementations I thought the problem might be in the registered handlers in the mailcap-s of the jars, however now I saw that the code is different althogh packages, classes and methods are the same :( . geronimo source is looks like that: public ContentType(String type) throws ParseException { int slash = type.indexOf("/"); int semi = type.indexOf(";"); try { _major = type.substring(0, slash); if(semi == -1) { _minor = type.substring(slash + 1); } else { _minor = type.substring(slash + 1, semi); _list = new ParameterList(type.substring(semi + 1)); } } catch(StringIndexOutOfBoundsException e) { throw new ParseException("Type invalid: " + type); } } ,whereas sun's javamail 1.4 as well as 1.3.1 are: public ContentType(String s) throws ParseException { HeaderTokenizer headertokenizer = new HeaderTokenizer(s, "()<>@,;:\\\"\t []/?="); HeaderTokenizer.Token token = headertokenizer.next(); if(token.getType() != -1) throw new ParseException(); primaryType = token.getValue(); token = headertokenizer.next(); if((char)token.getType() != '/') throw new ParseException(); token = headertokenizer.next(); if(token.getType() != -1) throw new ParseException(); subType = token.getValue(); String s1 = headertokenizer.getRemainder(); if(s1 != null) list = new ParameterList(s1); } Anyway I am serving the web services on Jetty embedded in an application (which actually provides the services ) and I somehow don't want to switch to geronimo's implementation, so please if somebody has been through this HEEELP! > I have fixed the SOAP version issue+ a potential content type issue > recently. > Are you using Sun's impl of Java Mail? > > Please try with the latest svn heads.. Even the latest Axis2 RC + Axiom > RC would be fine.. > > ~Thilina > > > On 5/2/06, Stefan Vladov <[EMAIL PROTECTED]> wrote: >> >> Hi guys, >> >> This is probably a very stupid problem, however since I consider myself >> a >> newbie and I've been using web services for about 2-3 weeks the issue >> has >> turned out to be quite a bottleneck for me. So here is my problem: I was >> trying to make the following scenario with apache axis2 0.95 - a client >> requests a file from by providing a name and a web service sends it (the >> file) as a binary attachment. However since things did not work I tried >> rewriting the sample and I still have the same problem. My version that >> is >> quite similar to the original looks like that: >> >> public class MTOMClient >> { >>private static EndpointReference targetEPR = new >> EndpointReference("http://localhost:8011/services/WSMTOMTest";); >>private static imageFileName = "some image name"; >> >>public static void main (String[] args) >>{ >>try >>{ >>OMFactory fac = OMAbstractFactory.getOMFactory(); >>OMNamespace omNs = fac.createOMNamespace("http://blabla";, >> "bla"); >>OMElement method = fac.createOMElement("handle", omNs); >>Image image; >>image = new ImageIO().loadImage(new >> FileInputStream(imagefilename)); >>ImageDataSource dataSource = new >> ImageDataSource("calendar.jpg",image); >>DataHandler dataHandler = new DataHandler(dataSource); >>OMText textData = fac.createText(dataHandler, true); >>OMElement imageElement = fac.createOMElement("imageElement", >> omNs); >>imageElement.addChild(textData); >>method.addChild(imageElement); >> >>Options options = new Options(); >>options.setTo(targetEPR); >>options.setSoapVersionURI( >> SOAP11Con
Re: [axis2]axis2 + mtom
I have fixed the SOAP version issue+ a potential content type issue recently. Are you using Sun's impl of Java Mail? Please try with the latest svn heads.. Even the latest Axis2 RC + Axiom RC would be fine.. ~Thilina On 5/2/06, Stefan Vladov <[EMAIL PROTECTED]> wrote: Hi guys,This is probably a very stupid problem, however since I consider myself anewbie and I've been using web services for about 2-3 weeks the issue has turned out to be quite a bottleneck for me. So here is my problem: I wastrying to make the following scenario with apache axis2 0.95 - a clientrequests a file from by providing a name and a web service sends it (the file) as a binary attachment. However since things did not work I triedrewriting the sample and I still have the same problem. My version that isquite similar to the original looks like that:public class MTOMClient { private static EndpointReference targetEPR = newEndpointReference("http://localhost:8011/services/WSMTOMTest"); private static imageFileName = "some image name"; public static void main (String[] args) { try { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace ("http://blabla", "bla"); OMElement method = fac.createOMElement("handle", omNs); Image image; image = new ImageIO().loadImage(new FileInputStream(imagefilename)); ImageDataSource dataSource = newImageDataSource("calendar.jpg",image); DataHandler dataHandler = new DataHandler(dataSource); OMText textData = fac.createText(dataHandler, true); OMElement imageElement = fac.createOMElement("imageElement",omNs); imageElement.addChild(textData); method.addChild(imageElement); Options options = new Options(); options.setTo(targetEPR); options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); options.setTransportInProtocol (Constants.TRANSPORT_HTTP); options.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE); //Blocking invocation ServiceClient serviceClient = new ServiceClient(); serviceClient.setOptions(options); OMElement result = serviceClient.sendReceive(method); StringWriter writer = new StringWriter(); result.serialize(XMLOutputFactory.newInstance ().createXMLStreamWriter(writer)); writer.flush(); System.out.println(writer.toString()); } catch (Exception e) { e.printStackTrace(); } }}and I got the following exception: "Transport level information does notmatch with SOAP Message namespace URI atorg.apache.ws.commons.soap.impl.builder.StAXSOAPModelBuilder.identifySOAPVersion (StAXSOAPModelBuilder.java:123)..."which I believe was caused by the fact that the factory for thesoapenvelope was SOAP12Factory. The exception seems to be thrown on theclient side however tcpmon displays a nice request message and a response with AxisFault in it, which somehow confuses me :(! Since I didn't knowhow to specify factory class name I changed the option of the client to"SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI" and the exception changed :) to"org.apache.axis2.AxisFault: org.apache.axis2.AxisFault: Invalid ContentType Field in the Mime Message; nested exception is: org.apache.ws.commons.om.OMException: Invalid Content Type Field in the Mime Message atorg.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:295) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:160) "which also is thrown I believe on the client side but still I see requestand response in tcpmon. Now, my request message looks like that:POST /services/WSMTOMTest HTTP/1.1User-Agent: Axis/2.0 Host: localhost:8011Transfer-Encoding: chunkedContent-Type: multipart/related;boundary=MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181;type="application/xop+xml";start="< 0.urn:uuid:[EMAIL PROTECTED]>";start-info="application/soap+xml"; charset=UTF-8;action="">645--MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181 content-type:application/xop+xml; charset=UTF-8; type="application/soap+xml";content-transfer-encoding:binarycontent-id:<0.urn:uuid:[EMAIL PROTECTED] >xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">/>xmlns:bla="http://blabla">href="" href="mailto:1.urn:uuid:[EMAIL PROTECTED]"> 1.urn:uuid:[EMAIL PROTECTED]"xmlns:xop="http://www.w3.org/2004/08/xop/include"/> --MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181content-id:<1.urn:uuid:[EMAIL PROTECTED]>content-type:image/jpeg content-transfer-encoding:binary-binary data-MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181--0and the only difference that I noticed between this message and the one of the sample is the start-info property which was
[axis2]axis2 + mtom
Hi guys, This is probably a very stupid problem, however since I consider myself a newbie and I've been using web services for about 2-3 weeks the issue has turned out to be quite a bottleneck for me. So here is my problem: I was trying to make the following scenario with apache axis2 0.95 - a client requests a file from by providing a name and a web service sends it (the file) as a binary attachment. However since things did not work I tried rewriting the sample and I still have the same problem. My version that is quite similar to the original looks like that: public class MTOMClient { private static EndpointReference targetEPR = new EndpointReference("http://localhost:8011/services/WSMTOMTest";); private static imageFileName = "some image name"; public static void main (String[] args) { try { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://blabla";, "bla"); OMElement method = fac.createOMElement("handle", omNs); Image image; image = new ImageIO().loadImage(new FileInputStream(imagefilename)); ImageDataSource dataSource = new ImageDataSource("calendar.jpg",image); DataHandler dataHandler = new DataHandler(dataSource); OMText textData = fac.createText(dataHandler, true); OMElement imageElement = fac.createOMElement("imageElement", omNs); imageElement.addChild(textData); method.addChild(imageElement); Options options = new Options(); options.setTo(targetEPR); options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); //Blocking invocation ServiceClient serviceClient = new ServiceClient(); serviceClient.setOptions(options); OMElement result = serviceClient.sendReceive(method); StringWriter writer = new StringWriter(); result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(writer)); writer.flush(); System.out.println(writer.toString()); } catch (Exception e) { e.printStackTrace(); } } } and I got the following exception: "Transport level information does not match with SOAP Message namespace URI at org.apache.ws.commons.soap.impl.builder.StAXSOAPModelBuilder.identifySOAPVersion(StAXSOAPModelBuilder.java:123)..." which I believe was caused by the fact that the factory for the soapenvelope was SOAP12Factory. The exception seems to be thrown on the client side however tcpmon displays a nice request message and a response with AxisFault in it, which somehow confuses me :(! Since I didn't know how to specify factory class name I changed the option of the client to "SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI" and the exception changed :) to "org.apache.axis2.AxisFault: org.apache.axis2.AxisFault: Invalid Content Type Field in the Mime Message; nested exception is: org.apache.ws.commons.om.OMException: Invalid Content Type Field in the Mime Message at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:295) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:160) " which also is thrown I believe on the client side but still I see request and response in tcpmon. Now, my request message looks like that: POST /services/WSMTOMTest HTTP/1.1 User-Agent: Axis/2.0 Host: localhost:8011 Transfer-Encoding: chunked Content-Type: multipart/related; boundary=MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181; type="application/xop+xml"; start="<0.urn:uuid:[EMAIL PROTECTED]>"; start-info="application/soap+xml"; charset=UTF-8;action=; 645 --MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181 content-type:application/xop+xml; charset=UTF-8; type="application/soap+xml"; content-transfer-encoding:binary content-id:<0.urn:uuid:[EMAIL PROTECTED]> http://www.w3.org/2003/05/soap-envelope";>http://blabla";>http://www.w3.org/2004/08/xop/include"; /> --MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181 content-id:<1.urn:uuid:[EMAIL PROTECTED]> content-type:image/jpeg content-transfer-encoding:binary -binary data--- --MIMEBoundaryurn:uuid:F91F6DFF8B9836261F11465870886181-- 0 and the only difference that I noticed between this message and the one of the sample is the start-info property which was "text/xml" in the original, as well as the "type" attributes of the mime parts... oh and the empty action. I'm using the standard axis2.xml configuration file, nothing extraordinary in the services.xml and the service is very simple too: public class WS