Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/* 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.wsdl;
import groovy.xml.QName
import javax.xml.namespace.QName as JQName
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.predic8.policy.*
import com.predic8.soamodel.*
import com.predic8.wsdl.http.HTTPBinding
import com.predic8.wsdl.soap11.SOAPBinding as SOAP11Binding
import com.predic8.wsdl.soap12.SOAPBinding as SOAP12Binding
import com.predic8.xml.util.*
class Binding extends WSDLElement{
private static final Logger log = LoggerFactory.getLogger(Binding.class)
public static final JQName ELEMENTNAME = new JQName(Consts.WSDL11_NS, 'binding')
PortType portType
List operations = []
String typePN
QName type
AbstractBinding binding
NoneSOAPBinding noneSOAPBinding
PolicyReference policyReference
Binding(){
// Default constructor
}
public Binding(String name) {
this.name = name
}
protected parseAttributes(token, WSDLParserContext ctx){
name = token.getAttributeValue(null , 'name')
typePN = token.getAttributeValue(null , 'type')
}
protected parseChildren(token, child, WSDLParserContext ctx) {
log.debug "found binding: ${token.name}"
super.parseChildren(token, child, ctx)
switch (token.name ) {
case {it.namespaceURI in Consts.POLICY_NAMESPACES && it.localPart == 'PolicyReference'}:
policyReference = new PolicyReference(ELEMENTNAME: token.name)
policyReference.parse(token, ctx) ; break
case SOAP11Binding.ELEMENTNAME :
log.debug "is soap11"
binding = new SOAP11Binding(definitions: definitions, binding: this)
binding.parse(token, ctx) ; break
case SOAP12Binding.ELEMENTNAME :
binding = new SOAP12Binding(definitions: definitions, binding: this)
binding.parse(token, ctx) ; break
case Operation.ELEMENTNAME:
def operation = new BindingOperation(definitions : definitions, binding: this)
operation.parse(token, ctx)
operations << operation ; break
case HTTPBinding.ELEMENTNAME :
binding = new HTTPBinding(definitions : definitions)
binding.parse(token, ctx) ; break
case {it.localPart == 'binding'}:
noneSOAPBinding = new NoneSOAPBinding(namespace : token.name.namespaceURI); break
}
}
QName getType() {
if(type) return type
type = getTypeQName(typePN)
}
BindingOperation getOperation(String name){
operations.find{it.name == name}
}
PortType getPortType(){
definitions.getPortType(getType())
}
def getProtocol() {
binding?.getProtocol()
}
/**
* Analyzes and returns the style/use attribute of the binding.
* @return The style/use combination of a WSDL binding as string
*/
String getStyle(){
binding?.checkStyle()['result']
}
/**
* Returns a list of errors, if there are some in the binding style.
* Each error is a hash map.
* @return List of style errors.
*/
List