Examples of MIMEContent


Examples of javax.wsdl.extensions.mime.MIMEContent

        if (mPart.getExtensibilityElements().size() > 1) {
            return "javax.activation.DataHandler";
        } else {
            ExtensibilityElement extElement = (ExtensibilityElement)mPart.getExtensibilityElements().get(0);
            if (extElement instanceof MIMEContent) {
                MIMEContent mimeContent = (MIMEContent)extElement;
                if ("image/jpeg".equals(mimeContent.getType()) || "image/gif".equals(mimeContent.getType())) {
                    return "java.awt.Image";
                } else if ("text/xml".equals(mimeContent.getType())
                           || "application/xml".equals(mimeContent.getType())) {
                    return "javax.xml.transform.Source";
                else {
                    return "javax.activation.DataHandler";
                }
            }
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

            MIMEPart mPart = (MIMEPart)itParts.next();
            Iterator extns = mPart.getExtensibilityElements().iterator();
            while (extns.hasNext()) {
                ExtensibilityElement extElement = (ExtensibilityElement)extns.next();
                if (extElement instanceof MIMEContent) {
                    MIMEContent mimeContent = (MIMEContent)extElement;
                    String mimeJavaType = getJavaTypeForMimeType(mPart);
                    if (JavaType.Style.IN.equals(style)) {
                        String paramName = ProcessorUtil.mangleNameToVariableName(mimeContent.getPart());
                        JavaParameter jp = jm.getParameter(paramName);
                        if (jp == null) {
                            Message message = new Message("MIMEPART_CANNOT_MAP", LOG, mimeContent.getPart());
                            throw new ToolException(message);
                        }
                        if (!jp.getClassName().equals(mimeJavaType)) {
                            // jp.setType(mimeJavaType);
                            jp.setClassName(mimeJavaType);
                        }
                    } else if (JavaType.Style.OUT.equals(style)) {
                        JavaType jp = null;
                        if (!"void".equals(jm.getReturn().getType())
                            && mimeContent.getPart().equals(jm.getReturn().getName())) {
                            jp = jm.getReturn();
                            jp.setClassName(mimeJavaType);
                        }



                        if (jp == null) {
                            for (JavaParameter para : jm.getParameters()) {
                                if (mimeContent.getPart().equals(para.getPartName())) {
                                    jp = para;
                                }
                            }
                            if (jp != null) {
                                ((JavaParameter)jp).setClassName(mimeJavaType);
                            }

                        }


                        if (jp == null) {
                            Message message = new Message("MIMEPART_CANNOT_MAP", LOG, mimeContent
                                .getPart());
                            throw new ToolException(message);
                        }
                    }
                } else if (extElement instanceof SOAPHeader) {
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

            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>();
                }

                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);
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

            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);
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

        if (mPart.getExtensibilityElements().size() > 1) {
            return "javax.activation.DataHandler";
        } else {
            ExtensibilityElement extElement = (ExtensibilityElement)mPart.getExtensibilityElements().get(0);
            if (extElement instanceof MIMEContent) {
                MIMEContent mimeContent = (MIMEContent)extElement;
                if ("image/jpeg".equals(mimeContent.getType()) || "image/gif".equals(mimeContent.getType())) {
                    return "java.awt.Image";
                } else if ("text/xml".equals(mimeContent.getType())
                           || "application/xml".equals(mimeContent.getType())) {
                    return "javax.xml.transform.Source";
                else {
                    return "javax.activation.DataHandler";
                }
            }
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

        List<MIMEPart> mimeParts = CastUtils.cast(ext.getMIMEParts());
        for (MIMEPart mPart : mimeParts) {
            List<ExtensibilityElement> extns = CastUtils.cast(mPart.getExtensibilityElements());
            for (ExtensibilityElement extElement : extns) {
                if (extElement instanceof MIMEContent) {
                    MIMEContent mimeContent = (MIMEContent)extElement;
                    String mimeJavaType = getJavaTypeForMimeType(mPart);
                    if (JavaType.Style.IN.equals(style)) {
                        String paramName = ProcessorUtil.mangleNameToVariableName(mimeContent.getPart());
                        JavaParameter jp = jm.getParameter(paramName);
                        if (jp == null) {
                            Message message = new Message("MIMEPART_CANNOT_MAP", LOG, mimeContent.getPart());
                            throw new ToolException(message);
                        }
                        if (!jp.getClassName().equals(mimeJavaType)) {
                            // jp.setType(mimeJavaType);
                            jp.setClassName(mimeJavaType);
                        }
                    } else if (JavaType.Style.OUT.equals(style)) {
                        JavaType jp = null;
                        if (!"void".equals(jm.getReturn().getType())
                            && mimeContent.getPart().equals(jm.getReturn().getName())) {
                            jp = jm.getReturn();
                            jp.setClassName(mimeJavaType);
                        }



                        if (jp == null) {
                            for (JavaParameter para : jm.getParameters()) {
                                if (mimeContent.getPart().equals(para.getPartName())) {
                                    jp = para;
                                }
                            }
                            if (jp != null) {
                                ((JavaParameter)jp).setClassName(mimeJavaType);
                            }

                        }


                        if (jp == null) {
                            Message message = new Message("MIMEPART_CANNOT_MAP", LOG, mimeContent
                                .getPart());
                            throw new ToolException(message);
                        }
                    }
                } else if (extElement instanceof SOAPHeader) {
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

          // If the corresponding wsdl:input exists in wsdl:portType
          // and includes the message attribute
          if (portTypeInput != null && portTypeInput.getMessage() != null)
          {
            // If there is an invalid mime:content element
            MIMEContent imc = getInvalidMimeContent(
                inputMimeContents, portTypeInput.getMessage());
            if (imc != null)
            {
              throw new AssertionFailException("The mime:content element in "
                + "the wsdl:input of the \"" + bindingOperation.getName()
                + "\" that binds the \"" + imc.getPart()
                + "\" wsdl:part uses the invalid content type \""
                + imc.getType() + "\". ");
            }
          }
        }

        // If the wsdl:output contains mime:content elements
        if (!outputMimeContents.isEmpty())
        {
          Output portTypeOutput = bindingOperation.getOperation().getOutput();
          // If the corresponding wsdl:output exists in wsdl:portType
          // and includes the message attribute
          if (portTypeOutput != null && portTypeOutput.getMessage() != null)
          {
            // If there is an invalid mime:content element
            MIMEContent imc = getInvalidMimeContent(
              outputMimeContents, portTypeOutput.getMessage());
            if (imc != null)
            {
              throw new AssertionFailException("The mime:content element in "
                + "the wsdl:output of the \"" + bindingOperation.getName()
                + "\" that binds the \"" + imc.getPart()
                + "\" wsdl:part uses the invalid content type \""
                + imc.getType() + "\". ");
            }
          }
        }
      }
      // If mime:content elements are not found,
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

  private MIMEContent getInvalidMimeContent(List mimeContents, Message message)
  {
    // Going through a list of mime:content elements
    for (int i = 0; i < mimeContents.size(); i++)
    {
      MIMEContent mimeContent = (MIMEContent) mimeContents.get(i);
      // Getting the corresponding wsdl:part
      Part part = message.getPart(mimeContent.getPart());
      // If the part is defined with the element attribute
      if (part != null && part.getElementName() != null)
      {
        mimeContentFound = true;
        // If the type attribute value is other than "text/xml"
        if (!WSIConstants.CONTENT_TYPE_TEXT_XML.equals(mimeContent.getType()))
        {
          // return the invalid element
          return mimeContent;
        }
      }
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

      {
        // If an extensibility element is mime:content
        if (((ExtensibilityElement)extElems.get(j))
          .getElementType().equals(WSDL_MIME_CONTENT))
        {
          MIMEContent mimeContent  = (MIMEContent) extElems.get(j);
          // If a mime:content element was already found in this mime:part
          if (mimeContentFound)
          {
            multipleContentFound = true;
            // If a mime:content references other wsdl:part than the
            // previous mime:content do, return true
            if (mimeContent.getPart() == null
              || !mimeContent.getPart().equals(mimeContentPart))
            {
              return true;
            }
          }
          // This is the first mime:content element of mime:part
          else
          {
            mimeContentFound = true;
            mimeContentPart = mimeContent.getPart();
          }
        }
      }
    }
    // There are no invalid mime:part elements, return false
View Full Code Here

Examples of javax.wsdl.extensions.mime.MIMEContent

            {
               MIMEPart mimePartDesc = (MIMEPart)mimePartIt.next();
               List mimePartExt = mimePartDesc.getExtensibilityElements();
               if (!mimePartExt.isEmpty() && (mimePartExt.get(0) instanceof MIMEContent))
               {
                  MIMEContent mimeContent = (MIMEContent)mimePartExt.get(0);

                  if (skippedSWAParts.get(portTypeName) == null)
                     skippedSWAParts.put(portTypeName, new ArrayList<String>());
                  skippedSWAParts.get(portTypeName).add(mimeContent.getPart());
               }
            }

            break;
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.