private String createResourceName(String noun, BindingOperationInfo bopWithParts) { StringBuilder builder = new StringBuilder(); builder.append(noun); for (MessagePartInfo part : bopWithParts.getInput().getMessageParts()) { if (isXSDPrimitive(part)) { builder.append("/{").append(part.getName().getLocalPart()).append("}"); } } return builder.toString(); }
private boolean checkBindingOperationInOut(BindingMessageInfo bmi) { if ((bmi.getMessageInfo() != null) && (bmi.getMessageInfo().getName() != null) && (bmi.getBindingOperation() != null) && (bmi.getBindingOperation().getName() != null) && (bmi.getBindingOperation().getBinding() != null) && (bmi.getBindingOperation().getBinding().getName() != null)) { if ((Type.INPUT == bmi.getMessageInfo().getType()) && wsdl11XPointer.matchesBindingOperationInput( bmi.getMessageInfo().getName().getNamespaceURI(), bmi.getBindingOperation().getBinding().getName().getLocalPart(), bmi.getBindingOperation().getName().getLocalPart())) { return true; } if ((Type.OUTPUT == bmi.getMessageInfo().getType()) && wsdl11XPointer.matchesBindingOperationOutput( bmi.getMessageInfo().getName().getNamespaceURI(), bmi.getBindingOperation().getBinding().getName().getLocalPart(), bmi.getBindingOperation().getName().getLocalPart())) { return true; } } return false; }
private void handleHeader(BindingMessageInfo bindingMessageInfo) { // mark all message part which should be in header List<ExtensibilityElement> extensiblilityElement = bindingMessageInfo .getExtensors(ExtensibilityElement.class); // for non-soap binding, the extensiblilityElement could be null if (extensiblilityElement == null) { return; } // for (ExtensibilityElement element : extensiblilityElement) { // LOG.info("the extensibility is " + element.getClass().getName()); // if (element instanceof SOAPHeader) { // LOG.info("the header is " + ((SOAPHeader)element).getPart()); // } // } }
private boolean hasRootNode(BindingMessageInfo bmi, QName elName) { XMLBindingMessageFormat xmf = bmi.getExtensor(XMLBindingMessageFormat.class); return bmi.getMessageParts().size() != 1 && xmf != null && xmf.getRootNode().equals(elName); } }
private boolean checkPortTypeOperationInOut(BindingMessageInfo bmi) { InterfaceInfo ini = null; if ((bmi.getBindingOperation() != null) && (bmi.getBindingOperation().getOperationInfo() != null)) { ini = bmi.getBindingOperation().getOperationInfo().getInterface(); } if ((ini != null) && (ini.getName() != null) && (bmi.getMessageInfo() != null) && (bmi.getBindingOperation() != null) && (bmi.getBindingOperation().getName() != null)) { if ((Type.INPUT == bmi.getMessageInfo().getType()) && wsdl11XPointer.matchesPortTypeOperationInput( ini.getName().getNamespaceURI(), ini.getName().getLocalPart(), bmi.getBindingOperation().getName().getLocalPart())) { return true; } if ((Type.OUTPUT == bmi.getMessageInfo().getType()) && wsdl11XPointer.matchesPortTypeOperationOutput( ini.getName().getNamespaceURI(), ini.getName().getLocalPart(), bmi.getBindingOperation().getName().getLocalPart())) { return true; } } return false; }
OperationInfo op = itr.next(); boi = ep.getEndpointInfo().getBinding().getOperation(op); if (boi == null) { continue; msgInfo = boi.getOutput(); } else { msgInfo = boi.getInput(); Collection<MessagePartInfo> bodyParts = msgInfo.getMessageParts(); if (bodyParts.isEmpty() || bodyParts.size() <= index) { itr.remove(); MessagePartInfo p = msgInfo.getMessageParts().get(index); if (name.getNamespaceURI() == null || name.getNamespaceURI().isEmpty()) { name = new QName(p.getMessageInfo().getName().getNamespaceURI(), name.getLocalPart()); if (Constants.XSD_ANYTYPE.equals(p.getTypeQName())) { lastChoice = p; lastBoi = boi; setMessage(message, lastBoi, client, lastBoi.getBinding().getService(), lastMsgInfo.getMessageInfo());
private void initializeMessage(SoapBindingInfo bi, BindingOperationInfo boi, BindingMessageInfo bmsg) { MessageInfo msg = bmsg.getMessageInfo(); messageParts.addAll(msg.getMessageParts()); SOAPBindingUtil.getSoapHeaders(bmsg.getExtensors(ExtensibilityElement.class)); if (headers != null) { for (SoapHeader header : headers) { headerInfo.setPart(part); messageParts.remove(part); bmsg.addExtensor(headerInfo); bmsg.setMessageParts(messageParts); SoapBody soapBody = SOAPBindingUtil.getSoapBody(bmsg.getExtensors(ExtensibilityElement.class)); MIMEMultipartRelated mmr = bmsg.getExtensor(MIMEMultipartRelated.class); if (mmr != null) { parts = mmr.getMIMEParts(); bmsg.addExtensor(soapBody); bodyInfo.setUse(soapBody.getUse()); parts = soapBody.getParts(); bmsg.addExtensor(bodyInfo);
+ bmsg.getBindingOperation().getName().getLocalPart() + " does not specify a part."); msg.getMessagePart(new QName(msg.getName().getNamespaceURI(), partName)); mpi.setProperty(Message.CONTENT_TYPE, mc.getType()); attParts.add(mpi); bmsg.getMessageParts().remove(mpi); } else if (SOAPBindingUtil.isSOAPBody(content)) { SoapBody sb = SOAPBindingUtil.getSoapBody(content); + bmsg.getBindingOperation().getName().getLocalPart() + " does not specify a part."); msg.getMessagePart(new QName(msg.getName().getNamespaceURI(), header.getPart())); && !mpi.getMessageInfo().getName().equals(header.getMessage())) { mpi = null; headerInfo.setPart(mpi); messageParts.remove(mpi); bmsg.getMessageParts().remove(mpi); bmsg.addExtensor(headerInfo);
Element bodyElement = (Element) element.getElementsByTagNameNS( element.getNamespaceURI(), soapVersion.getBody().getLocalPart()).item(0); if (bodyElement != null) { element = DomUtil.getFirstChildElement(bodyElement); QName opeName = new QName(element.getNamespaceURI(), element.getLocalName()); SoapBindingInfo binding = (SoapBindingInfo) ei.getBinding(); for (BindingOperationInfo op : binding.getOperations()) { String style = binding.getStyle(op.getOperationInfo()); if (style == null) { style = binding.getStyle(); BindingMessageInfo msg = op.getInput(); if (msg.getExtensor(SoapBodyInfo.class) .getParts().get(0).getElementQName().equals(opeName)) { boi = op; exchange.setOperation(new QName(boi.getName().getNamespaceURI(), opeName.getLocalPart())); break;
protected BindingOperationInfo findOperation(String suffix) { BindingInfo bi = client.getEndpoint().getBinding().getBindingInfo(); for (BindingOperationInfo boi : bi.getOperations()) { SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class); String soapAction = soi != null ? soi.getAction() : null; Object o = boi.getOperationInfo().getInput() .getExtensionAttribute(new QName("http://www.w3.org/2007/05/addressing/metadata", "Action")); if (o instanceof QName) { o = ((QName)o).getLocalPart(); Conduit conduit = client.getConduit(); EffectivePolicy effectivePolicy = pe.getEffectiveClientRequestPolicy(client.getEndpoint().getEndpointInfo(), boi, conduit, PhaseInterceptorChain.getCurrentMessage()); for (BindingOperationInfo boi : bi.getOperations()) { if (suffix.endsWith(boi.getName().getLocalPart())) { return boi; for (BindingOperationInfo boi : bi.getOperations()) { if (boi.getInput().getMessageInfo().getMessagePartsNumber() > 0) { MessagePartInfo mpi = boi.getInput().getMessageInfo().getFirstMessagePart(); if ("RequestSecurityToken".equals(mpi.getConcreteName().getLocalPart())) { return boi;
private BindingOperationInfo getOperation(Message message, QName opName) { BindingOperationInfo bop = ServiceModelUtil.getOperation(message.getExchange(), opName); if (bop == null) { Endpoint ep = message.getExchange().getEndpoint(); if (ep == null) { return null; } BindingInfo service = ep.getEndpointInfo().getBinding(); boolean output = !isRequestor(message); for (BindingOperationInfo info : service.getOperations()) { if (info.getName().getLocalPart().equals(opName.getLocalPart())) { SoapBody body = null; if (output) { body = info.getOutput().getExtensor(SoapBody.class); } else { body = info.getInput().getExtensor(SoapBody.class); } if (body != null && opName.getNamespaceURI().equals(body.getNamespaceURI())) { return info; } } } } return bop; } public void handleMessage(Message message) {
List<SoapHeaderInfo> headers = msg.getExtensors(SoapHeaderInfo.class); for (SoapHeaderInfo header : headers) { if (partsContent.size() == 0) { if (header.getPart().getConcreteName().getNamespaceURI().equals( nl.item(0).getNamespaceURI()) && header.getPart().getConcreteName().getLocalPart() .equals(nl.item(0).getLocalName())) { headerList.add(new Header(header.getPart().getConcreteName(), nl.item(0))); partsContent.remove(0);
List<SoapHeaderInfo> headerInfos = b.getInput().getExtensors(SoapHeaderInfo.class); if (headerInfos != null && !headerInfos.isEmpty()) { bodyParts = new ArrayList<>(); for (MessagePartInfo part : b.getInput().getMessageParts()) { bodyParts.add(part.getName().getLocalPart()); BindingInput.class, isSoap12); soapHeader.setMessage(b.getInput().getMessageInfo().getName()); soapHeader.setPart(headerInfo.getPart().getName().getLocalPart()); soapHeader.setUse("literal"); bodyParts.remove(headerInfo.getPart().getName().getLocalPart()); headerInfo.getPart().setProperty(HEADER, true); b.getInput().addExtensor(soapHeader); b.getInput().addExtensor(body); List<SoapHeaderInfo> headerInfos = b.getOutput().getExtensors(SoapHeaderInfo.class); if (headerInfos != null && !headerInfos.isEmpty()) { bodyParts = new ArrayList<>(); for (MessagePartInfo part : b.getOutput().getMessageParts()) { BindingOutput.class, isSoap12); soapHeader.setMessage(b.getOutput().getMessageInfo().getName()); b.getOutput().addExtensor(soapHeader); b.getOutput().addExtensor(body);
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)); } }
protected String addOperationNode(NSStack nsStack, Message message, XMLStreamWriter xmlWriter, boolean output, BindingOperationInfo boi) throws XMLStreamException { String ns = boi.getName().getNamespaceURI(); SoapBody body = null; if (output) { body = boi.getOutput().getExtensor(SoapBody.class); } else { body = boi.getInput().getExtensor(SoapBody.class); } if (body != null) { final String nsUri = body.getNamespaceURI(); //do it once, as it might internally use reflection... if (!StringUtils.isEmpty(nsUri)) { ns = nsUri; } } nsStack.add(ns); String prefix = nsStack.getPrefix(ns); String name = output ? boi.getName().getLocalPart() + "Response" : boi.getName().getLocalPart(); StaxUtils.writeStartElement(xmlWriter, prefix, name, ns); return ns; }
@Override public boolean appliesTo(BindingMessageInfo bmi) { if (bmi == null) { return false; } if ((bmi.getMessageInfo() != null) && (bmi.getMessageInfo().getName() != null) && wsdl11XPointer.matchesMessage( bmi.getMessageInfo().getName().getNamespaceURI(), bmi.getMessageInfo().getName().getLocalPart())) { return true; } if (checkBindingOperationInOut(bmi)) { return true; } return checkPortTypeOperationInOut(bmi); }
private void setTypeAttr(XMLStreamWriter xmlWriter, Message message) throws XMLStreamException { BindingOperationInfo wsdlOperation = getOperation(message); BindingMessageInfo wsdlMessage = isRequestor(message) ? wsdlOperation.getInput() : wsdlOperation.getOutput(); String typeNamespace = wsdlMessage.getMessageInfo().getName().getNamespaceURI(); if (typeNamespace == null || typeNamespace.length() == 0) { throw new IllegalArgumentException("messageType namespace is null or empty"); } xmlWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":" + "msg", typeNamespace); String typeLocalName = wsdlMessage.getMessageInfo().getName().getLocalPart(); if (typeLocalName == null || typeLocalName.length() == 0) { throw new IllegalArgumentException("messageType local name is null or empty"); } xmlWriter.writeAttribute("type", "msg" + ":" + typeLocalName); }
String typeNamespace = wsdlMessage.getMessageInfo().getName() .getNamespaceURI(); if (typeNamespace == null || typeNamespace.length() == 0) { throw new IllegalArgumentException( String typeLocalName = wsdlMessage.getMessageInfo().getName() .getLocalPart(); if (typeLocalName == null || typeLocalName.length() == 0) { throw new IllegalArgumentException( CxfJbiConstants.WSDL11_WRAPPER_MESSAGE_PREFIX + ":" + typeLocalName); String messageName = wsdlMessage.getMessageInfo().getName() .getLocalPart(); root.setAttribute(CxfJbiConstants.WSDL11_WRAPPER_NAME, messageName); root.setAttribute(CxfJbiConstants.WSDL11_WRAPPER_VERSION, "1.0"); .getExtensors(SoapHeaderInfo.class); List<Header> headerElement = message.getHeaders(); List<Object> parts = new ArrayList<Object>(); for (MessagePartInfo part : wsdlMessage.getMessageParts()) { if ("document".equals(style)) { parts.add(body); + part.getName() + "'"));
return; if (message.getExchange().get(BindingOperationInfo.class) != null) { return; opName = opName.substring(0, opName.length() - 8); BindingMessageInfo msg = !isRequestor(message) ? op.getInput() : op.getOutput(); if (msg.getExtensor(SoapBodyInfo.class) .getParts().get(0).getElementQName().equals(opQName)) { operation = op; break; if (opQName.equals(op.getName())) { operation = op; break; message.getExchange().put(BindingOperationInfo.class, operation); message.getExchange().put(OperationInfo.class, operation.getOperationInfo());
if (operation.getInput() != null) { inbindings = operation.getInput().getExtensors(ExtensibilityElement.class); if (operation.getOutput() != null) { List<ExtensibilityElement> outbindings = operation.getOutput().getExtensors(ExtensibilityElement.class); if (outbindings == null) { outbindings = new ArrayList<>(); .getMessagePart(new QName(soapHeader.getMessage().getNamespaceURI(), soapHeader.getPart())); JavaParameter jp = processor.addParameterFromBinding(jm, exPart, JavaType.Style.OUT);