Examples of MimeHeaders


Examples of javax.xml.soap.MimeHeaders

        }

        @Override
        public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            try {
                MimeHeaders headers = getHeaders(req);
                SOAPMessage request = messageFactory.createMessage(headers, req.getInputStream());
                SOAPMessage reply = onMessage(request);
              if (reply != null) {
                reply.saveChanges();
                SOAPBody replyBody = reply.getSOAPBody();
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

            }
        }

        private MimeHeaders getHeaders(HttpServletRequest httpServletRequest) {
            Enumeration<?> enumeration = httpServletRequest.getHeaderNames();
            MimeHeaders headers = new MimeHeaders();
            while (enumeration.hasMoreElements()) {
                String headerName = (String) enumeration.nextElement();
                String headerValue = httpServletRequest.getHeader(headerName);
                StringTokenizer values = new StringTokenizer(headerValue, ",");
                while (values.hasMoreTokens()) {
                    headers.addHeader(headerName, values.nextToken().trim());
                }
            }
            return headers;
        }
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

      assertTrue(chain.getInterceptors()[0] instanceof AddressingEndpointInterceptor);
      assertTrue(chain.getInterceptors()[1] instanceof MyInterceptor);
    }

    private MessageContext createMessageContext() throws SOAPException, IOException {
        MimeHeaders mimeHeaders = new MimeHeaders();
        mimeHeaders.addHeader("Content-Type", " application/soap+xml");
        InputStream is = getClass().getResourceAsStream("valid.xml");
        assertNotNull("Could not load valid.xml", is);
        try {
            SaajSoapMessage message = new SaajSoapMessage(messageFactory.createMessage(mimeHeaders, is));
            return new DefaultMessageContext(message, new SaajSoapMessageFactory(messageFactory));
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

     */
    public SaajSoapMessage(SOAPMessage soapMessage, boolean langAttributeOnSoap11FaultString, MessageFactory messageFactory) {
        Assert.notNull(soapMessage, "soapMessage must not be null");
        saajMessage = soapMessage;
        this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
      MimeHeaders headers = soapMessage.getMimeHeaders();
        if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_SOAP_ACTION))) {
            headers.addHeader(TransportConstants.HEADER_SOAP_ACTION, "\"\"");
        }
        this.messageFactory = messageFactory;
    }
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

        return envelope;
    }

    @Override
    public String getSoapAction() {
      MimeHeaders mimeHeaders = getSaajMessage().getMimeHeaders();
        if (SoapVersion.SOAP_11 == getVersion()) {
            String[] actions = mimeHeaders.getHeader(TransportConstants.HEADER_SOAP_ACTION);
            return ObjectUtils.isEmpty(actions) ? TransportConstants.EMPTY_SOAP_ACTION : actions[0];
        }
        else if (SoapVersion.SOAP_12 == getVersion()) {
            String[] contentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE);
            return !ObjectUtils.isEmpty(contentTypes) ? SoapUtils.extractActionFromContentType(contentTypes[0]) :
                    TransportConstants.EMPTY_SOAP_ACTION;
        }
        else {
            throw new IllegalStateException("Unsupported SOAP version: " + getVersion());
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

        }
    }

    @Override
    public void setSoapAction(String soapAction) {
      MimeHeaders mimeHeaders = getSaajMessage().getMimeHeaders();
        soapAction = SoapUtils.escapeAction(soapAction);
        if (SoapVersion.SOAP_11 == getVersion()) {
            mimeHeaders.setHeader(TransportConstants.HEADER_SOAP_ACTION, soapAction);
        }
        else if (SoapVersion.SOAP_12 == getVersion()) {
            // force save of Content Type header
          try {
              saajMessage.saveChanges();
          }
          catch (SOAPException ex) {
              throw new SaajSoapMessageException("Could not save message", ex);
          }
          String[] contentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE);
            String contentType = !ObjectUtils.isEmpty(contentTypes) ? contentTypes[0] : getVersion().getContentType();
            contentType = SoapUtils.setActionInContentType(contentType, soapAction);
            mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_TYPE, contentType);
            mimeHeaders.removeHeader(TransportConstants.HEADER_SOAP_ACTION);
        }
        else {
            throw new IllegalStateException("Unsupported SOAP version: " + getVersion());
        }
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

     */
    public static SOAPMessage loadMessage(Resource resource, MessageFactory messageFactory)
            throws SOAPException, IOException {
        InputStream is = resource.getInputStream();
        try {
            MimeHeaders mimeHeaders = new MimeHeaders();
            mimeHeaders.addHeader(TransportConstants.HEADER_CONTENT_TYPE, "text/xml");
            mimeHeaders.addHeader(TransportConstants.HEADER_CONTENT_LENGTH, Long.toString(resource.getFile().length()));
            return messageFactory.createMessage(mimeHeaders, is);
        }
        finally {
            is.close();
        }
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

        Message outMsg = new Message(new BackgroundInputStream(methodThread,dataStream),
          false, contentType, contentLocation);
         
        // Transfer HTTP headers of HTTP message to MIME headers of SOAP message
        MimeHeaders responseMimeHeaders = outMsg.getMimeHeaders();
        for (String name : responseHeaders.keySet())
        {
          List<String> values = responseHeaders.get(name);
          for (String value : values) {
            responseMimeHeaders.addHeader(name,value);
          }
        }
        outMsg.setMessageType(Message.RESPONSE);
         
        // Put the message in the message context.
View Full Code Here

Examples of javax.xml.soap.MimeHeaders

    if (msg != null){

      // First, transfer MIME headers of SOAPMessage to HTTP headers.
      // Some of these might be overridden later.
      MimeHeaders mimeHeaders = msg.getMimeHeaders();
      if (mimeHeaders != null) {
        for (Iterator i = mimeHeaders.getAllHeaders(); i.hasNext(); ) {
          MimeHeader mimeHeader = (MimeHeader) i.next();
          method.addHeader(mimeHeader.getName(),
            mimeHeader.getValue());
        }
      }
View Full Code Here

Examples of org.apache.axis.message.MimeHeaders

          mSOAPPart.setMessage(this);

        // The stream was not determined by a more complex type so default to
        if(mAttachments!=null) mAttachments.setRootPart(mSOAPPart);

        headers = (mimeHeaders == null) ? new MimeHeaders() : new MimeHeaders(mimeHeaders);
    }
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.