3 Replies Latest reply on Jun 15, 2011 7:42 AM by he youlin

    Seam - Jaxws webservice - with MTOM attachment - Error

    Srinivasan Thoyyeti Newbie

      Hello there,


        1.1 I have following JAX-WS MTOM WebService.



      import javax.activation.DataHandler;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.xml.bind.annotation.XmlMimeType;
      import javax.xml.ws.WebServiceException;
      import javax.xml.ws.soap.MTOM;
      @WebService()
      @MTOM
      public class TestAttachmentMTOM_2
      {
      
          /**
           * Web service operation
           */
      
          // Use @XmlMimeType to map to DataHandler on the client side 
          @WebMethod
          public void fileUpload(String fileName,
                                 @XmlMimeType("application/octet-stream") 
                                 DataHandler data) {
             try {
                  System.out.println("File Name: "+fileName+" ;DataHandler: "+ data);
                  
                  
                  
             } catch (Exception e) {
                   throw new WebServiceException(e);
             }
      
          }
      } 



      1.2 web.xml entries related


             


       <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
                <init-param>
                     <param-name>createTempFiles</param-name>
                     <param-value>false</param-value>
                </init-param>
                <init-param>
                     <param-name>maxRequestSize</param-name>
                     <param-value>10485760</param-value>
                </init-param>
           </filter>
           <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
           </filter-mapping>
      
              <servlet>
                <display-name>TestAttachmentMTOM</display-name>
                <servlet-name>TestAttachmentMTOM</servlet-name>
                <servlet-class>com.personal.wsService.TestAttachmentMTOM</servlet-class>
           </servlet>
           <servlet-mapping>
                <servlet-name>TestAttachmentMTOM</servlet-name>
                <url-pattern>/TestAttachmentMTOM</url-pattern>
           </servlet-mapping>
      





        • 1. Re: Seam - Jaxws webservice - with MTOM attachment - Error
          Srinivasan Thoyyeti Newbie

          When I start my Jobss server the service is shown as published and I am able to access the WSDL.


          But When I try to upload a file with SOAP UI client, it shows following error:




          <html><head><title>JBoss Web/2.1.3.GA - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: java.lang.IllegalArgumentException: no file extension in servlet path: /TestAttachmentMTOM_2
               org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:126)
               org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
               org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
               org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
               org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
               org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
               org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
               org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          </pre></p><p><b>root cause</b> <pre>java.lang.IllegalArgumentException: no file extension in servlet path: /TestAttachmentMTOM_2
               org.jboss.seam.mock.MockViewHandler.getActionURL(MockViewHandler.java:45)
               org.jboss.seam.jsf.SeamViewHandler.getActionURL(SeamViewHandler.java:74)
               org.jboss.seam.faces.FacesManager.redirect(FacesManager.java:168)
               org.jboss.seam.faces.Redirect.execute(Redirect.java:154)
               org.jboss.seam.exception.DebugPageHandler.handle(DebugPageHandler.java:32)
               org.jboss.seam.exception.Exceptions.handle(Exceptions.java:76)
               org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:114)
               org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
               org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
               org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
               org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
               org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
               org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
               org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          </pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the JBoss Web/2.1.3.GA logs.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/2.1.3.GA</h3></body></html>
          



          I am using following in my example
            Seam 2.2.1
            Jboss 5.1
            SOAP 1.1 with MTOM


          If you have faced similar issue please post your comment. Thank you.


           

          • 2. Re: Seam - Jaxws webservice - with MTOM attachment - Error
            Srinivasan Thoyyeti Newbie

            Hi,


            Following issued by SeamFilter so commented it out of web.xml....guess what my example works in flying colors.





            java.lang.IllegalArgumentException: no file extension in servlet path: /TestAttachmentMTOM_2
                    org.jboss.seam.mock.MockViewHandler.getActionURL(MockViewHandler.java:45)
            





            I think its bug in Seam framework.

            • 3. Re: Seam - Jaxws webservice - with MTOM attachment - Error
              he youlin Novice
              <filter-mapping>
                              <filter-name>Seam Filter</filter-name>
                              <url-pattern>*.seam or something else rather than TestAttachmentMTOM</url-pattern>
                      </filter-mapping>
              Just add components.xml
              
              <web:context-filter
                              regex-url-pattern="/TestAttachmentMTOM.*/>