public void createSoapRequest(MessageContext msgCtx, Element message, Operation op)
      throws AxisFault {
    if (op == null) {
      throw new NullPointerException("Null operation");
    }
    // The message can be null if the input message has no part
    if (op.getInput().getMessage().getParts().size() > 0 && message == null) {
      throw new NullPointerException("Null message.");
    }
    if (msgCtx == null) {
      throw new NullPointerException("Null msgCtx");
    }

    BindingOperation bop = binding.getBindingOperation(op.getName(), null, null);

    if (bop == null) {
      throw new OdeFault("BindingOperation not found.");
    }

    BindingInput bi = bop.getBindingInput();
    if (bi == null) {
      throw new OdeFault("BindingInput not found.");
    }

    SOAPEnvelope soapEnv = msgCtx.getEnvelope();
    if (soapEnv == null) {
      soapEnv = soapFactory.getDefaultEnvelope();
      msgCtx.setEnvelope(soapEnv);
    }

    //        createSoapHeaders(soapEnv, getSOAPHeaders(bi), op.getInput().getMessage(), message);

    SOAPBody soapBody = getSOAPBody(bi);
    if (soapBody != null) {
      org.apache.axiom.soap.SOAPBody sb =
          soapEnv.getBody() == null ? soapFactory.createSOAPBody(soapEnv) : soapEnv.getBody();
      createSoapBody(sb, soapBody, op.getInput().getMessage(), message, op.getName());
    }
  }
Beispiel #2
0
  private void collectValidationPointsForBindings() throws Exception {
    Map<QName, XNode> vBindingNodes = new HashMap<QName, XNode>();
    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);
        }
      }
    }
  }
 /*      */ public static QName getOperationQName(
     BindingOperation bindingOper, BindingEntry bEntry, SymbolTable symbolTable)
       /*      */ {
   /*  813 */ Operation operation = bindingOper.getOperation();
   /*  814 */ String operationName = operation.getName();
   /*      */
   /*  821 */ if ((bEntry.getBindingStyle() == Style.DOCUMENT) && (symbolTable.isWrapped()))
   /*      */ {
     /*  823 */ Input input = operation.getInput();
     /*      */
     /*  825 */ if (input != null) {
       /*  826 */ Map parts = input.getMessage().getParts();
       /*      */
       /*  828 */ if ((parts != null) && (!parts.isEmpty())) {
         /*  829 */ Iterator i = parts.values().iterator();
         /*  830 */ Part p = (Part) i.next();
         /*      */
         /*  832 */ return p.getElementName();
         /*      */ }
       /*      */ }
     /*      */ }
   /*      */
   /*  837 */ String ns = null;
   /*      */
   /*  842 */ BindingInput bindInput = bindingOper.getBindingInput();
   /*      */
   /*  844 */ if (bindInput != null) {
     /*  845 */ Iterator it = bindInput.getExtensibilityElements().iterator();
     /*      */
     /*  847 */ while (it.hasNext()) {
       /*  848 */ ExtensibilityElement elem = (ExtensibilityElement) it.next();
       /*      */
       /*  850 */ if ((elem instanceof SOAPBody)) {
         /*  851 */ SOAPBody body = (SOAPBody) elem;
         /*      */
         /*  853 */ ns = body.getNamespaceURI();
         /*  854 */ if ((bEntry.getInputBodyType(operation) != Use.ENCODED)
             || ((ns != null) && (ns.length() != 0))) break;
         /*  855 */ log.warn(
             Messages.getMessage(
                 "badNamespaceForOperation00", bEntry.getName(), operation.getName()));
         break;
         /*      */ }
       /*      */
       /*  861 */ if ((elem instanceof MIMEMultipartRelated)) {
         /*  862 */ Object part = null;
         /*  863 */ MIMEMultipartRelated mpr = (MIMEMultipartRelated) elem;
         /*      */
         /*  865 */ List l = mpr.getMIMEParts();
         /*      */
         /*  868 */ int j = 0;
         /*  869 */ while ((l != null) && (j < l.size()) && (part == null))
         /*      */ {
           /*  871 */ MIMEPart mp = (MIMEPart) l.get(j);
           /*      */
           /*  873 */ List ll = mp.getExtensibilityElements();
           /*      */
           /*  876 */ int k = 0;
           /*  877 */ for (; (ll != null) && (k < ll.size()) && (part == null); k++) {
             /*  878 */ part = ll.get(k);
             /*      */
             /*  880 */ if ((part instanceof SOAPBody)) {
               /*  881 */ SOAPBody body = (SOAPBody) part;
               /*      */
               /*  883 */ ns = body.getNamespaceURI();
               /*  884 */ if ((bEntry.getInputBodyType(operation) != Use.ENCODED)
                   || ((ns != null) && (ns.length() != 0))) break;
               /*  885 */ log.warn(
                   Messages.getMessage(
                       "badNamespaceForOperation00", bEntry.getName(), operation.getName()));
               break;
               /*      */ }
             /*      */
             /*  892 */ part = null;
             /*      */ }
           /*  870 */ j++;
           /*      */ }
         /*      */
         /*      */ }
       /*  896 */ else if ((elem instanceof UnknownExtensibilityElement))
       /*      */ {
         /*  899 */ UnknownExtensibilityElement unkElement = (UnknownExtensibilityElement) elem;
         /*      */
         /*  901 */ QName name = unkElement.getElementType();
         /*      */
         /*  904 */ if ((name.getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap12/"))
             && (name.getLocalPart().equals("body")))
         /*      */ {
           /*  906 */ ns = unkElement.getElement().getAttribute("namespace");
           /*      */ }
         /*      */
         /*      */ }
       /*      */
       /*      */ }
     /*      */
     /*      */ }
   /*      */
   /*  916 */ if (ns == null) {
     /*  917 */ ns = "";
     /*      */ }
   /*      */
   /*  920 */ return new QName(ns, operationName);
   /*      */ }