6 Replies Latest reply on Apr 15, 2008 12:11 PM by ericjava.eric.chiralsoftware.net

    http 405 error with seam web services - help required

    wiggy

      getting a http 405 a simple web services test .


      I have a very simple test out to try and get WS running before piling into proper use - got stuck!


      i am using a jboss tools SEAM project.  I have a file called standard-jaxws-endpoint-config.xml in my xx-ejb META-INF directory as follows


      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <!-- webservice seam SOAP handler profile -->
      
      <jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
      
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
      xmlns:javaee="http://java.sun.com/xml/ns/javaee"
      
      xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
      
           <endpoint-config>
      
                <config-name>Seam WebService Endpoint</config-name>
      
                <pre-handler-chains>
      
                     <javaee:handler-chain>
      
                          <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
      
                          <javaee:handler>
      
                               <javaee:handler-name>SOAP Request Handler</javaee:handler-name>
      
                               <javaee:handler-class>org.jboss.seam.webservice.SOAPRequestHandler</javaee:handler-class>
      
                          </javaee:handler>
      
                     </javaee:handler-chain>
      
                </pre-handler-chains>
      
           </endpoint-config>
      
      </jaxws-config>
      
      



      my test is then very easy heres the code .


      
      package org.domain.wstest.webservices;
      
      
      import java.util.List;
      
      
      import javax.ejb.Stateless;
      
      import javax.jws.WebMethod;
      
      import javax.jws.WebResult;
      
      import javax.jws.WebService;
      
      
      
      import org.jboss.seam.Component;
      
      
      @Stateless
      
      @WebService (name="HelloService", serviceName="HelloService" )
      
      public class HelloServiceBean implements HelloService
      
      {
      
           @WebMethod (operationName="sayHello")
      
           @WebResult (name="helloResult")
      
           public String hello ()
      
           {
      
                return "hello World";
      
           }
      
      }
      
      



      when i deploy to the server, the server queitly creates the wsdl.  I had to find it in the log - some theres probably someway to stipulate where you'd wish to put it.  for me it put the wsdl in


      
      
      E:\jboss\jboss-4.2.2.GA\server\default\data\wsdl\wstest2-ear.ear\wstest2-ejb.jar\HelloService17933.wsdl
      
      
      



      i open the wsdl in a browser and i have following entry can be found near the bottom .


      ...
      
      
      - <service name="HelloService">
      
      - <port name="HelloServicePort" binding="tns:HelloServiceBinding">
      
        <soap:address location="http://127.0.0.1:8080/wstest2-ear-wstest2-ejb/HelloServiceBean" /> 
      
        </port>
      
        </service>
      
      



      I then start the ws explorer in eclipse and paste in the service location as noted above.


      This then errors with


      
      IWAB0379E Unable to open http://127.0.0.1:8080/wstest2-ear-wstest2-ejb/HelloServiceBean.
      
      IWAB0135E An unexpected error has occurred.
      
      WSDLException
      
      WSDLException: faultCode=OTHER_ERROR: Server returned HTTP response code: 405 for URL: http://127.0.0.1:8080/wstest2-ear-wstest2-ejb/HelloServiceBean
      
      
      



      and i cant use my service -


      what have i done wrong here ?



             



       

        • 1. Re: http 405 error with seam web services - help required

          Go to http://127.0.0.1:8080/jbossws/ and check if the service is availible there. It should be.

          • 2. Re: http 405 error with seam web services - help required
            wiggy

            okay - i went to the /jboss viewer as you mentioned.


            I can see the service their - so i copied that url and pasted into the eclipse ws monitor and it worked better but not completly.


            It can see the test method and formulates a SOAP packet to post - however the response doesnt work I get an error like this .


            first heres the submitted request - I think this looks okay though there is no SOAP header generated in the window


            
            - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://webservices.wstest2.domain.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            
            - <soapenv:Body>
            
              <q0:sayHello /> 
            
              </soapenv:Body>
            
              </soapenv:Envelope>
            
            



            the errored response from eclipse just shows


            Not sure what this is trying to tell me - any ideas


            
            The XML page cannot be displayed 
            
            Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. 
            
            
            
            --------------------------------------------------------------------------------
            
            
            XML document must have a top level element. Error processing resource 'http://localhost:54332/wsexplorer/wsdl/soap_envelope...
            
            
             
            
            




            and the error on the server console had the following error


            
            21:01:08,750 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
            
            java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
            
                 at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)
            
                 at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:67)
            
                 at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:207)
            
                 at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:185)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:389)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
            
                 at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
            
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            
                 at java.lang.Thread.run(Unknown Source)
            
            21:01:08,750 ERROR [RequestHandlerImpl] Error processing web service request
            
            org.jboss.ws.WSException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
            
                 at org.jboss.ws.WSException.rethrow(WSException.java:68)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:310)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
            
                 at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
            
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            
                 at java.lang.Thread.run(Unknown Source)
            
            Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
            
                 at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)
            
                 at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:67)
            
                 at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:161)
            
                 at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.toSOAPMessage(SOAPFaultHelperJAXWS.java:232)
            
                 at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:161)
            
                 at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
            
                 at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:645)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:430)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
            
                 ... 22 more
            
            21:01:08,750 ERROR [[HelloServiceBean]] Servlet.service() for servlet HelloServiceBean threw exception
            
            java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
            
                 at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)
            
                 at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:67)
            
                 at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:161)
            
                 at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.toSOAPMessage(SOAPFaultHelperJAXWS.java:232)
            
                 at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:161)
            
                 at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
            
                 at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:645)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:430)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
            
                 at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
            
                 at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
            
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            
                 at java.lang.Thread.run(Unknown Source)
            
            

             

            • 3. Re: http 405 error with seam web services - help required
              wiggy

              Okay - i really dont think i understand how the web services bits work.


              I have created a test client to see if i can call the webservice previously created - this is still published as a WSDL at


              
              
              http://127.0.0.1:8080/wstest2-ear-wstest2-ejb/HelloServiceBean?wsdl
              
              
              



              I then have a simple ejb project (so i can use dependency injection from a managed class to get my WS - cant get the eclipse WSDL explorer to work - see previous).  like this


              
              package test;
              
              
              import javax.ejb.Stateless;
              
              import javax.xml.ws.WebServiceRef;
              
              
              //included wstest2-ejb as depdent project to get import
              
              import org.domain.wstest2.webservices.HelloServiceBean;
              
              import org.domain.wstest2.webservices.*;
              
              
              @Stateless
              
              public class TestHelloBean implements TestHelloService, TestHelloServiceRemote 
              
              {
              
              
                   @WebServiceRef (HelloServiceBean.class)
              
                   private HelloServiceBean helloService;
              
                   
              
                   public String sayHello()
              
                   {
              
                        String res = helloService.hello();
              
                        return res;
              
                   }
              
              }
              
              



              I set the java build path for the ejb to include the wstest-ejb project (which is part of the wstest2-ejb project) that builds the webservice (that i cant use properly from eclipse wsdl explorer - see earlier errors)


              This allows the code to compile (i've tried using an interface defn rather than the private HelloServiceBean attribute with similar failures)


              when i deploy the ejb to the server it fails with NoClassDefFOundError see below.


              The documentation I see in books or seam ref manual make this sound easy - sadly for mere mortals i dont find it so.


              Can some one help me how to overcome this (both from eclipse wsdl viewer, and or test client using @webServiceRef


              I really need to get this going as I have to expose some methods to a colleague on a test project - and cant proceed at present


              Thanks in advance


              
              
              22:52:33,362 WARN  [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=wsTestClient.jar
              
              java.lang.NoClassDefFoundError: Lorg/domain/wstest2/webservices/HelloServiceBean;
              
                   at java.lang.Class.getDeclaredFields0(Native Method)
              
                   at java.lang.Class.privateGetDeclaredFields(Unknown Source)
              
                   at java.lang.Class.getDeclaredFields(Unknown Source)
              
                   at org.jboss.injection.InjectionUtil.processFieldAnnotations
              
              
              ...
              
              
              Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.domain.wstest2.webservices.HelloServiceBean
              
                   at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
              
                   at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
              
                   at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
              
                   at java.lang.ClassLoader.loadClass(Unknown Source)
              
                   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
              
                   ... 74 more
              
              22:52:33,362 INFO  [EJB3Deployer] Deployed: file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/wsTestClient.jar/
              
              22:52:33,362 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
              
              
              --- Incompletely deployed packages ---
              
              org.jboss.deployment.DeploymentInfo@e2aae4cd { url=file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/wstest2-ear.ear/ }
              
                deployer: org.jboss.deployment.EARDeployer@523be
              
                status: null
              
                state: FAILED
              
                watch: file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/wstest2-ear.ear/
              
                altDD: null
              
                lastDeployed: 1206913077322
              
                lastModified: 1206913075720
              
                mbeans:
              
              
              --- MBeans waiting for other MBeans ---
              
              ObjectName: jboss.j2ee:service=EJB3,module=wsTestClient.jar
              
                State: FAILED
              
                Reason: java.lang.NoClassDefFoundError: Lorg/domain/wstest2/webservices/HelloServiceBean;
              
              
              --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
              
              ObjectName: jboss.j2ee:service=EJB3,module=wsTestClient.jar
              
                State: FAILED
              
                Reason: java.lang.NoClassDefFoundError: Lorg/domain/wstest2/webservices/HelloServiceBean;
              
              
              
              



              and here is the genderated WSDL from the EAR deploy


              
              - <definitions name="HelloService" targetNamespace="http://webservices.wstest2.domain.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservices.wstest2.domain.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
              
              - <types>
              
              - <xs:schema targetNamespace="http://webservices.wstest2.domain.org/" version="1.0" xmlns:tns="http://webservices.wstest2.domain.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
              
                <xs:element name="sayHello" type="tns:sayHello" /> 
              
                <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" /> 
              
              - <xs:complexType name="sayHello">
              
                <xs:sequence /> 
              
                </xs:complexType>
              
              - <xs:complexType name="sayHelloResponse">
              
              - <xs:sequence>
              
                <xs:element minOccurs="0" name="helloResult" type="xs:string" /> 
              
                </xs:sequence>
              
                </xs:complexType>
              
                </xs:schema>
              
                </types>
              
              - <message name="HelloServiceWS_sayHelloResponse">
              
                <part element="tns:sayHelloResponse" name="sayHelloResponse" /> 
              
                </message>
              
              - <message name="HelloServiceWS_sayHello">
              
                <part element="tns:sayHello" name="sayHello" /> 
              
                </message>
              
              - <portType name="HelloServiceWS">
              
              - <operation name="sayHello" parameterOrder="sayHello">
              
                <input message="tns:HelloServiceWS_sayHello" /> 
              
                <output message="tns:HelloServiceWS_sayHelloResponse" /> 
              
                </operation>
              
                </portType>
              
              - <binding name="HelloServiceWSBinding" type="tns:HelloServiceWS">
              
                <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
              
              - <operation name="sayHello">
              
                <soap:operation soapAction="" /> 
              
              - <input>
              
                <soap:body use="literal" /> 
              
                </input>
              
              - <output>
              
                <soap:body use="literal" /> 
              
                </output>
              
                </operation>
              
                </binding>
              
              - <service name="HelloService">
              
              - <port binding="tns:HelloServiceWSBinding" name="HelloServiceWSPort">
              
                <soap:address location="http://127.0.0.1:8080/wstest2-ear-wstest2-ejb/HelloService" /> 
              
                </port>
              
                </service>
              
                </definitions>
              
              

              • 4. Re: http 405 error with seam web services - help required
                shane.bryzak

                I recommend you ask on the JBossWS forums, there's nothing Seam-related within your issue as far as I can tell, and there's probably a lot more knowledgeable people there that can help you diagnose your problem.  Once you get the basic web service working, then you can add Seam to the mix.

                • 5. Re: http 405 error with seam web services - help required
                  meetoblivion

                  As with Shane, jboss ws would be your best bet.


                  I don't know if it helps, but did you run the ws scripts (in jboss home/bin) to create all of the necessary files?  Your first error seems to indicate that this wasn't run.


                  Your second error is because the classes for your ws end up in a different classloader from your client.


                  starting from deploy dir, you have 2: client and server.  client can't see server's classes, so you need a client for the server generated containing the stubs.

                  • 6. Re: http 405 error with seam web services - help required
                    ericjava.eric.chiralsoftware.net

                    Nothing to do with your code.  You're running on Java 1.6 and you're hitting a problem with incompatible JAXB implementations.  The instructions say make sure you have jaxb-api.jar in the endorsed dirs but that's not enough.


                    I posted a blog entry about setProperty must be overridden by all subclasses of SOAPMessage.