I am trying to set up SOAP on Spring WS and now i configure Spring beans with file like this:
<?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:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.blog.samples.services" />
<sws:annotation-driven />
<!--
Our test service bean
-->
<bean id="AccountDetailsService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true">
<property name="schemaCollection">
<bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="inline" value="true" />
<property name="xsds">
<list>
<value>schemas/AccountDetailsServiceOperations.xsd</value>
</list>
</property>
</bean>
</property>
<property name="portTypeName" value="AccountDetailsService"/>
<property name="serviceName" value="AccountDetailsServices" />
<property name="locationUri" value="/endpoints"/>
</bean>
</beans>
Unfortunatly i have not xsd, i have only wsdl which described my service. The question is : may i use somehow my wsdl in this spring configuration file? If yes - how (use wsdl instead of wsdl)? I know that i can extract xsd from wsdl, but would like to use only wsdl. Thank you.
You could use SimpleWsdl11Definition instead of DefaultWsdl11Definition:
Via XML:
<sws:static-wsdl id="operations" location="[your_location]/[your_wsdl].wsdl"/>
Via Java config:
@Bean(name = "operations")
public SimpleWsdl11Definition wsdl11Definition() {
SimpleWsdl11Definition s = new SimpleWsdl11Definition();
s.setWsdl(new ClassPathResource("[your_location]/[your_wsdl].wsdl"));
return s;
}
"id" respectively bean-name is the identifier on how your .wsdl can be accessed. In the case above:
http://[your_server]/[url_mapping_from_message_dispatcher]/operations.wsdl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With