示例#1
0
  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;
  }
示例#2
0
 private String getActionFromFaultMessage(final OperationInfo operation, final String faultName) {
   if (operation.getFaults() != null) {
     for (FaultInfo faultInfo : operation.getFaults()) {
       if (isSameFault(faultInfo, faultName)) {
         if (faultInfo.getExtensionAttributes() != null) {
           String faultAction = InternalContextUtils.getAction(faultInfo);
           if (!StringUtils.isEmpty(faultAction)) {
             return faultAction;
           }
         }
         return addPath(
             addPath(
                 addPath(getActionBaseUri(operation), operation.getName().getLocalPart()),
                 "Fault"),
             faultInfo.getFaultName().getLocalPart());
       }
     }
   }
   return addPath(
       addPath(addPath(getActionBaseUri(operation), operation.getName().getLocalPart()), "Fault"),
       faultName);
 }
示例#3
0
 public static boolean isSameOperationInfo(OperationInfo oi1, OperationInfo oi2) {
   return oi1.getName().equals(oi2.getName())
       && isSameMessageInfo(oi1.getInput(), oi2.getInput())
       && isSameMessageInfo(oi1.getOutput(), oi2.getOutput())
       && isSameFaultInfo(oi1.getFaults(), oi2.getFaults());
 }
示例#4
0
 private String getActionBaseUri(final OperationInfo operation) {
   String interfaceName = operation.getInterface().getName().getLocalPart();
   return addPath(operation.getName().getNamespaceURI(), interfaceName);
 }
  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;
  }