Package org.apache.axis.attachments

Examples of org.apache.axis.attachments.Attachments


            }
            if( null == ret && !href.startsWith("#")){
                //Could this be an attachment?
                Message msg= null;
                if(null != (msg=msgContext.getCurrentMessage())){
                    Attachments attch= null;
                    if( null != (attch= msg.getAttachmentsImpl())){
                        try{
                        ret= attch.getAttachmentByReference(href);
                        }catch(AxisFault e){
                            throw new RuntimeException(e.toString() + JavaUtils.stackToString(e));
                        }
                    }
                }
View Full Code Here


            throw new SOAPException(Messages.getMessage("connectionClosed00"));
        }
        try {
            Call call = new Call(endpoint.toString());
            ((org.apache.axis.Message)request).setMessageContext(call.getMessageContext());
            Attachments attachments = ((org.apache.axis.Message)
                    request).getAttachmentsImpl();
            if (attachments != null) {
                Iterator iterator = attachments.getAttachments().iterator();
                while (iterator.hasNext()) {
                    Object attachment = iterator.next();
                    call.addAttachmentPart(attachment);
                }
            }
View Full Code Here

    public void setRequestMessage(Message msg) {
         String attachformat= (String)getProperty(
           ATTACHMENT_ENCAPSULATION_FORMAT);

         if(null != attachformat) {
              Attachments attachments=msg.getAttachmentsImpl();
              if(null != attachments) {
                  if( ATTACHMENT_ENCAPSULATION_FORMAT_MIME.equals(attachformat)) {
                    attachments.setSendType(Attachments.SEND_TYPE_MIME);
                  } else if ( ATTACHMENT_ENCAPSULATION_FORMAT_MTOM.equals(attachformat)) {
                    attachments.setSendType(Attachments.SEND_TYPE_MTOM);
                  } else if ( ATTACHMENT_ENCAPSULATION_FORMAT_DIME.equals(attachformat)) {
                    attachments.setSendType(Attachments.SEND_TYPE_DIME);
                  }
              }
         }

        if(null != attachmentParts && !attachmentParts.isEmpty()){
            try{
                Attachments attachments= msg.getAttachmentsImpl();
                if(null == attachments) {
                  throw new RuntimeException(
                          Messages.getMessage("noAttachments"));
                }

                attachments.setAttachmentParts(attachmentParts);
            }catch(AxisFault ex){
              log.info(Messages.getMessage("axisFault00"), ex);
              throw new RuntimeException(ex.getMessage());
            }
        }
View Full Code Here

            log.debug(msgStr);
        }
       
        Message serverRequest = new Message(msgStr);

        Attachments serverAttachments = serverRequest.getAttachmentsImpl();
        Attachments clientAttachments = clientRequest.getAttachmentsImpl();

        if (null != clientAttachments && null != serverAttachments) {
            serverAttachments.setAttachmentParts(clientAttachments.getAttachments());
        }

        serverContext.setRequestMessage(serverRequest);

// END FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17161
View Full Code Here

            // If the request message contains attachments, set
            // a contentType property to go in the outgoing message header
            String ret = null;
            Message message = msgContext.getRequestMessage();
            Attachments mAttachments = message.getAttachmentsImpl();
            if (mAttachments != null && 0 != mAttachments.getAttachmentCount())
            {
                String contentType = mAttachments.getContentType();
                if(contentType != null && !contentType.trim().equals(""))
                {
                    props.put("contentType", contentType);
                }
            }
View Full Code Here

                          Object value, SerializationContext context)
        throws IOException
    {
        DataHandler dh= (DataHandler)value;
        //Add the attachment content to the message.
        Attachments attachments= context.getCurrentMessage().getAttachmentsImpl();

        if (attachments == null) {
            // Attachments apparently aren't supported.
            // Instead of throwing NullPointerException like
            // we used to do, throw something meaningful.
            throw new IOException(Messages.getMessage("noAttachments"));
        }
        SOAPConstants soapConstants = context.getMessageContext().getSOAPConstants();
        Part attachmentPart= attachments.createAttachmentPart(dh);

        AttributesImpl attrs = new AttributesImpl();
        if (attributes != null && 0 < attributes.getLength())
            attrs.setAttributes(attributes); //copy the existing ones.

        int typeIndex=-1;
        if((typeIndex = attrs.getIndex(Constants.URI_DEFAULT_SCHEMA_XSI,
                                "type")) != -1){

            //Found a xsi:type which should not be there for attachments.
            attrs.removeAttribute(typeIndex);
        }

        if(attachments.getSendType() == Attachments.SEND_TYPE_MTOM) {
            context.setWriteXMLType(null);
            context.startElement(name, attrs);
            AttributesImpl attrs2 = new AttributesImpl();
            attrs2.addAttribute("", soapConstants.getAttrHref(), soapConstants.getAttrHref(),
                    "CDATA", attachmentPart.getContentIdRef());
            context.startElement(new QName(Constants.URI_XOP_INCLUDE, Constants.ELEM_XOP_INCLUDE), attrs2);
            context.endElement();
            context.endElement();
        } else {
            boolean doTheDIME = false;
            if(attachments.getSendType() == Attachments.SEND_TYPE_DIME)
                doTheDIME = true;

            attrs.addAttribute("", soapConstants.getAttrHref(), soapConstants.getAttrHref(),
                                   "CDATA", doTheDIME ? attachmentPart.getContentId() : attachmentPart.getContentIdRef() );
View Full Code Here

            //if we have received attachments of a particular type
            // than that should be the default type to send.
            Message reqMsg = getRequestMessage();
            if (null != reqMsg) {
                Attachments reqAttch = reqMsg.getAttachmentsImpl();
                Attachments respAttch = respMsg.getAttachmentsImpl();
                if (null != reqAttch && null != respAttch) {
                    if (respAttch.getSendType() == Attachments.SEND_TYPE_NOTSET)
                        //only if not explicity set.
                        respAttch.setSendType(reqAttch.getSendType());
                }
            }
        }
    }
View Full Code Here

            }
            if( null == ret && !href.startsWith("#")){
                //Could this be an attachment?
                Message msg= null;
                if(null != (msg=msgContext.getCurrentMessage())){
                    Attachments attch= null;
                    if( null != (attch= msg.getAttachments())){
                        try{
                        ret= attch.getAttachmentByReference(href);
                        }catch(AxisFault e){};
                    }
                }
            }
        }
View Full Code Here

                          Object value, SerializationContext context)
        throws IOException
    {
        DataHandler dh= (DataHandler)value;
            //Add the attachment content to the message.
        Attachments attachments= context.getCurrentMessage().getAttachments();
        Part attachmentPart= attachments.createAttachmentPart(dh);
        String href= attachmentPart.getContentId();

        AttributesImpl attrs = new AttributesImpl();
        if (attributes != null)
            attrs.setAttributes(attributes); //copy the existing ones.
View Full Code Here

        }

        Message msg= getCurrentMessage();
        if(null != msg){
            //Get attachments. returns null if no attachment support.
            Attachments attachments= getCurrentMessage().getAttachments();

            if( null != attachments && attachments.isAttachment(value)){
             //Attachment support and this is an object that should be treated as an attachment.

             //Allow an the attachment to do its own serialization.
              getTypeMappingRegistry().serialize(qName, attributes, value, this);
             
View Full Code Here

TOP

Related Classes of org.apache.axis.attachments.Attachments

Copyright © 2018 www.massapicom. 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.