Spring WS requestElement vs HTTP request
Hello there,
We use Spring WS as poor as it can be. We have a simple configuration calling an xsdBuilder and an endpoint object. (class: WsEndpoint).
The xsdBuilder class is used for generating a wsdl dynamically and the endpoint object is used for creating dynamicaly a response.
In fact, we only use the spring WS framework to get things up and running so clients can get a wsdl and do a service call.
The dynamic generated response message depends on the url which is called to get to the webservice. I.e. http://localhost:8080/services/test
the first part (http://localhost:8080/services) is mapped in the configuration to an endpoint class (WsEndpoint). The last part of the url (test) is used to call different methods which generate a response for a specific request.
The question is: How can i get the url within the endpoint (class: WsEndpoint) object?
I use the following endpoint construction:
public class WsEndpoint extends AbstractDomPayloadEndpoint {
protected Element invokeInternal(Element requestElement, Document incomingDocument) throws Exception {
}
etc.
}
The nearest we can get is an (empty) attribute list in the requestElement and some specific variables like localname/nameSpaceUri etc. etc. and a nearly clean incomingDocument object.
How can i retrieve the called url i.e. "http://localhost:8080/services/test"
so i can determine 'test' and call the correct method to generate a response.
The configuration file is:
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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="wsEndpoint"
class="nl.company.services.springws.endpoint.WsEndpoint">
</bean>
<bean id="payloadMapping"
class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
<property name="defaultEndpoint" ref="wsEndpoint" />
</bean>
<bean id="xsdBuilder"
class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
<property name="builder">
<bean
class="nl.company.services.springws.xsdbuilder.XSDBuilder">
</bean>
</property>
</bean>
</beans>
Greets,
Herbert te Lintelo