Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 473651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:12:30+00:00 2026-05-13T00:12:30+00:00

I am maintaining an application that has classes (written in 2005) that extend javax.xml.messaging.JAXMServlet

  • 0

I am maintaining an application that has classes (written in 2005) that extend javax.xml.messaging.JAXMServlet. While upgrading to a new app server that implements the latest J2EE standards, I discovered that JAXMServlet was removed in JWSDP 2.0 (Java Web Services Developer Pack), according to this question (and apparently JWSDP itself has been deprecated too). The code it relies on has not significantly changed since it was written, and is part of a large-ish existing production system where this code is already tested and debugged, so I am reluctant to rewrite the classes from scratch due to the regression testing impact.

Is there an ‘easy’ substitution for this class? Although Google has a lot of examples of using this code (dated from around 2003-2004), it is surprisingly mute about replacing it. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:12:30+00:00Added an answer on May 13, 2026 at 12:12 am

    To answer my own question, found some replacement code at http://www.java.happycodings.com/Java%5fUtil%5fPackage/code23.html:

    import java.io.ByteArrayInputStream;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.Enumeration;
    import java.util.Iterator;
    import java.util.StringTokenizer;
    import javax.activation.DataHandler;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.xml.soap.AttachmentPart;
    import javax.xml.soap.MimeHeader;
    import javax.xml.soap.MimeHeaders;
    import javax.xml.soap.SOAPException;
    import javax.xml.soap.SOAPMessage;
    
    public class SaajUtils {
        /**
        * extract the MIME header information from within the HTTP Request
        * @param req the http request
        * @return MimeHeaders as defined within the SAAJ API
        */
        public static MimeHeaders getHeaders( HttpServletRequest req ) {
          Enumeration<String> en = req.getHeaderNames();
          MimeHeaders headers = new MimeHeaders();
    
          while( en.hasMoreElements() ) {
            String headerName = (String) en.nextElement();
            String headerValue = req.getHeader( headerName );
    
            StringTokenizer values = new StringTokenizer( headerValue, "," );
            while( values.hasMoreTokens() ) {
              headers.addHeader( headerName, values.nextToken().trim() );
            }
          }
          return headers;
        }
    
        /**
         * stuff the MIME headers into the HTTP response
         * @param headers the SAAJ MIME headers
         * @param res the Http servlet response
         */
        public static void putHeaders( MimeHeaders headers, HttpServletResponse res ) {
            for( Iterator<MimeHeader> it = headers.getAllHeaders(); it.hasNext(); ) {
              MimeHeader header = it.next();
              String[] values = headers.getHeader( header.getName() );
              if( values.length == 1 ) {
                res.setHeader( header.getName(), header.getValue() );
              }
              else {
                StringBuffer concat = new StringBuffer();
                for( int i = 0; i < values.length; i++ ) {
                  if( i != 0 ) {
                    concat.append( ',' );
                  }
                  concat.append( values[i] );
              }
              res.setHeader( header.getName(), concat.toString() );
            }
          }
        }
    
        public static void attachBytes( SOAPMessage soapMessage, byte[] theBytes, String contentType )
        throws SOAPException {
          AttachmentPart attachment = soapMessage.createAttachmentPart();
          attachment.setContent( new ByteArrayInputStream( theBytes ), contentType );
          soapMessage.addAttachmentPart( attachment );
        }
    
        public static void attachUrlContents( SOAPMessage soapMessage, String urlLocation, String contentType )
        throws SOAPException, MalformedURLException {
          URL url = new URL( urlLocation );
          AttachmentPart attachment = soapMessage.createAttachmentPart( new DataHandler( url ) );
          attachment.setContentType( contentType );
          soapMessage.addAttachmentPart( attachment );
        }
    
        public static String getAttachmentReport( SOAPMessage soapMessage ) throws SOAPException {
          int numOfAttachments = soapMessage.countAttachments();
          Iterator<AttachmentPart> attachments = soapMessage.getAttachments();
    
          StringBuffer buf = new StringBuffer( "Number of attachments: " );
          buf.append( numOfAttachments );
    
          while( attachments.hasNext() ) {
            buf.append( "\n--------------------------------------------\n" );
            AttachmentPart attachment = attachments.next();
            buf.append( "\nContent Location: " + attachment.getContentLocation() );
            buf.append( "\nContent Id: " + attachment.getContentId() );
            buf.append( "\nContent Size: " + attachment.getSize() );
            buf.append( "\nContent Type: " + attachment.getContentType() );
          }
    
          return buf.toString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm maintaining an application that uses SQL Server Express 2005 as the back end.
I'm maintaining a rails 2.1 application that has some unfortunate choices for column names.
I am maintaining a server application written in C many years ago. It has
I am maintaining a small application that has some plugin-like functionality, which is implemented
I am working on maintaining a ASP.NET MVC application that has the following coding
A new client of mine has a small VB/Access database application written in 2002
I'm maintaining an application that goes sort of like this: There is a Page
Yes, I am talking about Java 1.3 - I'm maintaining an application that for
I noticed that an application I am maintaining was giving me a javascript error
I am maintaining an application in which the developer has used data caching in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.