Announcement Announcement Module
Collapse
No announcement yet.
Newbie 404 Endpoint Mapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie 404 Endpoint Mapping

    This is my first time using Spring and it's been a very long time since I've dealt with servlets, so please bear with me.

    I've written a web service using Endpoint/PayloadRoot annotation named OSBSEndpoint. OSBSService is defined in osbs-webapp-config.xml. The problem I'm running into is getting it mapped properly. When I bring up Tomcat running in Eclipse, the log says it instantiates everything fine and there are no errors. But so far, I've gotten nothing but 404s no matter what I've tried. This goes for the dynamic wsdl as well as the service.

    Any help is appreciated in figuring this out.

    Here's the config:

    web.xml
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
                 version="2.4">
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>/WEB-INF/osbs-webapp-config.xml</param-value>
    	</context-param>
    
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<display-name>osbs</display-name>
    	<servlet>
    		<servlet-name>osbs</servlet-name>
    		<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>
    				/WEB-INF/osbs-servlet-config.xml
    			</param-value>
    		</init-param>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>osbs</servlet-name>
    		<url-pattern>/*</url-pattern>
    	</servlet-mapping>
    
    </web-app>
    osbs-servlet-config.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:tx="http://www.springframework.org/schema/tx"
                    xsi:schemaLocation="http://www.springframework.org/schema/beans
                                                            http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    <!-- Endpoint mapping config -->
    	<bean id="osbsEndpoint" class="com.mavericklabel.osbs.OSBSEndpoint">
    		<constructor-arg ref="osbsService"/>
    	</bean>
    
    	<!--bean id="endpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    		<property name="mappings">
    			<props>
    				<prop key="process">osbsEndpoint</prop>
    			</props>
    		</property>
        </bean-->
    	<bean id="endpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
    
    <!-- Dynamic WSDL -->
    	<bean id="osbs" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
    			<property name="builder">
    				<bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
    				<property name="schema" value="/WEB-INF/schemas/smb-502.xsd"/>
    				<property name="portTypeName" value="osbs"/>
    				<property name="locationUri" value="http://localhost:8080/osbs/"/>
    			</bean>
    		</property>
    	</bean>
    
    </beans>

  • #2
    Can you also post your server-side log?

    Comment


    • #3
      Certainly:

      Code:
      Oct 21, 2007 11:33:51 PM org.apache.catalina.core.AprLifecycleListener init
      INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
      Oct 21, 2007 11:33:51 PM org.apache.coyote.http11.Http11Protocol init
      INFO: Initializing Coyote HTTP/1.1 on http-8080
      Oct 21, 2007 11:33:51 PM org.apache.catalina.startup.Catalina load
      INFO: Initialization processed in 1104 ms
      Oct 21, 2007 11:33:51 PM org.apache.catalina.core.StandardService start
      INFO: Starting service Catalina
      Oct 21, 2007 11:33:51 PM org.apache.catalina.core.StandardEngine start
      INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
      Oct 21, 2007 11:33:52 PM org.apache.catalina.core.ApplicationContext log
      INFO: Initializing Spring root WebApplicationContext
      - Root WebApplicationContext: initialization started
      - Refreshing [email protected]e8a298: display name [Root WebApplicationContext]; startup date [Sun Oct 21 23:33:52 EDT 2007]; root of context hierarchy
      - Loading XML bean definitions from ServletContext resource [/WEB-INF/osbs-webapp-config.xml]
      - Loading XML bean definitions from class path resource [com/mavericklabel/suitetalk/bean-config.xml]
      - Bean factory for application context [[email protected]e8a298]: org.springframework.beans.factory.support.DefaultListableBeanFactory@95c81
      - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@95c81: defining beans [netsuitePort,org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter,marshaller,osbsService,passport]; root of factory hierarchy
      - Creating JAXBContext with context path [com.mavericklabel.osbs.beans]
      - Root WebApplicationContext: initialization completed in 28092 ms
      Oct 21, 2007 11:34:20 PM org.apache.coyote.http11.Http11Protocol start
      INFO: Starting Coyote HTTP/1.1 on http-8080
      Oct 21, 2007 11:34:21 PM org.apache.jk.common.ChannelSocket init
      INFO: JK: ajp13 listening on /0.0.0.0:8009
      Oct 21, 2007 11:34:21 PM org.apache.jk.server.JkMain start
      INFO: Jk running ID=0 time=0/109  config=null
      Oct 21, 2007 11:34:21 PM org.apache.catalina.startup.Catalina start
      INFO: Server startup in 29632 ms

      Comment


      • #4
        Well, if that's the entire log, then it seems like no request ever makes it to Spring-WS. Otherwise you would have seen some further messages. Can you check by going to the webservice with your browser? Something like http://localhost:8080/osbs ?

        Comment


        • #5
          When I go to http://localhost:8080/osbs, I get:

          HTTP Status 404 - /osbs

          type Status report

          message /osbs

          description The requested resource (/osbs) is not available.

          Apache Tomcat/6.0.14

          but nothing shows in console. After turning on access logging, I was able to see:

          Code:
          0:0:0:0:0:0:0:1%0 - - [22/Oct/2007:13:20:21 -0400] "GET /osbs HTTP/1.1" 404 967
          127.0.0.1 doesn't do any better except to change the IP in the log, as one would hope.

          Comment


          • #6
            As I suspected, I was missing something. I'm using the WST plugin to run the servlet. When accessing the url with this plugin, you need to include the project name in the url. For instance: http://localhost:8080/OSBSServlet/osbs instead of http://localhost:8080/osbs.

            Comment


            • #7
              HTTP 404 Error - Issue

              Have deployed our Spring-WS on Weblogic 9.2 on Windows environment. The spring-ws jars have been copied to server lib directory. The the app. is deployed at the webcontext caobshared. There were no issues while deploying. Am testing the service from a soapUI tool. The url I am using is http://localhost:7002/caobshared/services. I do not see any errors or any debug statements I have in the webservice methods in the server log. Believe I am missing something or specifying incorrectly.
              We need to make a decision on using Spring-WS soon, based on the POC I working on. Any help or suggestions highly appreciated.

              web.xml file:

              <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
              http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
              version="2.4">

              <display-name>CAOB Shared Service</display-name>

              <!-- take especial notice of the name of this servlet -->
              <servlet>
              <servlet-name>caob-shared</servlet-name>
              <servlet-class>org.springframework.ws.transport.http.Messag eDispatcherServlet</servlet-class>
              <init-param>
              <param-name>transformWsdlLocations</param-name>
              <param-value>true</param-value>
              </init-param>
              </servlet>

              <servlet-mapping>
              <servlet-name>caob-shared</servlet-name>
              <url-pattern>/services</url-pattern>
              </servlet-mapping>
              <servlet-mapping>
              <servlet-name>caob-shared</servlet-name>
              <url-pattern>*.wsdl</url-pattern>
              </servlet-mapping>

              </web-app>


              caob-shared-servlet.xml file:

              <?xml version="1.0" encoding="UTF-8"?>
              <beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:util="http://www.springframework.org/schema/util"
              xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">

              <!-- ===================== ENDPOINTS ===================================== -->

              <!--
              The marshallingEndpoint handle the messages.
              -->

              <bean id="documentationService" class="com.boea.caob.ws.documentation.Documentatio nService"/>

              <bean id="documentationServiceEndpoint" class="com.boea.caob.ws.DocumentationServiceEndpoi nt">
              <description>
              This endpoint handles the DocumentService Web Service messages using JAXB2 marshalling.
              </description>
              <constructor-arg ref="documentationService"/>
              </bean>

              <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
              <description>
              The JAXB 2 Marshaller is used by the endpoints.
              </description>
              <property name="contextPath" value="com.boea.jaxb.caob.documentation.ws.jaxb"/>
              </bean>

              <!-- ===================== ENDPOINT MAPPINGS ============================== -->

              <!-- ===================== ENDPOINT ADAPTERS ============================== -->

              <!--
              Endpoint adapters adapt from the incoming message to a specific object or method signature. Because this
              example application uses three different endpoint programming models, we have to define three adapters. This
              is done for illustration purposes only, typically you would use one adapter, for instance the
              MarshallingMethodEndpointAdapter.
              -->

              <bean class="org.springframework.ws.server.endpoint.adap ter.MarshallingMethodEndpointAdapter">
              <description>
              This adapter allows for methods that need and returns marshalled objects. The MarshallingEndpoint
              uses JAXB 2 objects.
              </description>
              <constructor-arg ref="marshaller"/>
              </bean>

              <!-- ===================== WSDL DEFINITION ============================== -->
              <!-- Exposing a static WSDL -->
              <!--
              <bean id="documentService" class="org.springframework.ws.wsdl.wsdl11.SimpleWs dl11Definition">
              <constructor-arg value="/xsd/DocumentService.wsdl"/>
              </bean>
              -->

              <!-- Dynamically creating a WSDL from an XSD -->
              <bean id="documentService" class="org.springframework.ws.wsdl.wsdl11.DynamicW sdl11Definition">
              <description>
              Dynamically builds a WSDL from the DocumentService.xsd.This bean definition represents the DocumentService.wsdl file found
              in the root of the web application. It is used
              by the WsdlDefinitionHandlerAdapter in caob-shared-servlet.xml.
              </description>
              <property name="builder">
              <bean class="org.springframework.ws.wsdl.wsdl11.builder. XsdBasedSoap11Wsdl4jDefinitionBuilder">
              <property name="schema" value="/xsd/DocumentService.xsd"/>
              <property name="portTypeName" value="DocumentationPort"/>
              <property name="locationUri" value="http://localhost:8080/documentation/services"/>
              <property name="targetNamespace"
              value="http://www.test.com/caob/webservices/documentation/definitions"/>
              </bean>
              </property>
              </bean>

              </beans>

              Thanks
              Sunil

              Comment


              • #8
                "sunil_g1", you did the right thing by starting your question in it's own thread. Rather than appending it to another conversation.

                I replied there...
                http://forum.springframework.org/showthread.php?t=45331

                Comment

                Working...
                X