The JAX-RPC specification does not appear to indicate one way or the other whether or not Call objects are reusable. This is perhaps something we need to get clarification on from the TCK folks?
- James M Snell/Fresno/IBM Web services architecture and strategy Internet Emerging Technologies, IBM 544.9035 TIE line 559.587.1233 Office 919.486.0077 Voice Mail [EMAIL PROTECTED] Programming Web Services With SOAP, O'reilly & Associates, ISBN 0596000952 == Have I not commanded you? Be strong and courageous. Do not be terrified, do not be discouraged, for the Lord your God will be with you wherever you go. - Joshua 1:9 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: cvs commit: xml-axis/java/src/org/apache/axis/client Call.java I'm confused - does this mean we can no longer reuse certain call objects???? If so, -1!!! We do that all the time! -Dug Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: cvs commit: xml-axis/java/src/org/apache/axis/client Call.java scheu 2002/06/21 09:49:00 Modified: java/samples/jaxrpc GetQuote1.java java/src/org/apache/axis/client Call.java Log: This fix is required for TCK compliance (Service Test). Problem: When the Call object is set up via the setOperation(...) method, the parmAndRetReq flag was not being set to false. This caused the TCK client to illegally addParameters to an already initialized OperationDesc...ultimately causing Call.invoke to thrown an exception. Solution: When the Call object is set up via the setOperation(...) method, the parmAndRetReq flag is now set to false to indicate that the parameters and return have been set up. This caused a problem in one of the getQuote samples which was attempting to reuse a call object (set up via setOperation(...)) to invoke a different operation. Russell and I agreed that this sample method should be removed since it is trying to change a Call object which was created as immutable. Revision Changes Path 1.4 +0 -59 xml-axis/java/samples/jaxrpc/GetQuote1.java Index: GetQuote1.java =================================================================== RCS file: /home/cvs/xml-axis/java/samples/jaxrpc/GetQuote1.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- GetQuote1.java 11 Jun 2002 14:53:49 -0000 1.3 +++ GetQuote1.java 21 Jun 2002 16:48:59 -0000 1.4 @@ -173,58 +173,6 @@ return ((Float) result).floatValue(); } // getQuote2 - /** - * This method does the same thing that getQuote1 does, but in - * addition it reuses the Call object to make another call. - */ - public float getQuote3(String args[]) throws Exception { - Options opts = new Options(args); - - args = opts.getRemainingArgs(); - - if (args == null) { - System.err.println("Usage: GetQuote <symbol>"); - System.exit(1); - } - - /* Define the service QName and port QName */ - /*******************************************/ - QName servQN = new QName("urn:xmltoday-delayed-quotes", - "GetQuoteService"); - QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote"); - - /* Now use those QNames as pointers into the WSDL doc */ - /******************************************************/ - Service service = ServiceFactory.newInstance().createService( - new URL("file:samples/stock/GetQuote.wsdl"), servQN); - Call call = service.createCall(portQN, "getQuote"); - - /* Strange - but allows the user to change just certain portions of */ - /* the URL we're gonna use to invoke the service. Useful when you */ - /* want to run it thru tcpmon (ie. put -p81 on the cmd line). */ - /********************************************************************/ - opts.setDefaultURL(call.getTargetEndpointAddress()); - call.setTargetEndpointAddress(opts.getURL()); - - /* Define some service specific properties */ - /*******************************************/ - call.setProperty(Call.USERNAME_PROPERTY, opts.getUser()); - call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword()); - - /* Get symbol and invoke the service */ - /*************************************/ - Object result = call.invoke(new Object[] {symbol = args[0]}); - - /* Reuse the Call object for a different call */ - /**********************************************/ - call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "test")); - call.removeAllParameters(); - call.setReturnType(XMLType.XSD_STRING); - - System.out.println(call.invoke(new Object[]{})); - return ((Float) result).floatValue(); - } // getQuote3 - public static void main(String args[]) throws Exception { String save_args[] = new String[args.length]; float val; @@ -242,13 +190,6 @@ System.out.println("Manually"); System.arraycopy(save_args, 0, args, 0, args.length); val = gq.getQuote2(args); - System.out.println(gq.symbol + ": " + val); - - /* Call the getQuote() that uses Axis's generated WSDL */ - /*******************************************************/ - System.out.println("WSDL + Reuse Call"); - System.arraycopy(save_args, 0, args, 0, args.length); - val = gq.getQuote3(args); System.out.println(gq.symbol + ": " + val); } // main } 1.144 +5 -0 xml-axis/java/src/org/apache/axis/client/Call.java Index: Call.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v retrieving revision 1.143 retrieving revision 1.144 diff -u -r1.143 -r1.144 --- Call.java 20 Jun 2002 20:35:46 -0000 1.143 +++ Call.java 21 Jun 2002 16:49:00 -0000 1.144 @@ -1071,6 +1071,11 @@ break ; } } + + // Indicate that the parameters and return no longer + // need to be specified with addParameter calls. + parmAndRetReq = false; + return; } /**