use of javax.wsdl.BindingOperation in project cxf by apache.
the class WSDLRefValidator method collectValidationPointsForBindings.
private void collectValidationPointsForBindings() throws Exception {
Map<QName, XNode> vBindingNodes = new HashMap<>();
for (Service service : services.values()) {
vBindingNodes.putAll(getBindings(service));
}
for (Map.Entry<QName, XNode> entry : vBindingNodes.entrySet()) {
QName bName = entry.getKey();
Binding binding = this.definition.getBinding(bName);
if (binding == null) {
LOG.log(Level.SEVERE, bName.toString() + " is not correct, please check that the correct namespace is being used");
throw new Exception(bName.toString() + " is not correct, please check that the correct namespace is being used");
}
XNode vBindingNode = getXNode(binding);
vBindingNode.setFailurePoint(entry.getValue());
vNodes.add(vBindingNode);
if (binding.getPortType() == null) {
continue;
}
portTypeRefNames.add(binding.getPortType().getQName());
XNode vPortTypeNode = getXNode(binding.getPortType());
vPortTypeNode.setFailurePoint(vBindingNode);
vNodes.add(vPortTypeNode);
Collection<BindingOperation> bops = CastUtils.cast(binding.getBindingOperations());
for (BindingOperation bop : bops) {
XNode vOpNode = getOperationXNode(vPortTypeNode, bop.getName());
XNode vBopNode = getOperationXNode(vBindingNode, bop.getName());
vOpNode.setFailurePoint(vBopNode);
vNodes.add(vOpNode);
if (bop.getBindingInput() != null) {
String inName = bop.getBindingInput().getName();
if (!StringUtils.isEmpty(inName)) {
XNode vInputNode = getInputXNode(vOpNode, inName);
vInputNode.setFailurePoint(getInputXNode(vBopNode, inName));
vNodes.add(vInputNode);
}
}
if (bop.getBindingOutput() != null) {
String outName = bop.getBindingOutput().getName();
if (!StringUtils.isEmpty(outName)) {
XNode vOutputNode = getOutputXNode(vOpNode, outName);
vOutputNode.setFailurePoint(getOutputXNode(vBopNode, outName));
vNodes.add(vOutputNode);
}
}
for (Iterator<?> iter1 = bop.getBindingFaults().keySet().iterator(); iter1.hasNext(); ) {
String faultName = (String) iter1.next();
XNode vFaultNode = getFaultXNode(vOpNode, faultName);
vFaultNode.setFailurePoint(getFaultXNode(vBopNode, faultName));
vNodes.add(vFaultNode);
}
}
}
}
use of javax.wsdl.BindingOperation in project cxf by apache.
the class WSIBPValidator method checkBinding.
public boolean checkBinding() {
for (PortType portType : wsdlHelper.getPortTypes(def)) {
Iterator<?> ite = portType.getOperations().iterator();
while (ite.hasNext()) {
Operation operation = (Operation) ite.next();
if (isOverloading(operation.getName())) {
continue;
}
BindingOperation bop = wsdlHelper.getBindingOperation(def, operation.getName());
if (bop == null) {
addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2718") + "A wsdl:binding in a DESCRIPTION MUST have the same set of " + "wsdl:operations as the wsdl:portType to which it refers. " + operation.getName() + " not found in wsdl:binding.");
return false;
}
Binding binding = wsdlHelper.getBinding(bop, def);
String bindingStyle = binding != null ? SOAPBindingUtil.getBindingStyle(binding) : "";
String style = StringUtils.isEmpty(SOAPBindingUtil.getSOAPOperationStyle(bop)) ? bindingStyle : SOAPBindingUtil.getSOAPOperationStyle(bop);
if ("DOCUMENT".equalsIgnoreCase(style) || StringUtils.isEmpty(style)) {
boolean passed = checkR2201Input(operation, bop) && checkR2201Output(operation, bop) && checkR2209(operation, bop) && checkR2716(bop);
if (!passed) {
return false;
}
} else {
if (!checkR2717AndR2726(bop)) {
return false;
}
}
}
}
return true;
}
use of javax.wsdl.BindingOperation in project cxf by apache.
the class WSDLToCorbaBindingTest method setTestIdTest.
private void setTestIdTest(Binding binding) {
BindingOperation bindingOp = binding.getBindingOperation("_set_test_id", "_set_test_id", "_set_test_idResponse");
assertEquals("_set_test_id", bindingOp.getName());
assertEquals(1, bindingOp.getExtensibilityElements().size());
assertEquals(bindingOp.getBindingInput().getName(), "_set_test_id");
assertEquals(bindingOp.getBindingOutput().getName(), "_set_test_idResponse");
for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
if (extElement.getElementType().getLocalPart().equals("operation")) {
OperationType corbaOpType = (OperationType) extElement;
assertEquals(corbaOpType.getName(), "_set_test_id");
assertEquals(1, corbaOpType.getParam().size());
assertEquals(corbaOpType.getParam().get(0).getName(), "_arg");
assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
assertEquals(corbaOpType.getParam().get(0).getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
}
}
}
use of javax.wsdl.BindingOperation in project cxf by apache.
the class WSDLToCorbaBindingTest method testVoidTest.
private void testVoidTest(Binding binding) {
BindingOperation bindingOp = binding.getBindingOperation("test_void", "test_void", "test_voidResponse");
assertEquals("test_void", bindingOp.getName());
assertEquals(1, bindingOp.getExtensibilityElements().size());
assertEquals(bindingOp.getBindingInput().getName(), "test_void");
assertEquals(bindingOp.getBindingOutput().getName(), "test_voidResponse");
for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
if (extElement.getElementType().getLocalPart().equals("operation")) {
OperationType corbaOpType = (OperationType) extElement;
assertEquals(corbaOpType.getName(), "test_void");
assertEquals(0, corbaOpType.getParam().size());
}
}
}
use of javax.wsdl.BindingOperation in project cxf by apache.
the class WSDLToCorbaBindingTest method testCORBABindingGeneration.
@Test
public void testCORBABindingGeneration() throws Exception {
String fileName = getClass().getResource("/wsdl/simpleList.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("BasePortType");
Definition model = generator.generateCORBABinding();
QName bName = new QName("http://schemas.apache.org/tests", "BaseCORBABinding", "tns");
Binding binding = model.getBinding(bName);
assertNotNull(binding);
assertEquals("BaseCORBABinding", binding.getQName().getLocalPart());
assertEquals("BasePortType", binding.getPortType().getQName().getLocalPart());
assertEquals(1, binding.getExtensibilityElements().size());
assertEquals(1, binding.getBindingOperations().size());
for (ExtensibilityElement extElement : getExtensibilityElements(binding)) {
if (extElement.getElementType().getLocalPart().equals("binding")) {
BindingType bindingType = (BindingType) extElement;
assertEquals(bindingType.getRepositoryID(), "IDL:BasePortType:1.0");
}
}
Iterator<?> j = binding.getBindingOperations().iterator();
while (j.hasNext()) {
BindingOperation bindingOperation = (BindingOperation) j.next();
assertEquals(1, bindingOperation.getExtensibilityElements().size());
assertEquals(bindingOperation.getBindingInput().getName(), "echoString");
assertEquals(bindingOperation.getBindingOutput().getName(), "echoStringResponse");
for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
if (extElement.getElementType().getLocalPart().equals("operation")) {
OperationType corbaOpType = (OperationType) extElement;
assertEquals(corbaOpType.getName(), "echoString");
assertEquals(3, corbaOpType.getParam().size());
assertEquals(corbaOpType.getReturn().getName(), "return");
assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_STRING);
assertEquals(corbaOpType.getParam().get(0).getName(), "x");
assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
QName qname = new QName("http://schemas.apache.org/tests/corba/typemap/", "StringEnum1", "ns1");
assertEquals(corbaOpType.getParam().get(0).getIdltype(), qname);
}
}
}
}
Aggregations