-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented support for complexContent/restriction Fixed: membrane/api-gateway#180 SchemaCreator: Added support for complexContent/@mixed Added support for anyType restriction
- Loading branch information
Showing
9 changed files
with
171 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
core/src/main/groovy/com/predic8/schema/restriction/AnyTypeRestriction.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Copyright 2012 predic8 GmbH, www.predic8.com | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
package com.predic8.schema.restriction; | ||
|
||
import com.predic8.wstool.creator.* | ||
|
||
class AnyTypeRestriction extends BaseRestriction { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
core/src/test/groovy/com/predic8/wsdl/WSDLInlineSchemaTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.predic8.wsdl | ||
|
||
import groovy.xml.MarkupBuilder | ||
|
||
import com.predic8.wsdl.creator.WSDLCreator | ||
import com.predic8.wsdl.creator.WSDLCreatorContext | ||
import com.predic8.xml.util.ClasspathResolver | ||
import com.predic8.schema.creator.* | ||
|
||
class WSDLInlineSchemaTest extends GroovyTestCase { | ||
|
||
Definitions wsdl | ||
WSDLParserContext ctx = new WSDLParserContext(input: 'wsdl/inline-schema-in-wsdl/test.wsdl') | ||
|
||
protected void setUp() throws Exception { | ||
WSDLParser parser = new WSDLParser(resourceResolver: new ClasspathResolver()) | ||
wsdl = parser.parse(ctx) | ||
} | ||
|
||
void testThatSchemaInsideWSDLCanBeRead() { | ||
def strWriter = new StringWriter() | ||
def creator = new SchemaCreator(builder : new MarkupBuilder(strWriter)) | ||
wsdl.schemas[0].create(creator, new SchemaCreatorContext()) | ||
def schemaAsString = strWriter.toString() | ||
def testSchema = new XmlSlurper().parseText(schemaAsString) | ||
assertEquals('xsd:anyType', testSchema.complexType[0].complexContent.restriction.@base.toString()) | ||
} | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
core/src/test/resources/wsdl/inline-schema-in-wsdl/test.wsdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<definitions name="HelloService" | ||
targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl" | ||
xmlns="http://schemas.xmlsoap.org/wsdl/" | ||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" | ||
xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
|
||
<types> | ||
|
||
<schema targetNamespace="http://www.example.com/IPO" | ||
attributeFormDefault="unqualified" | ||
elementFormDefault="unqualified" | ||
xmlns="http://www.w3.org/2001/XMLSchema"> | ||
|
||
<simpleType name="SKU2"> | ||
<restriction base="string"/> | ||
</simpleType> | ||
|
||
<complexType name="SKU"> | ||
<complexContent> | ||
<restriction base="anyType"/> | ||
</complexContent> | ||
</complexType> | ||
|
||
</schema> | ||
|
||
</types> | ||
|
||
<message name="SayHelloRequest"> | ||
<part name="firstName" type="SKU"/> | ||
</message> | ||
|
||
<message name="SayHelloResponse"> | ||
<part name="greeting" type="string"/> | ||
</message> | ||
|
||
<portType name="Hello_PortType"> | ||
<operation name="sayHello"> | ||
<input message="tns:SayHelloRequest"/> | ||
<output message="tns:SayHelloResponse"/> | ||
</operation> | ||
</portType> | ||
|
||
<binding name="Hello_Binding" type="tns:Hello_PortType"> | ||
<soap:binding style="rpc" | ||
transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<operation name="sayHello"> | ||
<soap:operation soapAction="sayHello"/> | ||
<input> | ||
<soap:body | ||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" | ||
namespace="urn:examples:helloservice" | ||
use="encoded"/> | ||
</input> | ||
|
||
<output> | ||
<soap:body | ||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" | ||
namespace="urn:examples:helloservice" | ||
use="encoded"/> | ||
</output> | ||
</operation> | ||
</binding> | ||
|
||
<service name="Hello_Service"> | ||
<documentation>WSDL File for HelloService</documentation> | ||
<port binding="tns:Hello_Binding" name="Hello_Port"> | ||
<soap:address | ||
location="http://www.examples.com/SayHello/" /> | ||
</port> | ||
</service> | ||
</definitions> |