How to locate path of generated wsdl in Spring-ws - spring

I have generated webservice using spring-ws. I have deployed my application in tomcat and deployed without any error. I am not able to find the path for WSDL. Please help me how to form path for wsdl.
My web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>listener><servlet><servlet-name>spring-ws</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class></servlet><servlet-mapping><servlet-name>sprig-ws</servlet-name><url-pattern>/</url-pattern></servlet-mapping> <context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/spring-ws--servlet.xml</param-value></context-param>
spring-ws-servlet.xml
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
<constructor-arg ref="marshaller" />
</bean>
<bean id="marshaller"
class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller">
</bean>
<bean id="loginEndpoint" class="com.cloudexult.endpoint.LoginEndpoint">
</bean>
<sws:dynamic-wsdl id="loginmanager" portTypeName="LoginService" locationUri="/loginService/"
targetNamespace="http://www.example.org/Login/definitions">
<sws:xsd location="/WEB-INF/schema/Login.xsd"/>
</sws:dynamic-wsdl>

Your wsdl should be accessible through:
http://<servername>:<port>/<context-path>/loginService.wsdl
Can you try this and tell us if it doesn't work?

If you are really stuck, enabling log4j to print spring debug logs will help you.
Enable debug logging of spring by following in log4j.properties :
log4j.category.org.springframework=DEBUG
Once that is done, restart your container, look for following in the DEBUG log :
20:51:16,718 DEBUG main http.MessageDispatcherServlet:469 - Published [org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition#61bf8785] as wsdl11Definition.wsdl
Above is just an example, however the last component of the log, will give you the URI of your WSDL.

Related

in spring : how to handle name not found exception in application-context.xml?

I am creating a spring project using Oracle and jboss server.
I have one bean in my application-context.xml.
<!-- Datasource for TaskManager -->
<jee:jndi-lookup id="tmTestDataSource"
jndi-name="test_datasource" expected-type="javax.sql.DataSource"/>
<bean id="tmTestJdbcTemplate" name="TmTestJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg ref="tmTestDataSource" />
</bean>
If the 'test_datasource' JNDI (one datasource.xml file in jboss deployment folder, which contains db credentials like url, uid, password) inside the file found deployment is successfull, but if the file is not there then the deployment is failing.
I want to handle this exception so that deployment should not fail.
how I can do this. Can anybody provide me any solution.
Thanks.

CXF request response logging using log4j: debug

I am trying to enable logging for cxf framework in weblogic application server along with log4j.
I have placed cxf.xml in domain home and have modified setdomainenv to add cxf.xml entry -Dcxf.config.file.url=cxf.xml.
I am setting System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Log4jLogger") before making a webservice call and i have tried configuring all 3 types of configuration specified in http://cxf.apache.org/docs/configuration.html. But nothing seems to work.
I even tried creating org.apache.cxf.Logger file containing value org.apache.cxf.common.logging.Log4jLogger.
my log4j.properties
log4j.rootLogger = DEBUG, FILE
log4j.logger.org.apache.cxf=DEBUG
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=<>/logFile.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.conversionPattern=%m%n
CXF version: 2.7.5
Please suggest if there is change required for me to log both request and response xml?
Make sure your org.apache.cxf.Logger file is under META-INF/cxf. Inspect your war to make sure.
Also, assuming you are defining your services using jaxws, make sure you're defining loggers under the jaxws:inInterceptor and jaxws:outInterceptor
<jaxws:client id="..." serviceClass="..." address="..." >
<jaxws:outInterceptors>
<ref bean="logOut" />
</jaxws:outInterceptors>
<jaxws:inInterceptors>
<ref bean="logIn"/>
</jaxws:inInterceptors>
</jaxws:client>
<bean class='org.apache.cxf.interceptor.LoggingInInterceptor' id='logIn'/>
<bean class='org.apache.cxf.interceptor.LoggingOutInterceptor' id='logOut'/>

Spring Security fails on WebXmlMappableAttributesRetriever

I have a Spring-Web-App that fails when I try to deploy it to my local tomcat since I've added Spring-security.
I used the securty-web-auth with a preauth filter. The RolesRetriever fails with fallowing Error-Message
class path resource [WEB-INF/web.xml] cannot be opened because it does not exist
But the web.xml exists and worked before the security setup.
<bean id="j2eeMappableRolesRetriever"
class="org.springframework.security.web.authentication.preauth.j2ee.WebXmlMappableAttributesRetriever">
<property name="resourceLoader" ref="webAppContext" />
</bean>
<bean id="webAppContext"
class="org.springframework.web.context.support.GenericWebApplicationContext" />
Has someone and idea, why it fails? It must be within the WebAppContext-Bean but I have no Idea where to set the right path to web.xml

PropertyPlaceholderConfigurer does not find property file on disk

I am trying to move a working spring WAR to OSGI environment (in glassfish 3.1 and blueprint, spring 3.0.5).
The application loads properties file from disk, like this:
<bean id="myProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="${my_conf}/my.properties"/>
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
</bean>
I see in debugger that ${my_conf}/my.properties is translated to the existing path (c:\conf\my.properties)
I use the property jms.url defined in my.properties in the next bean declaration
<amq:broker useJmx="false" persistent="false" brokerName="embeddedbroker">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://${jms.url}"/>
<amq:transportConnector uri="vm://embeddedbroker" />
</amq:transportConnectors>
</amq:broker>
And in deployment I get an exception "Could not resolve placeholder ${jms.url}"
Why it fails? Is there another way to load properties from file on disk?
thank you
Since its an OSGI environment, you will need spring-osgi-core jar added to your application. Take a look at this link to configure property-placeholder for OSGI framework.
It isn't a solution, but an explanation of my problem.
The problem is related to this bug in spring 3 and osgi.
I had to open spring logs to debug level to understand it.

Spring PropertyPlaceholderConfigurer not replacing placeholder

I want to pass the WSDL url for an internal web service into my Spring beans.xml dynamically, using a PropertyPlaceHolderConfigurer.
Here's the scenario:
My web application is deployed in WebLogic 10.3.
The WSDL url is contained in a properties file that is located outside my application (directly under the corresponding domain folder, while my application is inside the autodeploy folder). I set the location of this properties file in my domain's setDomainEnv.cmd file like below:
set JAVA_PROPERTIES=%JAVA_PROPERTIES% %CLUSTER_PROPERTIES% -Dproperty.file.path.config=%DOMAIN_HOME%\Service.properties
This is what my Service.properties file contains:
Service.WSDL.PATH=http://localhost:8088/mockServiceSoap?WSDL
My Spring beans.xml configuration:----
<bean id="file.path" class="java.lang.System" factory-method="getProperty">
<constructor-arg index="0"><value>property.file.path.config</value></constructor-arg>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" ref="file.path"/>
</bean>
<bean id="myServiceId" class="com.test.service.ServiceImpl">
<property name="myServiceSoap">
<ref bean="myService"/>
</property>
</bean>
<bean id="myService" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="com.test.service.ServiceSoap"/>
<property name="wsdlDocumentUrl" value="${Service.WSDL.PATH}"/>
</bean>
I enabled DEBUG log specifically for PPC and this is what I saw in my application log:
INFO org.springframework.beans.factory.config.PropertyPlaceholderConfigurer 178 - Loading properties file from URL [file:D:/bea10.3/user_projects/domains/my_domain/Service.properties]
So, it seems that although the Service.properties file is getting loaded by PPC, the ${Service.WSDL.PATH} is NOT getting replaced.
What am I doing wrong here?
Also, how can I find out if PPC tried replacing the value of the placeholder and with what value? I was hoping the log file would contain that info but there was nothing there.
Any help is appreciated.
I've figured out, that PropertyPlaceholderConfigurer needs to be declared first in the application Context file, otherwise there's no guarantee of the load order. It took me a few hours to realize this.
Try moving the "file.path" bean into the PropertyPlaceHolderConfigurer's location property.

Resources