You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/11/01 00:40:46 UTC

cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava Emitter.java

butek       2002/10/31 15:40:46

  Modified:    java/src/org/apache/axis/encoding
                        SerializationContextImpl.java
               java/src/org/apache/axis/transport/http AxisServlet.java
               java/src/org/apache/axis/wsdl/toJava Emitter.java
  Log:
  For Thomas Sandholm:
  
  Emitter
  ----------
  -fixed lookup of NStoPkg.properties to allow it to be picked up from the
  classpath (as stated in the javadocs comment)
  
  AxisServlet
  ----------------
  -fixed TRANS_URL property to be set both when doing http POST and GET (was
  only in GET before)
  
  SerializationContextImpl
  -----------------------------------
  -Exceptions are no longer serialized automatically in the newest code base.
  This was a big backwards compatibility problem for us, and hence I put in a
  fix so that they can be serialized automatically even if no typemapping
  entry exists.
  
  Revision  Changes    Path
  1.79      +17 -0     xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
  
  Index: SerializationContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- SerializationContextImpl.java	9 Oct 2002 19:06:30 -0000	1.78
  +++ SerializationContextImpl.java	31 Oct 2002 23:40:46 -0000	1.79
  @@ -96,6 +96,7 @@
   import javax.xml.rpc.JAXRPCException;
   import java.io.IOException;
   import java.io.Writer;
  +import java.lang.reflect.Method;
   import java.util.ArrayList;
   import java.util.Calendar;
   import java.util.Date;
  @@ -131,6 +132,8 @@
   
       private boolean pretty = false;
       private static QName multirefQName = new QName("","multiRef");
  +    private static Class[] getSerializerClasses =
  +            new Class[] {String.class, Class.class, QName.class};
   
       /**
        * Should I write out objects as multi-refs?
  @@ -1231,6 +1234,20 @@
                   //    name = type;
                   ser.serialize(elemQName, attributes, value, this);
                   return;
  +            }
  +
  +            // if no serializer was configured try to find one dynamically using WSDLJava 
  +            // generated metadata
  +            try { 
  +                Method method = value.getClass().getMethod(
  +                        "getSerializer", getSerializerClasses);
  +                if (method != null) {
  +                    Serializer serializer = (Serializer) method.invoke(value,
  +                            new Object[] {"", value.getClass(), elemQName});
  +                    serializer.serialize(elemQName, attributes, value, this);
  +                    return;
  +                }
  +            } catch (Exception e) {
               }
   
               throw new IOException(Messages.getMessage("noSerializer00",
  
  
  
  1.150     +2 -0      xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.149
  retrieving revision 1.150
  diff -u -r1.149 -r1.150
  --- AxisServlet.java	30 Oct 2002 19:44:28 -0000	1.149
  +++ AxisServlet.java	31 Oct 2002 23:40:46 -0000	1.150
  @@ -696,6 +696,8 @@
               /* Set the request(incoming) message field in the context */
               /**********************************************************/
               msgContext.setRequestMessage(requestMsg);
  +            String url = HttpUtils.getRequestURL(req).toString();
  +            msgContext.setProperty(MessageContext.TRANS_URL, url);
   
               try {
                   /**
  
  
  
  1.53      +6 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Emitter.java	19 Oct 2002 15:42:29 -0000	1.52
  +++ Emitter.java	31 Oct 2002 23:40:46 -0000	1.53
  @@ -438,7 +438,12 @@
           try {
               Properties mappings = new Properties();
               if (NStoPkgFile != null) {
  -                mappings.load(new FileInputStream(NStoPkgFile));
  +                try {
  +                    mappings.load(new FileInputStream(NStoPkgFilename));
  +                } catch (Throwable t) {
  +                    mappings.load(ClassUtils.getResourceAsStream(
  +                            Emitter.class, NStoPkgFilename));
  +                }
               }
               else {
                   mappings.load(new FileInputStream(NStoPkgFilename));