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 di...@apache.org on 2005/01/21 17:52:40 UTC

cvs commit: ws-axis/java/src/org/apache/axis/client Call.java

dims        2005/01/21 08:52:40

  Modified:    java/src/org/apache/axis/client Call.java
  Log:
  Fix for AXIS-1709 - Client#setOperation(String) needs to take header params into account (Patch)
  from Michael Schuerig (michael@schuerig.de)
  
  URL: http://issues.apache.org/jira/browse/AXIS-1709
  
  Revision  Changes    Path
  1.236     +38 -2     ws-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.235
  retrieving revision 1.236
  diff -u -r1.235 -r1.236
  --- Call.java	30 Nov 2004 21:54:32 -0000	1.235
  +++ Call.java	21 Jan 2005 16:52:40 -0000	1.236
  @@ -1015,6 +1015,32 @@
       }
   
       /**
  +     * Adds a parameter type as a soap:header.
  +     *
  +     * @param paramName     - Name of the parameter
  +     * @param xmlType       - XML datatype of the parameter
  +     * @param parameterMode - Mode of the parameter-whether IN, OUT or INOUT
  +     * @param headerMode    - Mode of the header. Even if this is an INOUT
  +     *                      parameter, it need not be in the header in both
  +     *                      directions.
  +     * @throws JAXRPCException - if isParameterAndReturnSpecRequired returns
  +     *                         false, then addParameter MAY throw
  +     *                         JAXRPCException....actually Axis allows
  +     *                         modification in such cases
  +     */
  +    public void addParameterAsHeader(QName paramName, QName xmlType,
  +                                     ParameterMode parameterMode,
  +                                     ParameterMode headerMode) {
  +        Class javaType = null;
  +        TypeMapping tm = getTypeMapping();
  +        if (tm != null) {
  +            javaType = tm.getClassForQName(xmlType);
  +        }
  +        addParameterAsHeader(paramName, xmlType, javaType,
  +                parameterMode, headerMode);
  +    }
  +     
  +    /**
   
        * Adds a parameter type as a soap:header.
        * @param paramName - Name of the parameter
  @@ -1409,7 +1435,17 @@
               Parameter p = (Parameter) parameters.list.get(j);
               // Get the QName representing the parameter type
               QName paramType = Utils.getXSIType(p);
  -            this.addParameter( p.getQName(), paramType, modes[p.getMode()]);
  +
  +            // checks whether p is an IN or OUT header 
  +            // and adds it as a header parameter else
  +            // add it to the body
  +            ParameterMode mode = modes[p.getMode()];
  +            if (p.isInHeader() || p.isOutHeader()) {
  +                this.addParameterAsHeader(p.getQName(), paramType,
  +                        mode, mode);
  +            } else {
  +                this.addParameter(p.getQName(), paramType, mode);
  +            } 
           }
   
           Map faultMap = bEntry.getFaults();
  @@ -2762,10 +2798,10 @@
   
       /**
        * Implement async invocation by running the request in a new thread
  -     * @todo this is not a good way to do stuff, as it has no error reporting facility
        * @param msgContext
        */
       private void invokeEngineOneWay(final MessageContext msgContext) {
  +        //TODO: this is not a good way to do stuff, as it has no error reporting facility
           //create a new class
           Runnable runnable = new Runnable(){
               public void run() {