Announcement Announcement Module
No announcement yet.
Problem Getting Static Content Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem Getting Static Content

    I'm trying to access static content through the MessageDispatcherServlet, but not having any luck. I followed the echo example and placed an index.html under my project directory and added the welcome-file-list in my web.xml. When I try and access (http://localhost:9999/my-app-ws/index.html) the page, I get an "HTTP 405 - Resource not allowed" error. Is there a configuration that I'm missing?

    Here's the HTTP that's getting sent

    GET /my-app-ws/index.html HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/, application/, application/msword, application/x-shockwave-flash, */*
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 1.1.4322)
    Host: localhost:9999
    Connection: Keep-Alive
    Here's the response

    HTTP/1.1 405 Method Not Allowed
    Date: Tue, 03 Jul 2007 17:09:41 GMT
    Server: WebLogic Server 8.1 SP3 Tue Jun 29 23:11:19 PDT 2004 404973 
    Content-Length: 0

  • #2
    If you have same servlet mapping as web.xml included in Echo sample:
    then all requests will be processed by spring-ws which doesn't take .../index.html


    • #3
      I see in the code where it only excepts POST and wsdl GET now. So what would I use to send static data? Do I need to implement my own servlet?

      54          if ("POST".equals(httpServletRequest.getMethod())) {
      55              WebServiceConnection connection = new HttpServletConnection(httpServletRequest, httpServletResponse);
      56              handleConnection(connection, (WebServiceMessageReceiver) handler);
      57              return null;
      58          }
      59          else {
      60              httpServletResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      61              return null;
      62          }
      193         if ("GET".equals(request.getMethod()) && request.getRequestURI().endsWith(WSDL_SUFFIX_NAME)) {
      194             String fileName = WebUtils.extractFilenameFromUrlPath(request.getRequestURI());
      195             return (WsdlDefinition) wsdlDefinitions.get(fileName);
      196         }
      197         else {
      198             return null;
      199         }
      My real problem is with the auto generated WSDL I have a type library that I import into my application schema and the WSDL that's generated contains the relative path and doesn't automatically load the type library into the main schema. This would be fine, but when I try and use the generated WSDL (for example with soapUI) it trys to download the type library and it can't because of the above issue.

      Here a sample WSDL. The schemaLocation is a relative path and is not loaded in the auto generated WSDL.

      - <wsdl:types>
      - <xsd:schema xmlns:xsd="" xmlns="" xmlns:s1="" elementFormDefault="unqualified" targetNamespace="http://www.sample/sample">
        <xsd:import namespace="" schemaLocation="../sample/sample.xsd" /> 
        <xsd:element name="TestRequest" type="s1:name" /> 
      When I try to import using soapUI, I get the following error. The ".." is applied to the root rather than relative path to the schema that is importing it.

      Tue Jul 03 10:53:56 EDT 2007:DEBUG:Returning baseURI [http://localhost:7001/sample-ws/sample.wsdl]
      Tue Jul 03 10:53:56 EDT 2007:DEBUG:Returning baseURI [http://localhost:7001/sample-ws/sample.wsdl]
      Tue Jul 03 10:53:56 EDT 2007:DEBUG:Getting wsdl component from [http://localhost:7001/sample-ws/sample.wsdl]
      Tue Jul 03 10:53:56 EDT 2007:DEBUG:Getting wsdl component from [http://locahost:7001/sample/sample.xsd]
      Tue Jul 03 10:53:56 EDT 2007:ERROR:Loading of definition failed for [http://localhost:7001/sample-ws/sample.wsdl]; org.apache.xmlbeans.XmlException: error: Unexpected element: TAG_END
      Tue Jul 03 10:53:56 EDT 2007:ERROR:Error importing wsdl: org.apache.xmlbeans.XmlException: error: Unexpected element: TAG_END


      • #4
        Originally posted by lgothard View Post
        Do I need to implement my own servlet?
        You could change the url pattern of your MessageDispatcherServlet to not match the names of your static files. That way, your request would be handled by your servlet container's default servlet, which serves static files all right (at least that's how it works on Tomcat using DefaultServlet).


        • #5
          Thank you. This works. The equivalent to DefaultServlet in Weblogic is FielServlet. Has anyone used


          I'm wondering if this would be used instead. I can't seem to fiind any examples and what I tried didn't seem to work.

          The only problem I have now is with the schemaLocation. I currently have the following in my application schema.

          <xsd:import namespace="" schemaLocation="http://localhost:7001/my-app/xsd/common/types.xsd" />
          This has to be changed when deployed to different servers. Does anyone know a way to make this dynamic? I'm thinking I'll have to make this part of the build process somehow.