Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Separate WSDLs or a single WSDL for CRUD functions?

  1. #11
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by res1st
    IBut how does it work? I did it like in the echo example and i get this log message
    Don't forget to actually map *.wsdl requests to the DispatcherServlet in your web.xml
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  2. #12
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by mskendrick
    I tried implementing the WSDL dynamic-location solution using WsdlDefinitionHandlerAdapter, and I ran into a slight problem. Apparently the rewrite of the location URL does not include the web context from the request - only the scheme, host, and port is modified. So if I deploy my WAR file to another web context in my app server, then the new context is not picked up.
    Yeah, it doesn't include the context, only the server location. The problem is that I don't know which part of the original location represents the context.
    Suppose we have the following original location in the WSDL:
    Code:
    http://localhost:8080/services/MyService
    The '/services' part can actually be two things: it can be the context path, or it can be the servlet path when the app is deployed in the ROOT context (i.e. a mapping of /service/* in the web.xml). There's no way to tell. If it's the context path, it needs to rewritten with the current context path. If it's the servlet path, it needs to be retained. Do you see the problem?

    So what I originally did was to depend on relative paths in the original location field. That way, I can always add the server information and context path, and it's done. So the original WSDL has to contain a location such as:
    Code:
    /services/MyService
    And I can just prepend the server + context path to it. However, this means that the original WSDL can only be used within a Spring-WS context, and I didn't like that too much. So in the end I opted for the solution we have now.

    I could add the 'relative path' solution, though. Basically, I only have to check whether the location starts with a slash, and then do the magic. Would that solve your problem?
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #13
    Join Date
    Mar 2006
    Location
    Germany, Karlsruhe
    Posts
    157

    Default

    I've already done that, i changed the mapping to
    <servlet-mapping>
    <servlet-name>eimws</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>

    My log is contains the following lines(please look at the bold line):
    Code:
    521697 [http-8080-Processor24] DEBUG handler.SimpleUrlHandlerMapping  - Looking up handler for [/eim.wsdl]
    521697 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Testing handler adapter [org.springframework.ws.transport.http.MessageEndpointHandlerAdapter@f1a58d]
    521697 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Testing handler adapter [org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter@abe515]
    521697 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Last-Modified value for [/eim/eim.wsdl] is [-1]
    521697 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - DispatcherServlet with name 'eimws' received request for [/eim/eim.wsdl]
    521713 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Bound request context to thread: org.apache.catalina.connector.RequestFacade@1ddcb
    521713 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Testing handler adapter [org.springframework.ws.transport.http.MessageEndpointHandlerAdapter@f1a58d]
    521713 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Testing handler adapter [org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter@abe515]
    521760 [http-8080-Processor24] DEBUG http.WsdlDefinitionHandlerAdapter  - Transforming [http://localhost:8080/eim/services] to [http://localhost:8080/eim/services]
    521760 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Null ModelAndView returned to DispatcherServlet with name 'eimws': assuming HandlerAdapter completed request handling
    521760 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1ddcb
    521760 [http-8080-Processor24] DEBUG servlet.DispatcherServlet  - Successfully completed request
    521838 [http-8080-Processor24] DEBUG support.XmlWebApplicationContext  - Publishing event in context [WebApplicationContext for namespace 'eimws-servlet']: ServletRequestHandledEvent: url=[/eim/eim.wsdl]; client=[127.0.0.1]; method=[GET]; servlet=[eimws]; session=[null]; user=[null]; time=[63ms]; status=[OK]
    521838 [http-8080-Processor24] DEBUG support.XmlWebApplicationContext  - Publishing event in context [Root WebApplicationContext]: ServletRequestHandledEvent: url=[/eim/eim.wsdl]; client=[127.0.0.1]; method=[GET]; servlet=[eimws]; session=[null]; user=[null]; time=[63ms]; status=[OK]
    Any idea why he doesn't transform it correctly?

    Ingo

  4. #14
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    See, it works!

    Since a server can be bound to many addresses and names, it's impossible to know which one was used to request the wsdl. Therefore, I use the incoming HttpServletRequest to figure it out.

    I'd say you probably requested http://localhost:8080/eim/eim.wsdl. In order for this to work, you'd have request the WSDL by the non-local IP address, i.e. http://192.168.x.x:8080/eim/eim.wsdl.

    If that doesn't work, then we have a bug, and I need some more information (i.e. the web container you use).
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  5. #15
    Join Date
    Mar 2006
    Location
    Germany, Karlsruhe
    Posts
    157

    Default

    Damn, you are right. I request the wsdl from "http://localhost:8080/eim/eim.wsdl". It's working fine now.

    Thank you,

    Ingo

  6. #16

    Default

    Quote Originally Posted by poutsma
    I could add the 'relative path' solution, though. Basically, I only have to check whether the location starts with a slash, and then do the magic. Would that solve your problem?
    That might be better. I also wonder if there is any way to completely generate the URL (i.e. not use the original source) using the HttpServletRequest and the information in web.xml. Can that be retrieved using the one of the other Servlet APIs?

    Currently my web.xml contains the following:
    Code:
    	<servlet-mapping>
    		<servlet-name>pcc-ws</servlet-name>
    		<url-pattern>/services</url-pattern>
    	</servlet-mapping>
    	<servlet-mapping>
    		<servlet-name>pcc-ws</servlet-name>
    		<url-pattern>/wsdl/PccService.wsdl</url-pattern>
    	</servlet-mapping>
    	<mime-mapping>
    		<extension>xsd</extension>
    		<mime-type>text/xml</mime-type>
    	</mime-mapping>
    	<welcome-file-list>
    		<welcome-file>index.html</welcome-file>
    		<welcome-file>index.jsp</welcome-file>
    	</welcome-file-list>
    Shannon Kendrick

  7. #17
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    I don't think completely generating the URL is possible. The problem is that with both the web.xml and the *-servlet.xml, you're extremely flexible with regard to were handlers are bound. Basically, you can determine which handler an incoming URL handles, but you cannot get a list of all handlers and the URLs they're mapped on. This mostly has to do with the wildcards in both files (e.g. /services/*). So, there's basically now way to determine where the Web services are bound.

    I will implement the relative location fix soon this evening.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  8. #18
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    It's done. Try a nightly build tomorrow. You can now use both absolute paths and relative paths in the location field. From the javadoc:

    If the property transformLocations is set to true, this adapter will change location attributes in the WSDL definition to reflect the URL of the incoming request. If the location
    field in the original WSDL is an absolute path, the scheme, hostname, and port will be changed. If the location is a relative path, the scheme, hostname, port, and context path will be prepended. This behavior can be customized by overriding the transformLocation() method.

    For instance, if the location attribute defined in the WSDL is http://localhost:8080/context/services/myService, and the request URI for the WSDL is http://example.com/context/myService.wsdl, the location will be changed to http://example.com/context/services/myService.

    If the location attribute defined in the WSDL is /services/myService, and the request URI for the WSDL is http://example.com:8080/context/myService.wsdl, the location will be changed to http://example.com:8080/context/services/myService.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  9. #19
    Join Date
    Dec 2006
    Posts
    9

    Default

    Hi,

    could you please post an extract of your Spring configuration, showing declarations of WsdlDefinitionHandlerAdapter, SimpleWsdl11Definition and their mapping ?

    Thanks,
    Damien.

  10. #20
    Join Date
    Mar 2006
    Location
    Germany, Karlsruhe
    Posts
    157

    Default

    Yes i can.
    Cheers,

    Ingo

    Code:
    <bean id="wsdlDefinitionHandlerAdapter" class="org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter">
            <description> ... </description>
            <property name="transformLocations" value="true"/>
        </bean>
    
        <bean id="handlerMapping"
              class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <description>           ...        </description>
            <property name="defaultHandler" ref="messageDispatcher"/>
            <property name="mappings">
                <props>
                    <prop key="/services/*">messageDispatcher</prop>
                    <prop key="/eim.wsdl">eimWsdl</prop>
                </props>
            </property>
        </bean>
    
    
    
    
    <bean id="eimWsdl" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
    	    <description> ... </description>
            <property name="wsdl" value="/eim.wsdl"/>
        </bean>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •