Is it possible to use the XsdBasedSoap11Wsdl4jDefinitionBuilder for an XSD document that does not have a targetNamespace defined? I have over 100 legacy APIs that I need to expose as web services, and each API has its own schema similar to the following:
I defined the following in the spring application context file:Code:<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="Pref1bs1ListCodeValuesT"> <xsd:complexType> <xsd:choice> <xsd:element name="request"> <xsd:complexType> <xsd:sequence> <xsd:element name="ImportIref1Interface">
But I am getting the following exception:Code:<bean id="pref1bs1ListCodeValuesTWsdl" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition"> <property name="builder"> <bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder"> <property name="schema" value="/wsdl/Pref1bs1ListCodeValuesT.xsd" /> <property name="portTypeName" value="Pref1bs1ListCodeValuesT" /> <property name="schemaPrefix" value="tns" /> <property name="locationUri" value="/services" /> </bean> </property> </bean>
Shannon KendrickCode:---- Begin backtrace for Nested Throwables org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pref1bs1ListCodeValuesTWsdl' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Cannot create inner bean 'org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder#535c535c' of type [org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder] while setting bean property 'builder'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder#535c535c' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: schema document has no targetNamespace Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder#535c535c' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: schema document has no targetNamespace Caused by: java.lang.IllegalArgumentException: schema document has no targetNamespace at org.springframework.util.Assert.hasLength(Assert.java:135) at org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder.parseSchema(XsdBasedSoap11Wsdl4jDefinitionBuilder.java:188) at org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder.afterPropertiesSet(XsdBasedSoap11Wsdl4jDefinitionBuilder.java:172) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)


Reply With Quote