1 Reply Latest reply on Oct 23, 2007 4:26 AM by Giuseppe Moscardelli

    AOP with web service

    Giuseppe Moscardelli Newbie

      Hi I heve developed a web service for jbossws and I would apply an aspect to the methods of this web service.
      I have written the aspect code and the xml file for jbossaop and I have installed jboss aop on jboss4.2.1 following the jboss aop instruction (I've copied this directory jboss-aop-jdk50.deployer in the deploy directory of jboss4.2.1).
      My war file is composed so:

      directory META-INF:

      directory WEB-INF:
      -file web.xml;
      -file jboss-aop.xml;
      +directory classes:
      -file jboss-aop.xml;
      +directory xml:
      -XMLJDomWriterStat.class
      -XMLSaxReaderStat.class
      +directory services:
      -ServiceAOP.class;
      -ServiceAOPAspect.class.

      My web.xml file is so composed:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <web-app version="2.5"
       xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      
       <servlet>
       <servlet-name>ServiceAOP</servlet-name>
       <servlet-class>service.ServiceAOP</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>ServiceAOP</servlet-name>
       <url-pattern>/*</url-pattern>
       </servlet-mapping>
      
      </web-app>
      


      My jboss-aop.xml is the following:
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <aop>
       <aspect class="service.ServiceAOPAspect" scope="PER_VM"/>
       <bind pointcut="execution(public double service.ServiceAOP-&gt;fattoriale(int))">
       <advice aspect="service.ServiceAOPAspect" name="statistics"/>
       </bind>
      </aop>
      


      What have I to do for running aop on web service?
      Thanks all, bye bye.

        • 1. Re: AOP with web service
          Giuseppe Moscardelli Newbie

          Hi, I've modified my war file in this way:

          In META-INF directory there is the file:
          jboss-aop.xml, this file is only in this place;

          In WEB-INF:
          directory WEB-INF:
          -file web.xml;
          +directory classes:
          +directory xml:
          -XMLJDomWriterStat.class
          -XMLSaxReaderStat.class
          +directory services:
          -ServiceAOP.class;
          -ServiceAOPAspect.class;
          -ServiceAOP$fattoriale_9086071828619756113.class (this class was generated by jboss aop ide with eclipse automatically).

          When I try to invoke a method of the web service, also a method whitout a binding with the aspect I receive this error:

          Exception in thread "main" AxisFault
           faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
           faultSubcode:
           faultString: org.xml.sax.SAXParseException: Premature end of file.
           faultActor:
           faultNode:
           faultDetail:
           {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file.
           at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
           at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
           at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
           at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
           at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230)
           at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798)
           at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
           at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
           at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
           at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
           at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
           at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
           at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
           at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
           at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
           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)
           at clientLett.ServiceLettBindingStub.fattoriale(ServiceLettBindingStub.java:117)
           at Test.main(Test.java:38)
          
           {http://xml.apache.org/axis/}hostname:angelinux
          
          org.xml.sax.SAXParseException: Premature end of file.
           at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
           at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
           at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
           at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
           at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
           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)
           at clientLett.ServiceLettBindingStub.fattoriale(ServiceLettBindingStub.java:117)
           at Test.main(Test.java:38)
          Caused by: org.xml.sax.SAXParseException: Premature end of file.
           at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
           at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
           at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
           at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
           at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230)
           at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798)
           at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
           at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
           at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
           at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
           at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
           at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
           ... 10 more
          


          Why? How can I resolve?
          Thanks, bye bye.