Exemplo n.º 1
0
 /*      */ 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);
   /*      */ }
  private List<MessagePartInfo> handleMimePart(
      MIMEPart mpart,
      List<MessagePartInfo> attParts,
      MessageInfo msg,
      BindingMessageInfo bmsg,
      List<MessagePartInfo> bodyParts,
      List<MessagePartInfo> messageParts) {
    if (mpart.getExtensibilityElements().size() < 1) {
      throw new RuntimeException("MIMEPart should at least contain one element!");
    }
    String partName = null;
    for (Object content : mpart.getExtensibilityElements()) {
      if (content instanceof MIMEContent) {
        MIMEContent mc = (MIMEContent) content;
        partName = mc.getPart();

        if (attParts == null) {
          attParts = new LinkedList<MessagePartInfo>();
        }

        if (StringUtils.isEmpty(partName)) {
          throw new RuntimeException(
              "Problem with WSDL: mime content element in operation "
                  + bmsg.getBindingOperation().getName().getLocalPart()
                  + " does not specify a part.");
        }

        MessagePartInfo mpi =
            msg.getMessagePart(new QName(msg.getName().getNamespaceURI(), partName));
        mpi.setProperty(Message.CONTENT_TYPE, mc.getType());
        attParts.add(mpi);
        // Attachments shouldn't be part of the body message
        bmsg.getMessageParts().remove(mpi);
      } else if (SOAPBindingUtil.isSOAPBody(content)) {
        SoapBody sb = SOAPBindingUtil.getSoapBody(content);
        if (sb.getParts() != null && sb.getParts().size() == 1) {
          partName = (String) sb.getParts().get(0);
        }

        // We can have a list of empty part names here.
        if (partName != null) {
          addSoapBodyPart(msg, bodyParts, partName);
        }
      } else if (SOAPBindingUtil.isSOAPHeader(content)) {
        SoapHeader header = SOAPBindingUtil.getSoapHeader(content);

        SoapHeaderInfo headerInfo = new SoapHeaderInfo();
        headerInfo.setUse(header.getUse());

        if (StringUtils.isEmpty(header.getPart())) {
          throw new RuntimeException(
              "Problem with WSDL: soap:header element in operation "
                  + bmsg.getBindingOperation().getName().getLocalPart()
                  + " does not specify a part.");
        }

        MessagePartInfo mpi =
            msg.getMessagePart(new QName(msg.getName().getNamespaceURI(), header.getPart()));

        if (mpi != null
            && header.getMessage() != null
            && !mpi.getMessageInfo().getName().equals(header.getMessage())) {
          mpi = null;
          // out of band, let's find it
          for (MessagePartInfo mpi2 : msg.getOutOfBandParts()) {
            if (mpi2.getName().getLocalPart().equals(header.getPart())
                && mpi2.getMessageInfo().getName().equals(header.getMessage())) {
              mpi = mpi2;
            }
          }
        }

        if (mpi != null) {
          headerInfo.setPart(mpi);
          messageParts.remove(mpi);
          bmsg.getMessageParts().remove(mpi);
          bmsg.addExtensor(headerInfo);
        }
      }
    }
    return attParts;
  }