File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
main/java/org/springframework/ws/wsdl/wsdl11/builder
test/java/org/springframework/ws/wsdl/wsdl11/builder Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 3737import javax .xml .parsers .DocumentBuilderFactory ;
3838import javax .xml .parsers .ParserConfigurationException ;
3939
40+ import org .w3c .dom .Document ;
41+ import org .w3c .dom .Element ;
42+ import org .xml .sax .SAXException ;
43+
4044import org .springframework .beans .factory .InitializingBean ;
4145import org .springframework .core .io .Resource ;
4246import org .springframework .util .Assert ;
4347import org .springframework .util .StringUtils ;
4448import org .springframework .ws .wsdl .wsdl11 .DynamicWsdl11Definition ;
4549import org .springframework .xml .namespace .QNameUtils ;
46- import org .w3c .dom .Document ;
47- import org .w3c .dom .Element ;
48- import org .xml .sax .SAXException ;
4950
5051/**
5152 * Builds a <code>WsdlDefinition</code> with a SOAP 1.1 binding based on an XSD schema. This builder iterates over all
@@ -281,7 +282,7 @@ protected void buildMessages(Definition definition) throws WSDLException {
281282 QName elementName = (QName ) iterator .next ();
282283 if (elementName != null &&
283284 (isRequestMessage (elementName ) || isResponseMessage (elementName ) || isFaultMessage (elementName ))) {
284- if (! StringUtils . hasLength ( definition .getPrefix (elementName .getNamespaceURI ())) ) {
285+ if (definition .getPrefix (elementName .getNamespaceURI ()) == null ) {
285286 int i = 0 ;
286287 while (true ) {
287288 String prefix = schemaPrefix + Integer .toString (i );
Original file line number Diff line number Diff line change 2424
2525import org .custommonkey .xmlunit .XMLTestCase ;
2626import org .custommonkey .xmlunit .XMLUnit ;
27+ import org .w3c .dom .Document ;
28+
2729import org .springframework .core .io .ClassPathResource ;
2830import org .springframework .ws .wsdl .wsdl11 .Wsdl11Definition ;
29- import org .w3c . dom . Document ;
31+ import org .springframework . xml . transform . StringResult ;
3032
3133public class XsdBasedSoap11Wsdl4jDefinitionBuilderTest extends XMLTestCase {
3234
@@ -144,6 +146,20 @@ public void testAirline() throws Exception {
144146 assertXMLEqual ("Invalid WSDL built" , expected , result );
145147 }
146148
149+ public void testNoSchemaPrefix () throws Exception {
150+ builder .setSchema (new ClassPathResource ("single.xsd" , getClass ()));
151+ builder .setPortTypeName ("Order" );
152+ builder .setTargetNamespace ("http://www.springframework.org/spring-ws/single/definitions" );
153+ builder .setSchemaPrefix ("" );
154+ builder .afterPropertiesSet ();
155+
156+ buildAll ();
157+
158+ Wsdl11Definition definition = builder .getDefinition ();
159+
160+ transformer .transform (definition .getSource (), new StringResult ());
161+ }
162+
147163 private void buildAll () {
148164 builder .buildDefinition ();
149165 builder .buildImports ();
You can’t perform that action at this time.
0 commit comments