protected String getActionUri(Message message, boolean checkMessage) { BindingOperationInfo bop = message.getExchange().getBindingOperationInfo(); if (bop == null || Boolean.TRUE.equals(bop.getProperty("operation.is.synthetic"))) { return null; } OperationInfo op = bop.getOperationInfo(); if (op.isUnwrapped()) { op = ((UnwrappedOperationInfo) op).getWrappedOperation(); } String actionUri = null; if (checkMessage) { actionUri = (String) message.get(ContextUtils.ACTION); if (actionUri == null) { actionUri = (String) message.get(SoapBindingConstants.SOAP_ACTION); } } if (actionUri != null) { return actionUri; } String opNamespace = getActionBaseUri(op); boolean inbound = !ContextUtils.isOutbound(message); boolean requestor = ContextUtils.isRequestor(message); boolean inMsg = requestor ^ inbound; if (ContextUtils.isFault(message)) { String faultName = getFaultNameFromMessage(message); actionUri = getActionFromFaultMessage(op, faultName); } else if (inMsg) { String explicitAction = getActionFromInputMessage(op); if (StringUtils.isEmpty(explicitAction)) { SoapOperationInfo soi = InternalContextUtils.getSoapOperationInfo(bop); explicitAction = soi == null ? null : soi.getAction(); } if (!StringUtils.isEmpty(explicitAction)) { actionUri = explicitAction; } else if (null == op.getInputName()) { actionUri = addPath(opNamespace, op.getName().getLocalPart() + "Request"); } else { actionUri = addPath(opNamespace, op.getInputName()); } } else { String explicitAction = getActionFromOutputMessage(op); if (explicitAction != null) { actionUri = explicitAction; } else if (null == op.getOutputName()) { actionUri = addPath(opNamespace, op.getName().getLocalPart() + "Response"); } else { actionUri = addPath(opNamespace, op.getOutputName()); } } return actionUri; }
public BindingInfo createBindingInfo(ServiceInfo si, String bindingid, Object conf) { SoapBindingConfiguration config; if (conf instanceof SoapBindingConfiguration) { config = (SoapBindingConfiguration) conf; } else { config = new SoapBindingConfiguration(); } if (WSDLConstants.NS_SOAP12.equals(bindingid) || WSDLConstants.NS_SOAP12_HTTP_BINDING.equals(bindingid)) { config.setVersion(Soap12.getInstance()); config.setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT); } SoapBindingInfo info = new SoapBindingInfo(si, bindingid, config.getVersion()); info.setName(config.getBindingName(si)); info.setStyle(config.getStyle()); info.setTransportURI(config.getTransportURI()); if (config.isMtomEnabled()) { info.setProperty(Message.MTOM_ENABLED, Boolean.TRUE); } for (OperationInfo op : si.getInterface().getOperations()) { SoapOperationInfo sop = new SoapOperationInfo(); sop.setAction(config.getSoapAction(op)); sop.setStyle(config.getStyle(op)); BindingOperationInfo bop = info.buildOperation(op.getName(), op.getInputName(), op.getOutputName()); bop.addExtensor(sop); info.addOperation(bop); BindingMessageInfo bInput = bop.getInput(); if (bInput != null) { MessageInfo input = null; BindingMessageInfo unwrappedMsg = bInput; if (bop.isUnwrappedCapable()) { input = bop.getOperationInfo().getUnwrappedOperation().getInput(); unwrappedMsg = bop.getUnwrappedOperation().getInput(); } else { input = bop.getOperationInfo().getInput(); } setupHeaders(bop, bInput, unwrappedMsg, input, config); } BindingMessageInfo bOutput = bop.getOutput(); if (bOutput != null) { MessageInfo output = null; BindingMessageInfo unwrappedMsg = bOutput; if (bop.isUnwrappedCapable()) { output = bop.getOperationInfo().getUnwrappedOperation().getOutput(); unwrappedMsg = bop.getUnwrappedOperation().getOutput(); } else { output = bop.getOperationInfo().getOutput(); } setupHeaders(bop, bOutput, unwrappedMsg, output, config); } } try { createSoapBinding(info); } catch (WSDLException e) { e.printStackTrace(); } return info; }