private SOAPBody getSOAPBody(boolean input) { List elements = null; if (input) { BindingInput bindingInput = bindingOp.getBindingInput(); if (bindingInput == null) { return null; } elements = bindingInput.getExtensibilityElements(); } else { BindingOutput bindingOutput = bindingOp.getBindingOutput(); if (bindingOutput == null) { return null; } elements = bindingOutput.getExtensibilityElements(); } return getExtensibilityElement(elements, SOAPBody.class); }
private BindingInput getBindingInput(Input input, String operationName) throws ToolException { BindingInput bi = wsdlDefinition.createBindingInput(); bi.setName(input.getName()); //This ext element in some scenario is optional, but if provided, won't cause error bi.addExtensibilityElement(getXMLBody(BindingInput.class, operationName)); return bi; }
throws WSDLException BindingOperation bindingOperation = def.createBindingOperation(); bindingOperation.setName(name); bindingOperation.setDocumentationElement(tempEl); bindingOperation.setBindingInput(parseBindingInput(tempEl, def)); BindingOutput bindingOutput = bindingOperation.getBindingOutput(); String inputName = (bindingInput != null ? (bindingInput.getName() != null ? bindingInput.getName() : Constants.NONE) : null); String outputName = (bindingOutput != null ? (bindingOutput.getName() != null ? bindingOutput.getName() : Constants.NONE) : null); Operation op = portType.getOperation(name, inputName, outputName); Input input = def.createInput(); Output output = def.createOutput();
protected void printBindingInput(BindingInput bindingInput, Definition def, PrintWriter pw) throws WSDLException { if (bindingInput != null) { String tagName = DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL, Constants.ELEM_INPUT, def); pw.print(" <" + tagName); DOMUtils.printAttribute(Constants.ATTR_NAME, bindingInput.getName(), pw); printExtensibilityAttributes(BindingInput.class, bindingInput, def, pw); pw.println('>'); printDocumentation(bindingInput.getDocumentationElement(), def, pw); List extElements = bindingInput.getExtensibilityElements(); printExtensibilityElements(BindingInput.class, extElements, def, pw); pw.println(" </" + tagName + '>'); } }
throws WSDLException BindingInput bindingInput = def.createBindingInput(); bindingInput.setName(name); bindingInput.setDocumentationElement(tempEl); bindingInput.addExtensibilityElement( parseExtensibilityElement(BindingInput.class, tempEl, def));
WSDLBindingFactory wFactory = (WSDLBindingFactory)factory; bi = wFactory.createBindingInfo(service, binding, ns.toString()); copyExtensors(bi, binding.getExtensibilityElements()); copyExtensionAttributes(bi, binding); bi = new BindingInfo(service, ns.toString()); bi.setName(binding.getQName()); copyExtensors(bi, binding.getExtensibilityElements()); copyExtensionAttributes(bi, binding); for (BindingOperation bop : cast(binding.getBindingOperations(), BindingOperation.class)) { if (LOG.isLoggable(Level.FINER)) { LOG.finer("binding operation name is " + bop.getName()); if (bop.getBindingInput() != null) { inName = bop.getBindingInput().getName(); if (bop.getBindingOutput() != null) { outName = bop.getBindingOutput().getName(); copyExtensionAttributes(bop2, bop); if (bop.getBindingInput() != null) { copyExtensors(bop2.getInput(), bop.getBindingInput().getExtensibilityElements()); copyExtensionAttributes(bop2.getInput(), bop.getBindingInput()); handleHeader(bop2.getInput());
protected BindingInfo initializeBindingInfo(ServiceInfo service, Binding binding, BindingInfo bi) { bi.setName(binding.getQName()); copyExtensors(bi, binding, null); for (BindingOperation bop : cast(binding.getBindingOperations(), BindingOperation.class)) { String inName = null; String outName = null; if (bop.getBindingInput() != null) { inName = bop.getBindingInput().getName(); if (bop.getBindingOutput() != null) { outName = bop.getBindingOutput().getName(); String portTypeNs = binding.getPortType().getQName().getNamespaceURI(); QName opName = new QName(portTypeNs, bop.getName()); BindingOperationInfo bop2 = bi.getOperation(opName); + " must have a name attribute."); copyExtensors(bop2.getFault(new QName(service.getTargetNamespace(), f.getName())), bop.getBindingFault(f.getName()), bop2);
throws AxisFault { copyExtensibleElements(wsdl4jBinding.getExtensibilityElements(), bindingWSDL, axisBinding, BINDING); List wsdl4jBidingOperations = wsdl4jBinding.getBindingOperations(); addDocumentation(axisBinding, wsdl4jBinding.getDocumentationElement()); wsdl4jOperation = findOperation(portType, wsdl4jBindingOperation); axisBindingOperation.setName(new QName(bindingWSDL.getTargetNamespace(), wsdl4jBindingOperation.getName())); addDocumentation(axisBindingOperation, wsdl4jBindingOperation.getDocumentationElement()); AxisBindingMessage axisBindingInMessage = new AxisBindingMessage(); axisBindingInMessage.setParent(axisBindingOperation); addDocumentation(axisBindingInMessage, wsdl4jBindingInput.getDocumentationElement()); copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(), wsdl4jDefinition, axisBindingInMessage, BINDING_OPERATION_INPUT); AxisBindingMessage axisBindingOutMessage = new AxisBindingMessage(); axisBindingOutMessage.setParent(axisBindingOperation); addDocumentation(axisBindingOutMessage, wsdl4jBindingInput.getDocumentationElement()); copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(), wsdl4jDefinition, axisBindingOutMessage, BINDING_OPERATION_OUTPUT);
List ops = port.getBinding().getBindingOperations(); Iterator opIt = ops.iterator(); while (opIt.hasNext()) { BindingOperation op = (BindingOperation)opIt.next(); BindingInput bindingInput = op.getBindingInput(); List elements = bindingInput.getExtensibilityElements(); QName qn = new QName(def.getTargetNamespace(), op.getName()); for (Iterator i = elements.iterator(); i.hasNext();) { Object element = i.next(); SOAPBody body = (SOAPBody)element; if (body.getNamespaceURI() != null) { qn = new QName(body.getNamespaceURI(), op.getName()); DataBindingCallback.Mode.PARTS); callbackMap.put(qn, cb); if (!"".equals(cb.getRequestWrapperQName().getLocalPart())) { callbackMap.put(cb.getRequestWrapperQName(), cb);
&& (bindingOp.getOperation().getInput() != null)) name = bindingOp.getOperation().getName(); extensibles = bindingOp.getBindingInput().getExtensibilityElements(); && (bindingOp.getOperation().getOutput() != null)) name = bindingOp.getOperation().getName() + "Response"; extensibles = bindingOp.getBindingOutput().getExtensibilityElements(); checkOperation = new QName(name); else checkOperation = new QName(soapBody.getNamespaceURI(), name); if (operation != null && operation.equals(checkOperation))
protected void buildBindingInput(Definition def, BindingOperation bindingOperation, BindingMessageInfo bindingMessageInfo) { BindingInput bindingInput = null; if (bindingMessageInfo != null) { bindingInput = def.createBindingInput(); addDocumentation(bindingInput, bindingMessageInfo.getDocumentation()); bindingInput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart()); bindingOperation.setBindingInput(bindingInput); addExtensibilityAttributes(def, bindingInput, bindingMessageInfo.getExtensionAttributes()); addExtensibilityElements(def, bindingInput, getWSDL11Extensors(bindingMessageInfo)); } }
private void addWrapperRoot(XMLMessage xmlMessage, DataBindingCallback callback) throws WSDLException { BindingOperation operation = getBindingOperation(callback.getOperationName()); BindingInput input = operation.getBindingInput(); TBody xmlBinding = null; Iterator ite = input.getExtensibilityElements().iterator(); while (ite.hasNext()) { Object obj = ite.next(); if (obj instanceof TBody) { xmlBinding = (TBody)obj; } } if (needRootNode(operation, false)) { if (xmlBinding == null || xmlBinding.getRootNode() == null) { throw new XMLBindingException("Bare style must define the rootNode in this case!"); } QName rootNode = xmlBinding.getRootNode(); Document doc = xmlMessage.getRoot(); String targetNamespace = rootNode.getNamespaceURI() == null ? callback.getTargetNamespace() : rootNode.getNamespaceURI(); Element operationNode = doc.createElementNS(targetNamespace, rootNode.getLocalPart()); xmlMessage.appendChild(operationNode); } }
throws WSDLException, AxisFault { Input input = def.createInput(); Message msg = writeRequestMessage(def, desc, bindingOper); String name = msg.getQName().getLocalPart(); bindingOper.getBindingInput().setName(name); oper.setInput(input); def.addMessage(msg); Output output = def.createOutput(); name = msg.getQName().getLocalPart(); bindingOper.getBindingOutput().setName(name); oper.setOutput(output); def.addMessage(msg); oper.addFault(fault); bindingOper.addBindingFault(bFault);
String targetNamespace = wsdl.getTargetNamespace(); String localName = logicalBinding.getParent().getUri().getFragment(); QName serviceName = new QName(targetNamespace, localName); String localPortName = localName + "Port"; Binding binding = copy.createBinding(); binding.setPortType(copy.getPortType(contract.getPortType().getQName())); binding.setQName(new QName(targetNamespace, localName + "Binding")); soapBinding.setTransportURI(HTTP_TRANSPORT); binding.addExtensibilityElement(soapBinding); bindingOperation.setName(operation.getName()); bindingOperation.addExtensibilityElement(soapOperation); soapBody.setUse("literal"); input.addExtensibilityElement(soapBody); bindingOperation.setBindingInput(input); outSoapBody.setUse("literal"); output.addExtensibilityElement(outSoapBody); QName portName = new QName(targetNamespace, localPortName);
/** * This method will process a WSDL Binding and build AttachmentDescription objects if the * WSDL dicatates attachments. */ public static void getAttachmentFromBinding(OperationDescriptionImpl opDesc, Binding binding) { if (binding != null) { Iterator bindingOpIter = binding.getBindingOperations().iterator(); while (bindingOpIter.hasNext()) { BindingOperation bindingOp = (BindingOperation) bindingOpIter.next(); // found the BindingOperation that matches the current OperationDescription if (bindingOp.getName().equals(opDesc.getName().getLocalPart())) { if (bindingOp.getBindingInput() != null) { if (log.isDebugEnabled()) { log.debug("Processing binding opertion input"); } processBindingForMIME(bindingOp.getBindingInput().getExtensibilityElements(), opDesc, bindingOp.getOperation(), true); } if (bindingOp.getBindingOutput() != null) { if (log.isDebugEnabled()) { log.debug("Processing binding output"); } processBindingForMIME(bindingOp.getBindingOutput().getExtensibilityElements(), opDesc, bindingOp.getOperation(), false); } } } } }
public Message generateInputMessage(Operation operation, BindingOperation bindingOperation) { Message msg = definition.createMessage(); QName msgName; if (!mapper.isDefaultMapping()) { //mangle the message name //REVISIT, do we put in the entire scope for mangling msgName = new QName(definition.getTargetNamespace(), getScope().tail() + "." + operation.getName()); } else { msgName = new QName(definition.getTargetNamespace(), operation.getName()); } msg.setQName(msgName); msg.setUndefined(false); String inputName = operation.getName() + REQUEST_SUFFIX; Input input = definition.createInput(); input.setName(inputName); input.setMessage(msg); BindingInput bindingInput = definition.createBindingInput(); bindingInput.setName(inputName); bindingOperation.setBindingInput(bindingInput); operation.setInput(input); definition.addMessage(msg); return msg; }
javax.wsdl.BindingOperation wbindOp = def.createBindingOperation(); soapOp.setSoapActionURI(getSoapAction(op)); BindingInput bindIn = def.createBindingInput(); bindIn.setName( op.getInputMessage().getName().getLocalPart() ); bindIn.addExtensibilityElement( body ); wbindOp.setBindingInput( bindIn ); if (wsdlOp.getOutput() != null) BindingOutput bindOut = builder.getDefinition().createBindingOutput(); bindOut.setName( wsdlOp.getOutput().getName() ); bindOut.addExtensibilityElement( body ); wbindOp.setBindingOutput( bindOut ); Map faults = wsdlOp.getFaults(); if (faults != null) wbindOp.addBindingFault(bindingFault);
@SuppressWarnings("unchecked") private boolean checkXMLFormat(Binding binding) { List<BindingOperation> bos = binding.getBindingOperations(); boolean result = true; boolean needRootNode = false; for (BindingOperation bo : bos) { Operation op = binding.getPortType().getOperation(bo.getName(), null, null); needRootNode = false; if (op.getInput().getMessage().getParts().size() == 0 || op.getInput().getMessage().getParts().size() > 1) { needRootNode = true; String path = "Binding(" + binding.getQName().getLocalPart() + "):BindingOperation(" + bo.getName() + ")"; Iterator itIn = bo.getBindingInput().getExtensibilityElements().iterator(); if (findXMLFormatRootNode(itIn, bo, path + "-input")) { if (op.getOutput().getMessage().getParts().size() == 0 || op.getOutput().getMessage().getParts().size() > 1) { needRootNode = true; Iterator itOut = bo.getBindingInput().getExtensibilityElements().iterator(); result = result && findXMLFormatRootNode(itOut, bo, path + "-Output");
public boolean isValid() { Collection<Binding> bindings = CastUtils.cast(def.getAllBindings().values()); for (Binding binding : bindings) { uniqueBodyPartsMap = new HashMap<>(); List<BindingOperation> ops = CastUtils.cast(binding.getBindingOperations()); for (BindingOperation op : ops) { Operation operation = op.getOperation(); if (operation != null && operation.getInput() != null) { Message inMessage = operation.getInput().getMessage(); BindingInput bin = op.getBindingInput(); Set<String> headers = new HashSet<>(); if (bin != null) { List<ExtensibilityElement> lst = CastUtils.cast(bin.getExtensibilityElements()); for (ExtensibilityElement ext : lst) { if (!(ext instanceof SOAPHeader)) { if (!header.getMessage().equals(inMessage.getQName())) { continue; if (inMessage != null && !isUniqueBodyPart(operation.getName(), inMessage, headers, binding.getQName())) { return false;
.getOperation().getInput().getMessage() .getOrderedParts(null).get(0)).getElementName() .getNamespaceURI(); } catch (Exception e) { result = getDefinition().getTargetNamespace(); List extElements = binding.getBindingInput() .getExtensibilityElements(); if (extElements != null && extElements.size() > 0) { SOAPBody body = (SOAPBody) extElements.get(0); result = body.getNamespaceURI(); } else { extElements = binding.getBindingOutput() .getExtensibilityElements(); if (extElements != null && extElements.size() > 0) { SOAPBody body = (SOAPBody) extElements.get(0); result = getDefinition().getTargetNamespace();