scheu 2002/10/04 13:20:58 Modified: java/samples/attachments Tag: explicitHeaderWork TestRef.java java/src/org/apache/axis Tag: explicitHeaderWork MessageContext.java java/src/org/apache/axis/client Tag: explicitHeaderWork Call.java java/src/org/apache/axis/deployment/wsdd Tag: explicitHeaderWork WSDDConstants.java WSDDService.java java/src/org/apache/axis/description Tag: explicitHeaderWork OperationDesc.java ServiceDesc.java java/src/org/apache/axis/encoding Tag: explicitHeaderWork SerializationContextImpl.java java/src/org/apache/axis/enum Tag: explicitHeaderWork Style.java java/src/org/apache/axis/handlers/soap Tag: explicitHeaderWork SOAPService.java java/src/org/apache/axis/message Tag: explicitHeaderWork BodyBuilder.java RPCElement.java RPCHeaderParam.java java/src/org/apache/axis/providers/java Tag: explicitHeaderWork JavaProvider.java RPCProvider.java java/src/org/apache/axis/wsdl/symbolTable Tag: explicitHeaderWork BindingEntry.java SymbolTable.java java/src/org/apache/axis/wsdl/toJava Tag: explicitHeaderWork JavaDeployWriter.java JavaSkelWriter.java JavaStubWriter.java Utils.java Added: java/src/org/apache/axis/enum Tag: explicitHeaderWork Use.java Log: As part of the SOAP Header support, we needed support for rpc/literal. So I created a Use enum to go along with the existing Style enum. I also changed the description/wsdd/etc. to set and get the Use enum information in a way similar to Syle. Note that the wsdd service now has an additional attribute (use) that can be set to "literal" or "encoded". The default setting is use="literal" if style="document" and use="encoded" if style="rpc". Also fixed the operation QName issue with style=document that was raised in the formum. ------------------------------------------------------------------------ Detailed Changes: MessageContext: added getOperationUse() and setOperationUse() methods. changed the implementation of getPossibleOperationsByQName to correctly get the operations for sytle="document". Previously this code relied on incorrect information in the wsdd. Call : added getOperationUse() and getOperationUse() methods added calls ot set Use on the operationDesc and msgContext just like Style WSDDConstants : added "use" attribute WSDDService : added "use" attribute support OperationDesc : added getUse() and setUse() methods similar to getStyle() and setStyle() ServiceDesc : added getUse() and setUse() methods similar to getStyle() and setStyle() SerializationContextImpl: uses service.getUse() to determine if literal service Style.java : added comments, moved encoding to Use.java Use.java : new file SOAPService: : added getUse() and setUse() similar to getStyle()/setStyle() RPCElement : Code cleanup and usage of operation.getUse() information RPCHeaderParam: Removed unnecessary code BindingEntry : Use Style/Use instead of int constants Changed HeaderParameters to HeaderParts BindingEntry : Use Style/Use instead of int constants Changed HeaderParameters to HeaderParts JavaDeployWriter: set style=/use= in the wsdd changed signature for getOperationQName JavaSkeletonWriter: changed signature for getOperationQName JavaStubWriter: Use Style/Use instead of int constants Generate code to call new Call.setOperationUse(..) toJava.Utils : Changed getOperationQName to really get the operation qname instead of fudging. Revision Changes Path No revision No revision 1.1.8.1 +2 -1 xml-axis/java/samples/attachments/TestRef.java Index: TestRef.java =================================================================== RCS file: /home/cvs/xml-axis/java/samples/attachments/TestRef.java,v retrieving revision 1.1 retrieving revision 1.1.8.1 diff -u -r1.1 -r1.1.8.1 --- TestRef.java 3 Aug 2002 21:52:05 -0000 1.1 +++ TestRef.java 4 Oct 2002 20:20:55 -0000 1.1.8.1 @@ -210,7 +210,8 @@ call.setPassword( opts.getPassword() ); - call.setOperationStyle(org.apache.axis.enum.Style.DOCUMENT_STR); + call.setOperationStyle("document"); + call.setOperationUse("literal"); //Now do the call.... Object ret = call.invoke(new Object[]{ No revision No revision 1.123.6.1 +59 -5 xml-axis/java/src/org/apache/axis/MessageContext.java Index: MessageContext.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v retrieving revision 1.123 retrieving revision 1.123.6.1 diff -u -r1.123 -r1.123.6.1 --- MessageContext.java 24 Sep 2002 20:45:19 -0000 1.123 +++ MessageContext.java 4 Oct 2002 20:20:55 -0000 1.123.6.1 @@ -62,6 +62,7 @@ import org.apache.axis.encoding.TypeMapping; import org.apache.axis.encoding.TypeMappingRegistry; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.session.Session; import org.apache.axis.soap.SOAPConstants; @@ -78,6 +79,7 @@ import javax.xml.rpc.handler.soap.SOAPMessageContext; import java.io.File; import java.util.Hashtable; +import java.util.ArrayList; /** * Some more general docs will go here. @@ -185,7 +187,8 @@ private String username = null; private String password = null; private Style operationStyle = Style.RPC; - private String encodingStyle = operationStyle.getEncoding(); + private Use operationUse = Use.ENCODED; + private String encodingStyle = operationUse.getEncoding(); private boolean useSOAPAction = false; private String SOAPActionURI = null; @@ -207,6 +210,16 @@ currentOperation = operation; } + /** + * getPossibleOperationsByQName + * Returns a list of operation descriptors that could may + * possibly match a body containing an element of the given QName. + * For non-DOCUMENT, the list of operation descriptors that match + * the name is returned. For DOCUMENT, all the operations that have + * qname as a parameter are returned + * @param qname of the first element in the body + * @return list of operation descriptions + */ public OperationDesc [] getPossibleOperationsByQName(QName qname) throws AxisFault { if (currentOperation != null) { @@ -235,11 +248,31 @@ ServiceDesc desc = serviceHandler.getInitializedServiceDesc(this); if (desc != null) { - possibleOperations = desc.getOperationsByQName(qname); setOperationStyle(desc.getStyle()); + setOperationUse(desc.getUse()); + if (desc.getStyle() != Style.DOCUMENT) { + possibleOperations = desc.getOperationsByQName(qname); + } else { + // DOCUMENT Style + // Get all of the operations that have qname as + // a possible parameter QName + ArrayList allOperations = desc.getOperations(); + ArrayList foundOperations = new ArrayList(); + for (int i=0; i < allOperations.size(); i++ ) { + OperationDesc tryOp = + (OperationDesc) allOperations.get(i); + if (tryOp.getParamByQName(qname) != null) { + foundOperations.add(tryOp); + } + } + if (foundOperations.size() > 0) { + possibleOperations = (OperationDesc[]) + JavaUtils.convert(foundOperations, + OperationDesc[].class); + } + } } } - return possibleOperations; } @@ -401,7 +434,8 @@ * Encoding */ public boolean isEncoded() { - return soapConstants.getEncodingURI().equals(encodingStyle); + return (operationUse == Use.ENCODED); + //return soapConstants.getEncodingURI().equals(encodingStyle); } /** @@ -614,9 +648,10 @@ TypeMappingRegistry tmr = service.getTypeMappingRegistry(); setTypeMappingRegistry(tmr); setOperationStyle(service.getStyle()); + setOperationUse(service.getUse()); // styles are not "soap version aware" so compensate... - setEncodingStyle(service.getStyle().getEncoding()); + setEncodingStyle(service.getUse().getEncoding()); // This MessageContext should now defer properties it can't find // to the Service's options. @@ -770,6 +805,11 @@ name, "java.lang.String", value.getClass().getName()})); } setOperationStyle(Style.getStyle((String)value, Style.DEFAULT)); + if (getOperationStyle() == Style.RPC) { + setOperationUse(Use.ENCODED); + } else if (getOperationStyle() == Style.DOCUMENT) { + setOperationUse(Use.LITERAL); + } } else if (name.equals(Call.SOAPACTION_USE_PROPERTY)) { if (!(value instanceof Boolean)) { @@ -912,6 +952,20 @@ public Style getOperationStyle() { return operationStyle; } // getOperationStyle + + /** + * Set the operation use. + */ + public void setOperationUse(Use operationUse) { + this.operationUse = operationUse; + } // setOperationUse + + /** + * Get the operation use. + */ + public Use getOperationUse() { + return operationUse; + } // getOperationUse /** * Should soapAction be used? No revision No revision 1.180.4.3 +32 -14 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.180.4.2 retrieving revision 1.180.4.3 diff -u -r1.180.4.2 -r1.180.4.3 --- Call.java 2 Oct 2002 20:39:05 -0000 1.180.4.2 +++ Call.java 4 Oct 2002 20:20:55 -0000 1.180.4.3 @@ -66,6 +66,7 @@ import org.apache.axis.description.OperationDesc; import org.apache.axis.description.ParameterDesc; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.encoding.DeserializerFactory; import org.apache.axis.encoding.SerializationContext; import org.apache.axis.encoding.SerializationContextImpl; @@ -170,7 +171,8 @@ private String username = null; private String password = null; private boolean maintainSession = false; - private Style operationStyle = Style.DEFAULT; + private Style operationStyle = Style.RPC; + private Use operationUse = Use.ENCODED; private boolean useSOAPAction = false; private String SOAPActionURI = null; private Integer timeout = null; @@ -332,6 +334,12 @@ name, "java.lang.String", value.getClass().getName()})); } setOperationStyle((String) value); + if (getOperationStyle() == Style.DOCUMENT || + getOperationStyle() == Style.WRAPPED) { + setOperationUse(Use.LITERAL_STR); + } else if (getOperationStyle() == Style.RPC) { + setOperationUse(Use.ENCODED_STR); + } } else if (name.equals(SOAPACTION_USE_PROPERTY)) { if (!(value instanceof Boolean)) { @@ -527,22 +535,14 @@ } /** - * Set the operation style. IllegalArgumentException is thrown if operationStyle - * is not "rpc" or "document". - * - * @exception IllegalArgumentException if operationStyle is not "rpc" or "document". + * Set the operation style: "document", "rpc" + * @param operationStyle string designating style */ public void setOperationStyle(String operationStyle) { - this.operationStyle = Style.getStyle(operationStyle, Style.DEFAULT); - -/* Not being used for now... --GD - throw new IllegalArgumentException(Messages.getMessage( - "badProp01", - new String[] {OPERATION_STYLE_PROPERTY, - "\"rpc\", \"document\"", operationStyle})); -*/ + this.operationStyle = + Style.getStyle(operationStyle, Style.DEFAULT); } // setOperationStyle - + /** * Get the operation style. */ @@ -551,6 +551,22 @@ } // getOperationStyle /** + * Set the operation use: "literal", "encoded" + * @param operationUse string designating use + */ + public void setOperationUse(String operationUse) { + this.operationUse = + Use.getUse(operationUse, Use.DEFAULT); + } // setOperationUse + + /** + * Get the operation use. + */ + public Use getOperationUse() { + return operationUse; + } // getOperationStyle + + /** * Should soapAction be used? */ public void setUseSOAPAction(boolean useSOAPAction) { @@ -2057,7 +2073,9 @@ msgContext.setOperation(operation); operation.setStyle(getOperationStyle()); + operation.setUse(getOperationUse()); msgContext.setOperationStyle(getOperationStyle()); + msgContext.setOperationUse(getOperationUse()); if (useSOAPAction) { msgContext.setUseSOAPAction(true); No revision No revision 1.23.6.2 +1 -0 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java Index: WSDDConstants.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java,v retrieving revision 1.23.6.1 retrieving revision 1.23.6.2 diff -u -r1.23.6.1 -r1.23.6.2 --- WSDDConstants.java 2 Oct 2002 20:39:06 -0000 1.23.6.1 +++ WSDDConstants.java 4 Oct 2002 20:20:55 -0000 1.23.6.2 @@ -170,6 +170,7 @@ public static final String ATTR_OUTHEADER = "outHeader"; public static final String ATTR_RETHEADER = "returnHeader"; public static final String ATTR_STYLE = "style"; + public static final String ATTR_USE = "use"; public static final String ATTR_STREAMING = "streaming"; public static final String ATTR_ATTACHMENT_FORMAT = "attachment"; public static final String ATTR_PROVIDER = "provider"; 1.95.4.1 +45 -10 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java Index: WSDDService.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v retrieving revision 1.95 retrieving revision 1.95.4.1 diff -u -r1.95 -r1.95.4.1 --- WSDDService.java 25 Sep 2002 20:41:31 -0000 1.95 +++ WSDDService.java 4 Oct 2002 20:20:55 -0000 1.95.4.1 @@ -73,6 +73,7 @@ import org.apache.axis.encoding.ser.BaseDeserializerFactory; import org.apache.axis.encoding.ser.BaseSerializerFactory; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.providers.java.JavaProvider; import org.apache.axis.utils.Messages; @@ -108,8 +109,10 @@ private String descriptionURL; - /** Style - document or RPC (the default) */ + /** Style - document, wrapped, message, or RPC (the default) */ private Style style = Style.DEFAULT; + /** Use - encoded (the default) or literal */ + private Use use = Use.DEFAULT; private SOAPService cachedService = null; @@ -161,6 +164,18 @@ providerQName = style.getProvider(); } + String useStr = e.getAttribute(ATTR_USE); + if (useStr != null && !useStr.equals("")) { + use = Use.getUse(useStr, Use.DEFAULT); + desc.setUse(use); + } else { + if (style != Style.RPC) { + // Default to use=literal if not style=RPC + use = Use.LITERAL; + desc.setUse(use); + } + } + String streamStr = e.getAttribute(ATTR_STREAMING); if (streamStr != null && streamStr.equals("on")) { streaming = true; @@ -267,7 +282,7 @@ initTMR(); } desc.setTypeMappingRegistry(tmr); - desc.setTypeMapping(getTypeMapping(desc.getStyle().getEncoding())); + desc.setTypeMapping(getTypeMapping(desc.getUse().getEncoding())); String allowedMethods = getParameter(JavaProvider.OPTION_ALLOWEDMETHODS); if (allowedMethods != null && !"*".equals(allowedMethods)) { @@ -331,6 +346,10 @@ this.providerQName = providerQName; } + public ServiceDesc getServiceDesc() { + return desc; + } + /** * Get the service style - document or RPC */ @@ -338,10 +357,6 @@ return style; } - public ServiceDesc getServiceDesc() { - return desc; - } - /** * Set the service style - document or RPC */ @@ -350,6 +365,19 @@ } /** + * Get the service use - literal or encoded + */ + public Use getUse() { + return use; + } + + /** + * Set the service use - literal or encoded + */ + public void setUse(Use use) { + this.use = use; + } + /** * * @return XXX */ @@ -436,6 +464,7 @@ SOAPService service = new SOAPService(reqHandler, providerHandler, respHandler); service.setStyle(style); + service.setUse(use); service.setHighFidelityRecording(!streaming); service.setSendType(sendType); @@ -445,8 +474,9 @@ service.setEngine(((WSDDDeployment)registry).getEngine()); - if (style != Style.RPC) { - // No Multirefs/xsi:types + if (use != Use.ENCODED) { + // If not encoded, turn off multi-refs and prefer + // not to sent xsi:type and xsi:nil service.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE); } @@ -494,10 +524,10 @@ } try { // Get the encoding style from the mapping, if it isn't set - // use the style of the service to map doc/lit or rpc/enc + // use the use of the service to map doc/lit or rpc/enc String encodingStyle = mapping.getEncodingStyle(); if (encodingStyle == null) { - encodingStyle = style.getEncoding(); + encodingStyle = use.getEncoding(); } TypeMapping tm = (TypeMapping) tmr.getTypeMapping(encodingStyle); TypeMapping df = (TypeMapping) tmr.getDefaultTypeMapping(); @@ -560,6 +590,11 @@ if (style != Style.DEFAULT) { attrs.addAttribute("", ATTR_STYLE, ATTR_STYLE, "CDATA", style.getName()); + } + + if (use != Use.DEFAULT) { + attrs.addAttribute("", ATTR_USE, ATTR_USE, + "CDATA", use.getName()); } if (streaming) { No revision No revision 1.23.4.2 +25 -1 xml-axis/java/src/org/apache/axis/description/OperationDesc.java Index: OperationDesc.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/OperationDesc.java,v retrieving revision 1.23.4.1 retrieving revision 1.23.4.2 diff -u -r1.23.4.1 -r1.23.4.2 --- OperationDesc.java 2 Oct 2002 19:32:48 -0000 1.23.4.1 +++ OperationDesc.java 4 Oct 2002 20:20:56 -0000 1.23.4.2 @@ -63,6 +63,7 @@ import org.apache.commons.logging.Log; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; /** @@ -105,8 +106,9 @@ /** The actual Java method associated with this operation, if known */ private Method method; - /** This operation's style. If null, we default to our parent's */ + /** This operation's style/use. If null, we default to our parent's */ private Style style = null; + private Use use = null; /** The number of "in" params (i.e. IN or INOUT) for this operation */ private int numInParams = 0; @@ -227,6 +229,27 @@ return style; } + public void setUse(Use use) + { + this.use = use; + } + + /** + * Return the use of the operation, defaulting to the parent + * ServiceDesc's use if we don't have one explicitly set. + */ + public Use getUse() + { + if (use == null) { + if (parent != null) { + return parent.getUse(); + } + return Use.DEFAULT; // Default + } + + return use; + } + public void addParameter(ParameterDesc param) { // Should we enforce adding INs then INOUTs then OUTs? @@ -380,6 +403,7 @@ text+=indent+"elementQName:" + getElementQName() + "\n"; text+=indent+"soapAction: " + getSoapAction() + "\n"; text+=indent+"style: " + getStyle().getName() + "\n"; + text+=indent+"use: " + getUse().getName() + "\n"; text+=indent+"numInParams: " + getNumInParams() + "\n"; text+=indent+"method:" + getMethod() + "\n"; for (int i=0; i<parameters.size(); i++) { 1.64.4.1 +21 -5 xml-axis/java/src/org/apache/axis/description/ServiceDesc.java Index: ServiceDesc.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v retrieving revision 1.64 retrieving revision 1.64.4.1 diff -u -r1.64 -r1.64.4.1 --- ServiceDesc.java 29 Sep 2002 19:35:52 -0000 1.64 +++ ServiceDesc.java 4 Oct 2002 20:20:56 -0000 1.64.4.1 @@ -65,6 +65,7 @@ import org.apache.axis.encoding.TypeMappingRegistry; import org.apache.axis.encoding.TypeMappingRegistryImpl; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.utils.JavaUtils; import org.apache.axis.utils.Messages; import org.apache.axis.utils.bytecode.ParamNameExtractor; @@ -111,8 +112,9 @@ /** List if disallowed methods */ private List disallowedMethods = null; - /** Style */ + /** Style/Use */ private Style style = Style.RPC; + private Use use = Use.ENCODED; /** Implementation class */ private Class implClass = null; @@ -192,6 +194,18 @@ } /** + * What kind of use is this? + * @return + */ + public Use getUse() { + return use; + } + + public void setUse(Use use) { + this.use = use; + } + + /** * Determine whether or not this is a "wrapped" invocation, i.e. whether * the outermost XML element of the "main" body element represents a * method call, with the immediate children of that element representing @@ -202,7 +216,8 @@ */ public boolean isWrapped() { - return ((style == Style.RPC) || (style == Style.WRAPPED)); + return ((style == Style.RPC) || + (style == Style.WRAPPED)); } /** @@ -432,9 +447,10 @@ if (overloads == null) { // Nothing specifically matching this QName. - if (((style == Style.RPC) || ((style==Style.MESSAGE) && - (getDefaultNamespace() == null))) && - (name2OperationsMap != null)) { + if ((isWrapped() || + ((style==Style.MESSAGE) && + (getDefaultNamespace() == null))) && + (name2OperationsMap != null)) { // Try ignoring the namespace....? overloads = (ArrayList)name2OperationsMap.get(qname.getLocalPart()); } No revision No revision 1.77.4.1 +3 -2 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.77 retrieving revision 1.77.4.1 diff -u -r1.77 -r1.77.4.1 --- SerializationContextImpl.java 30 Sep 2002 20:05:23 -0000 1.77 +++ SerializationContextImpl.java 4 Oct 2002 20:20:56 -0000 1.77.4.1 @@ -67,6 +67,7 @@ import org.apache.axis.wsdl.symbolTable.SchemaUtils; import org.apache.axis.encoding.ser.BaseSerializerFactory; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.attachments.Attachments; import org.apache.axis.client.Call; @@ -270,11 +271,11 @@ sendXSIType = false ; } - // A Document-style service overrides the above settings. Don't + // A Literal use service overrides the above settings. Don't // send xsi:type, and don't do multiref in that case. SOAPService service = msgContext.getService(); if (service != null) { - if (service.getStyle() != Style.RPC) { + if (service.getUse() != Use.ENCODED) { sendXSIType = false; doMultiRefs = false; } No revision No revision 1.5.8.1 +59 -27 xml-axis/java/src/org/apache/axis/enum/Style.java Index: Style.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/enum/Style.java,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -u -r1.5 -r1.5.8.1 --- Style.java 2 Jul 2002 18:07:31 -0000 1.5 +++ Style.java 4 Oct 2002 20:20:56 -0000 1.5.8.1 @@ -65,13 +65,66 @@ * @author rsitze */ public class Style extends Enum { + + /** + * Description of the different styles + * + * style=rpc use=encoded + * First element of the SOAP body is the + * operation. The operation contains + * elements describing the parameters, which + * are serialized as encoded (possibly multi-ref) + * <soap:body> + * <operation> + * <arg1>...</arg1> + * <arg2>...</arg2> + * </operation> + * + * style=RPC use=literal + * First element of the SOAP body is the + * operation. The operation contains elements + * describing the parameters, which are serialized + * as encoded (no multi-ref) + * <soap:body> + * <operation> + * <arg1>...</arg1> + * <arg2>...</arg2> + * </operation> + * + * style=document use=literal + * Elements of the SOAP body are the names of the parameters + * (there is no wrapper operation...no multi-ref) + * + * <soap:body> + * <arg1>...</arg1> + * <arg2>...</arg2> + * + * + * style=wrapped + * Special case of DOCLIT where there is only one parameter + * and it has the same qname as the operation. In + * such cases, there is no actual type with the name...the + * elements are treated as parameters to the operation + * + * <soap:body> + * <one-arg-same-name-as-operation> + * <elemofarg1>...</elemofarg1> + * <elemofarg2>...</elemofarg2> + * + * style=document use=encoded + * This mode doesn't seem to make any sense... + * Like DOCLIT but the parms are encoded? + * + */ + private static final Type type = new Type(); public static final String RPC_STR = "rpc"; public static final String DOCUMENT_STR = "document"; public static final String WRAPPED_STR = "wrapped"; public static final String MESSAGE_STR = "message"; - + + public static final Style RPC = type.getStyle(RPC_STR); public static final Style DOCUMENT = type.getStyle(DOCUMENT_STR); public static final Style WRAPPED = type.getStyle(WRAPPED_STR); @@ -83,18 +136,10 @@ private QName provider; - private String encoding; - - - // public int getValue(); - // public String getName(); - // public Type getType(); - public static Style getDefault() { return (Style)type.getDefault(); } public final QName getProvider() { return provider; } - public final String getEncoding() { return encoding; } public static final Style getStyle(int style) { return type.getStyle(style); @@ -124,17 +169,13 @@ private Type() { super("style", new Enum[] { new Style(0, RPC_STR, - WSDDConstants.QNAME_JAVARPC_PROVIDER, - Constants.URI_DEFAULT_SOAP_ENC), + WSDDConstants.QNAME_JAVARPC_PROVIDER), new Style(1, DOCUMENT_STR, - WSDDConstants.QNAME_JAVARPC_PROVIDER, - Constants.URI_LITERAL_ENC), + WSDDConstants.QNAME_JAVARPC_PROVIDER), new Style(2, WRAPPED_STR, - WSDDConstants.QNAME_JAVARPC_PROVIDER, - Constants.URI_LITERAL_ENC), + WSDDConstants.QNAME_JAVARPC_PROVIDER), new Style(3, MESSAGE_STR, - WSDDConstants.QNAME_JAVAMSG_PROVIDER, - Constants.URI_LITERAL_ENC) + WSDDConstants.QNAME_JAVAMSG_PROVIDER), }); } @@ -149,19 +190,10 @@ public final Style getStyle(String style, Style dephault) { return (Style)this.getEnum(style, dephault); } - - // public final String getName(); - // public boolean isValid(String enumName); - // public final int size(); - // public final String[] getEnumNames(); - // public final Enum getEnum(int enum); - // public final Enum getEnum(String enumName); - // public final Enum getEnum(String enumName, Enum dephault); } - private Style(int value, String name, QName provider, String encoding) { + private Style(int value, String name, QName provider) { super(type, value, name); this.provider = provider; - this.encoding = encoding; } }; No revision No revision 1.1.2.1 +144 -0 xml-axis/java/src/org/apache/axis/enum/Attic/Use.java No revision No revision 1.85.2.1 +9 -0 xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java Index: SOAPService.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v retrieving revision 1.85 retrieving revision 1.85.2.1 diff -u -r1.85 -r1.85.2.1 --- SOAPService.java 2 Oct 2002 15:27:11 -0000 1.85 +++ SOAPService.java 4 Oct 2002 20:20:56 -0000 1.85.2.1 @@ -65,6 +65,7 @@ import org.apache.axis.description.ServiceDesc; import org.apache.axis.encoding.TypeMappingRegistry; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.handlers.BasicHandler; import org.apache.axis.handlers.HandlerChainImpl; import org.apache.axis.handlers.HandlerInfoChainFactory; @@ -298,6 +299,14 @@ public void setStyle(Style style) { serviceDescription.setStyle(style); + } + + public Use getUse() { + return serviceDescription.getUse(); + } + + public void setUse(Use style) { + serviceDescription.setUse(style); } public ServiceDesc getServiceDescription() { No revision No revision 1.52.6.1 +4 -3 xml-axis/java/src/org/apache/axis/message/BodyBuilder.java Index: BodyBuilder.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v retrieving revision 1.52 retrieving revision 1.52.6.1 diff -u -r1.52 -r1.52.6.1 --- BodyBuilder.java 24 Sep 2002 20:45:20 -0000 1.52 +++ BodyBuilder.java 4 Oct 2002 20:20:56 -0000 1.52.6.1 @@ -146,8 +146,9 @@ MessageContext msgContext = context.getMessageContext(); OperationDesc [] operations = null; try { - if(msgContext != null) - operations = msgContext.getPossibleOperationsByQName(qname); + if(msgContext != null) { + operations = msgContext.getPossibleOperationsByQName(qname); + } // If there's only one match, set it in the MC now if ((operations != null) && (operations.length == 1)) @@ -206,7 +207,7 @@ SOAPConstants.SOAP11_CONSTANTS : context.getMessageContext().getSOAPConstants(); if (element == null) { - if (style == Style.RPC && + if ((style == Style.RPC) && soapConstants == SOAPConstants.SOAP12_CONSTANTS) { throw new SAXException(Messages.getMessage("onlyOneBodyFor12")); } 1.76.4.3 +36 -29 xml-axis/java/src/org/apache/axis/message/RPCElement.java Index: RPCElement.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v retrieving revision 1.76.4.2 retrieving revision 1.76.4.3 diff -u -r1.76.4.2 -r1.76.4.3 --- RPCElement.java 2 Oct 2002 23:37:37 -0000 1.76.4.2 +++ RPCElement.java 4 Oct 2002 20:20:56 -0000 1.76.4.3 @@ -64,6 +64,7 @@ import org.apache.axis.encoding.DeserializationContext; import org.apache.axis.encoding.SerializationContext; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.utils.Messages; import org.apache.axis.wsdl.toJava.Utils; @@ -81,7 +82,6 @@ { protected Vector params = new Vector(); protected boolean needDeser = false; - protected boolean elementIsFirstParam = false; OperationDesc [] operations = null; public RPCElement(String namespace, @@ -116,12 +116,6 @@ operations = serviceDesc.getOperationsByName(lc); } } - - if (operations != null && operations.length > 0) { - // if we're document style, the top level element is important - elementIsFirstParam = (operations[0].getStyle() == Style.DOCUMENT); - } - this.operations = operations; } @@ -158,7 +152,7 @@ public void deserialize() throws SAXException { needDeser = false; - + MessageContext msgContext = context.getMessageContext(); // Figure out if we should be looking for out params or in params @@ -187,24 +181,34 @@ boolean needHeaderProcessing = needHeaderProcessing(operation, isResponse); - if (operation.getNumInParams() >= numParams || - elementIsFirstParam || - operation.getStyle() == Style.WRAPPED) { - // If the Style is WRAPPED, the numParams may be inflated - // as in the following case: - // <getAttractions xmlns="urn:CityBBB"> - // <attname>Christmas</attname> - // <attname>Xmas</attname> - // </getAttractions> - // - // for getAttractions(String[] attName) - // - // numParams will be 2 and and operation.getNumInParams=1 + // Make a quick check to determine if the operation + // could be a match. + // 1) The element is the first param, DOCUMENT, (i.e. + // don't know the operation name or the number + // of params, so try all operations). + // or (2) Style is literal + // If the Style is LITERAL, the numParams may be inflated + // as in the following case: + // <getAttractions xmlns="urn:CityBBB"> + // <attname>Christmas</attname> + // <attname>Xmas</attname> + // </getAttractions> + // for getAttractions(String[] attName) + // numParams will be 2 and and operation.getNumInParams=1 + // or (3) Number of expected params is + // >= num params in message + if (operation.getStyle() == Style.DOCUMENT || + operation.getStyle() == Style.WRAPPED || + operation.getUse() == Use.LITERAL || + operation.getNumInParams() >= numParams) { - // Set the operation so the RPCHandler can get at it rpcHandler.setOperation(operation); try { - if (elementIsFirstParam && operation.getNumInParams() > 0) { + // If no operation name and more than one + // parameter is expected, don't + // wrap the rpcHandler in an EnvelopeHandler. + if ((operation.getStyle() == Style.DOCUMENT) && + operation.getNumInParams() > 0) { context.pushElementHandler(rpcHandler); context.setCurElement(null); } else { @@ -254,7 +258,10 @@ rpcHandler.setOperation(operations[0]); } - if (elementIsFirstParam) { + // Same logic as above. Don't wrap rpcHandler + // if there is no operation wrapper in the message + if (operations != null && operations.length > 0 && + (operations[0].getStyle() == Style.DOCUMENT)) { context.pushElementHandler(rpcHandler); context.setCurElement(null); } else { @@ -301,9 +308,9 @@ protected void outputImpl(SerializationContext context) throws Exception { MessageContext msgContext = context.getMessageContext(); - boolean isRPC = + boolean hasOperationElement = (msgContext == null || - msgContext.getOperationStyle() == Style.RPC || + msgContext.getOperationStyle() == Style.RPC || msgContext.getOperationStyle() == Style.WRAPPED); // When I have MIME and a no-param document WSDL, if I don't check @@ -312,7 +319,7 @@ // found in an RPC-style (and wrapped) request boolean noParams = params.size() == 0; - if (isRPC || noParams) { + if (hasOperationElement || noParams) { // Set default namespace if appropriate (to avoid prefix mappings // in literal style). Do this only if there is no encodingStyle. if (encodingStyle != null && encodingStyle.equals("")) { @@ -323,13 +330,13 @@ for (int i = 0; i < params.size(); i++) { RPCParam param = (RPCParam)params.elementAt(i); - if (!isRPC && encodingStyle.equals("")) { + if (!hasOperationElement && encodingStyle.equals("")) { context.registerPrefixForURI("", param.getQName().getNamespaceURI()); } param.serialize(context); } - if (isRPC || noParams) { + if (hasOperationElement || noParams) { context.endElement(); } } 1.1.2.2 +1 -6 xml-axis/java/src/org/apache/axis/message/Attic/RPCHeaderParam.java Index: RPCHeaderParam.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/Attic/RPCHeaderParam.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- RPCHeaderParam.java 2 Oct 2002 20:39:06 -0000 1.1.2.1 +++ RPCHeaderParam.java 4 Oct 2002 20:20:57 -0000 1.1.2.2 @@ -57,7 +57,6 @@ import org.apache.axis.MessageContext; import org.apache.axis.encoding.SerializationContext; -import org.apache.axis.enum.Style; public class RPCHeaderParam extends SOAPHeaderElement { @@ -76,14 +75,10 @@ protected void outputImpl(SerializationContext context) throws Exception { MessageContext msgContext = context.getMessageContext(); - boolean isRPC = - (msgContext == null || - msgContext.getOperationStyle() == Style.RPC || - msgContext.getOperationStyle() == Style.WRAPPED); // Get the RPCParam and serialize it RPCParam rpcParam = (RPCParam) getObjectValue(); - if (!isRPC && encodingStyle.equals("")) { + if (encodingStyle != null && encodingStyle.equals("")) { context.registerPrefixForURI("", rpcParam.getQName().getNamespaceURI()); } rpcParam.serialize(context); No revision No revision 1.85.4.1 +4 -2 xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java Index: JavaProvider.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v retrieving revision 1.85 retrieving revision 1.85.4.1 diff -u -r1.85 -r1.85.4.1 --- JavaProvider.java 26 Sep 2002 20:59:58 -0000 1.85 +++ JavaProvider.java 4 Oct 2002 20:20:57 -0000 1.85.4.1 @@ -66,6 +66,7 @@ import org.apache.axis.encoding.TypeMapping; import org.apache.axis.enum.Scope; import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.providers.BasicProvider; @@ -75,8 +76,6 @@ import org.apache.axis.utils.cache.JavaClass; import org.apache.axis.wsdl.fromJava.Emitter; import org.apache.axis.encoding.TypeMapping; -import org.apache.axis.enum.Style; -import org.apache.axis.enum.Scope; import org.apache.axis.Constants; import org.apache.axis.session.Session; import org.apache.axis.description.ServiceDesc; @@ -375,6 +374,9 @@ if(alias != null) emitter.setServiceElementName(alias); Style style = serviceDesc.getStyle(); + + // The emitter should be fixed to support all + // the Style/Use flavors. if (style == Style.RPC) { emitter.setMode(Emitter.MODE_RPC); } else if (style == Style.DOCUMENT) { 1.96.6.3 +1 -1 xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java Index: RPCProvider.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v retrieving revision 1.96.6.2 retrieving revision 1.96.6.3 diff -u -r1.96.6.2 -r1.96.6.3 --- RPCProvider.java 4 Oct 2002 15:02:22 -0000 1.96.6.2 +++ RPCProvider.java 4 Oct 2002 20:20:57 -0000 1.96.6.3 @@ -162,7 +162,7 @@ // arguments (which is a strange thing to have, but whatever) if (body == null) { // throw an error if this isn't a document style service - if (!serviceDesc.getStyle().equals(Style.DOCUMENT)) { + if (!(serviceDesc.getStyle().equals(Style.DOCUMENT))) { throw new Exception(Messages.getMessage("noBody00")); } No revision No revision 1.3.8.3 +76 -73 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/BindingEntry.java Index: BindingEntry.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/BindingEntry.java,v retrieving revision 1.3.8.2 retrieving revision 1.3.8.3 diff -u -r1.3.8.2 -r1.3.8.3 --- BindingEntry.java 3 Oct 2002 20:11:20 -0000 1.3.8.2 +++ BindingEntry.java 4 Oct 2002 20:20:57 -0000 1.3.8.3 @@ -57,6 +57,8 @@ import java.util.HashMap; import java.util.Map; +import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import javax.wsdl.Binding; import javax.wsdl.Operation; @@ -67,9 +69,6 @@ * from the WSDL4J Binding object: binding type, binding style, input/output/fault body types. */ public class BindingEntry extends SymTabEntry { - // Binding styles - public static final int STYLE_RPC = 0; - public static final int STYLE_DOCUMENT = 1; // Binding types public static final int TYPE_SOAP = 0; @@ -83,7 +82,7 @@ private Binding binding; private int bindingType; - private int bindingStyle; + private Style bindingStyle; private boolean hasLiteral; private HashMap attributes; private HashMap parameters = new HashMap(); @@ -93,18 +92,18 @@ private Map mimeTypes; // This is a map of a map. It's a map keyed on operation name whose values - // are maps keyed on parameter name. The ultimate values are simple + // are maps keyed on part name. The ultimate values are simple // Booleans. - private Map headerParameters; + private Map headerParts; /** * Construct a BindingEntry from a WSDL4J Binding object and the additional binding info: * binding type, binding style, whether there is any literal binding, and the attributes which * contain the input/output/fault body type information. */ - public BindingEntry(Binding binding, int bindingType, int bindingStyle, + public BindingEntry(Binding binding, int bindingType, Style bindingStyle, boolean hasLiteral, HashMap attributes, Map mimeTypes, - Map headerParameters) { + Map headerParts) { super(binding.getQName()); this.binding = binding; this.bindingType = bindingType; @@ -122,11 +121,11 @@ else { this.mimeTypes = mimeTypes; } - if (headerParameters == null) { - this.headerParameters = new HashMap(); + if (headerParts == null) { + this.headerParts = new HashMap(); } else { - this.headerParameters = headerParameters; + this.headerParts = headerParts; } } // ctor @@ -135,7 +134,7 @@ * defaults. If the defaults aren't desired, then the appropriate * setter method should be called. The defaults are: * bindingType = TYPE_UNKNOWN - * bindingStyle = STYLE_DOCUMENT + * bindingStyle = DOCUMENT * hasLiteral = false * operation inputBodyTypes = USE_ENCODED * operation outputBodyTypes = USE_ENCODED @@ -151,11 +150,11 @@ super(binding.getQName()); this.binding = binding; this.bindingType = TYPE_UNKNOWN; - this.bindingStyle = STYLE_DOCUMENT; + this.bindingStyle = Style.DOCUMENT; this.hasLiteral = false; this.attributes = new HashMap(); this.mimeTypes = new HashMap(); - this.headerParameters = new HashMap(); + this.headerParts = new HashMap(); } // ctor /** @@ -213,58 +212,66 @@ } // setMIMEType /** - * Is this parameter an input header parameter?. + * Is this part an input header part?. */ - public boolean isInHeaderParameter(String operationName, - String parameterName) { - return (headerParameter(operationName, parameterName) & IN_HEADER) > 0; - } // isInHeaderParameter + public boolean isInHeaderPart(String operationName, + String partName) { + return (headerPart(operationName, partName) & IN_HEADER) > 0; + } // isInHeaderPart /** - * Is this parameter an output header parameter?. + * Is this part an output header part?. */ - public boolean isOutHeaderParameter(String operationName, - String parameterName) { - return (headerParameter(operationName, parameterName) & OUT_HEADER) > 0; - } // isInHeaderParameter + public boolean isOutHeaderPart(String operationName, + String partName) { + return (headerPart(operationName, partName) & OUT_HEADER) > 0; + } // isInHeaderPart /** - * Get the flag indicating what sort of header this parameter is. + * Get the flag indicating what sort of header this part is. */ public static final int NO_HEADER = 0; public static final int IN_HEADER = 1; public static final int OUT_HEADER = 2; - private int headerParameter(String operationName, String parameterName) { - Map opMap = (Map) headerParameters.get(operationName); + /** + * Get the mime mapping for the given part name. + * If there is none, this returns null. + * @param operationName + * @param partName + * @return flag indicating kind of header + */ + private int headerPart(String operationName, + String partName) { + Map opMap = (Map) headerParts.get(operationName); if (opMap == null) { return NO_HEADER; } else { - Integer I = (Integer) opMap.get(parameterName); + Integer I = (Integer) opMap.get(partName); return I == null ? NO_HEADER : I.intValue(); } - } // headerParameter + } // headerPart /** * Get the header parameter map. */ - public Map getHeaderParameters() { - return headerParameters; - } // getHeaderParameters + public Map getHeaderParts() { + return headerParts; + } // getHeaderParts /** - * Set the header parameter mapping for the given parameter name. + * Set the header part mapping for the given part name. */ - public void setHeaderParameter(String operationName, String parameterName, int headerFlags) { - Map opMap = (Map) headerParameters.get(operationName); + public void setHeaderPart(String operationName, String partName, int headerFlags) { + Map opMap = (Map) headerParts.get(operationName); if (opMap == null) { opMap = new HashMap(); - headerParameters.put(operationName, opMap); + headerParts.put(operationName, opMap); } - Integer I = (Integer) opMap.get(parameterName); + Integer I = (Integer) opMap.get(partName); int i = I == null ? headerFlags : (I.intValue() | headerFlags); - opMap.put(parameterName, new Integer(i)); - } // setHeaderParameter + opMap.put(partName, new Integer(i)); + } // setHeaderPart /** * Get this entry's WSDL4J Binding object. @@ -291,19 +298,17 @@ } // setBindingType /** - * Get this entry's binding style. One of BindingEntry.STYLE_RPC, BindingEntry.STYLE_DOCUMENT. + * Get this entry's binding style. */ - public int getBindingStyle() { + public Style getBindingStyle() { return bindingStyle; } // getBindingStyle /** * Set this entry's binding style. */ - protected void setBindingStyle(int bindingStyle) { - if (bindingStyle == STYLE_RPC || bindingStyle == STYLE_DOCUMENT) { - this.bindingStyle = bindingStyle; - } + protected void setBindingStyle(Style bindingStyle) { + this.bindingStyle = bindingStyle; } // setBindingStyle /** @@ -321,13 +326,12 @@ } // setHashLiteral /** - * Get the input body type for the given operation. One of BindingEntry.USE_ENCODED, - * BindingEntry.USE_LITERAL. + * Get the input body type for the given operation. */ - public int getInputBodyType(Operation operation) { + public Use getInputBodyType(Operation operation) { OperationAttr attr = (OperationAttr) attributes.get(operation); if (attr == null) { - return USE_ENCODED; // should really create an exception for this. + return Use.ENCODED; // should really create an exception for this. } else { return attr.getInputBodyType(); @@ -337,26 +341,25 @@ /** * Set the input body type for the given operation. */ - protected void setInputBodyType(Operation operation, int inputBodyType) { + protected void setInputBodyType(Operation operation, Use inputBodyType) { OperationAttr attr = (OperationAttr) attributes.get(operation); if (attr == null) { attr = new OperationAttr(); attributes.put(operation, attr); } attr.setInputBodyType(inputBodyType); - if (inputBodyType == USE_LITERAL) { + if (inputBodyType == Use.LITERAL) { setHasLiteral(true); } } // setInputBodyType /** - * Get the output body type for the given operation. One of BindingEntry.USE_ENCODED, - * BindingEntry.USE_LITERAL. + * Get the output body type for the given operation. */ - public int getOutputBodyType(Operation operation) { + public Use getOutputBodyType(Operation operation) { OperationAttr attr = (OperationAttr) attributes.get(operation); if (attr == null) { - return USE_ENCODED; // should really create an exception for this. + return Use.ENCODED; // should really create an exception for this. } else { return attr.getOutputBodyType(); @@ -366,14 +369,14 @@ /** * Set the output body type for the given operation. */ - protected void setOutputBodyType(Operation operation, int outputBodyType) { + protected void setOutputBodyType(Operation operation, Use outputBodyType) { OperationAttr attr = (OperationAttr) attributes.get(operation); if (attr == null) { attr = new OperationAttr(); attributes.put(operation, attr); } attr.setOutputBodyType(outputBodyType); - if (outputBodyType == USE_LITERAL) { + if (outputBodyType == Use.LITERAL) { setHasLiteral(true); } } // setOutputBodyType @@ -383,7 +386,7 @@ * then this is the inputBodyType, otherwise it's the outputBodyType. * (NOTE: this method exists to enable reusing some SymbolTable code. */ - protected void setBodyType(Operation operation, int bodyType, boolean input) { + protected void setBodyType(Operation operation, Use bodyType, boolean input) { if (input) { setInputBodyType(operation, bodyType); } @@ -393,23 +396,23 @@ } // setBodyType /** - * Get the fault body type for the given fault of the given operation. One of - * BindingEntry.USE_ENCODED, BindingEntry.USE_LITERAL. + * Get the fault body type for the given fault of the given operation. + * @return Use.ENCODED or Use.LITERAL */ - public int getFaultBodyType(Operation operation, String faultName) { + public Use getFaultBodyType(Operation operation, String faultName) { OperationAttr attr = (OperationAttr) attributes.get(operation); if (attr == null) { - return 0; // should really create an exception for this. + return Use.ENCODED; // should really create an exception for this. } else { HashMap m = attr.getFaultBodyTypeMap(); // Default to encoded if we didn't have a soap:body for the fault if ( ! m.containsKey(faultName) ) { - return USE_ENCODED; + return Use.ENCODED; } - return ((Integer) m.get(faultName)).intValue(); + return ((Use) m.get(faultName)); } } @@ -430,35 +433,35 @@ * - Body type: encoded or literal */ protected static class OperationAttr { - private int inputBodyType; - private int outputBodyType; + private Use inputBodyType; + private Use outputBodyType; private HashMap faultBodyTypeMap; - public OperationAttr(int inputBodyType, int outputBodyType, HashMap faultBodyTypeMap) { + public OperationAttr(Use inputBodyType, Use outputBodyType, HashMap faultBodyTypeMap) { this.inputBodyType = inputBodyType; this.outputBodyType = outputBodyType; this.faultBodyTypeMap = faultBodyTypeMap; } public OperationAttr() { - this.inputBodyType = USE_ENCODED; - this.outputBodyType = USE_ENCODED; + this.inputBodyType = Use.ENCODED; + this.outputBodyType = Use.ENCODED; this.faultBodyTypeMap = null; } - public int getInputBodyType() { + public Use getInputBodyType() { return inputBodyType; } - protected void setInputBodyType(int inputBodyType) { + protected void setInputBodyType(Use inputBodyType) { this.inputBodyType = inputBodyType; } - public int getOutputBodyType() { + public Use getOutputBodyType() { return outputBodyType; } - protected void setOutputBodyType(int outputBodyType) { + protected void setOutputBodyType(Use outputBodyType) { this.outputBodyType = outputBodyType; } 1.41.6.3 +21 -19 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java Index: SymbolTable.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v retrieving revision 1.41.6.2 retrieving revision 1.41.6.3 diff -u -r1.41.6.2 -r1.41.6.3 --- SymbolTable.java 3 Oct 2002 20:11:20 -0000 1.41.6.2 +++ SymbolTable.java 4 Oct 2002 20:20:57 -0000 1.41.6.3 @@ -107,6 +107,8 @@ import org.apache.axis.Constants; +import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.utils.Messages; import org.apache.axis.utils.XMLUtils; import org.apache.axis.utils.URLHashSet; @@ -1034,8 +1036,8 @@ boolean literalInput = false; boolean literalOutput = false; if (bindingEntry != null) { - literalInput = (bindingEntry.getInputBodyType(operation) == BindingEntry.USE_LITERAL); - literalOutput = (bindingEntry.getOutputBodyType(operation) == BindingEntry.USE_LITERAL); + literalInput = (bindingEntry.getInputBodyType(operation) == Use.LITERAL); + literalOutput = (bindingEntry.getOutputBodyType(operation) == Use.LITERAL); } // Collect all the input parameters @@ -1332,11 +1334,11 @@ setMIMEType(param, bindingEntry == null ? null : bindingEntry.getMIMEType(opName, partName)); if (bindingEntry != null && - bindingEntry.isInHeaderParameter(opName, partName)) { + bindingEntry.isInHeaderPart(opName, partName)) { param.setInHeader(true); } if (bindingEntry != null && - bindingEntry.isOutHeaderParameter(opName, partName)) { + bindingEntry.isOutHeaderPart(opName, partName)) { param.setOutHeader(true); } @@ -1419,10 +1421,10 @@ p.setType(elem.getType()); setMIMEType(p, bindingEntry == null ? null : bindingEntry.getMIMEType(opName, partName)); - if (bindingEntry.isInHeaderParameter(opName, partName)) { + if (bindingEntry.isInHeaderPart(opName, partName)) { p.setInHeader(true); } - if (bindingEntry.isOutHeaderParameter(opName, partName)) { + if (bindingEntry.isOutHeaderPart(opName, partName)) { p.setOutHeader(true); } v.add(p); @@ -1440,10 +1442,10 @@ } setMIMEType(param, bindingEntry == null ? null : bindingEntry.getMIMEType(opName, partName)); - if (bindingEntry.isInHeaderParameter(opName, partName)) { + if (bindingEntry.isInHeaderPart(opName, partName)) { param.setInHeader(true); } - if (bindingEntry.isOutHeaderParameter(opName, partName)) { + if (bindingEntry.isOutHeaderPart(opName, partName)) { param.setOutHeader(true); } @@ -1500,7 +1502,7 @@ SOAPBinding sb = (SOAPBinding) obj; String style = sb.getStyle(); if ("rpc".equalsIgnoreCase(style)) { - bEntry.setBindingStyle(BindingEntry.STYLE_RPC); + bEntry.setBindingStyle(Style.RPC); } } else if (obj instanceof HTTPBinding) { @@ -1563,7 +1565,7 @@ // Set default entry for this fault String faultName = bFault.getName(); - int faultBodyType = BindingEntry.USE_ENCODED; + Use faultBodyType = Use.ENCODED; Iterator faultIter = bFault.getExtensibilityElements().iterator(); @@ -1576,13 +1578,13 @@ "noUse", opName)); } if (use.equalsIgnoreCase("literal")) { - faultBodyType = BindingEntry.USE_LITERAL; + faultBodyType = Use.LITERAL; } break; } } // Add this fault name and bodyType to the map - faultMap.put(faultName, new Integer(faultBodyType)); + faultMap.put(faultName, faultBodyType); } bEntry.setFaultBodyTypeMap(operation, faultMap); } // binding operations @@ -1610,7 +1612,7 @@ // headers - those whose parts come from messages not used in // the portType's operation's input/output clauses. I don't // know what we're supposed to emit for implicit headers. - bEntry.setHeaderParameter(operation.getName(), header.getPart(), + bEntry.setHeaderPart(operation.getName(), header.getPart(), input ? BindingEntry.IN_HEADER : BindingEntry.OUT_HEADER); } else if (obj instanceof MIMEMultipartRelated) { @@ -1631,7 +1633,7 @@ "noUse", operation.getName())); } if (use.equalsIgnoreCase("literal")) { - bEntry.setBodyType(operation, BindingEntry.USE_LITERAL, + bEntry.setBodyType(operation, Use.LITERAL, input); } } // setBodyType @@ -1641,9 +1643,9 @@ * A side effect is to return the body Type of the given * MIMEMultipartRelated object. */ - private int addMIMETypes(BindingEntry bEntry, MIMEMultipartRelated mpr, + private Use addMIMETypes(BindingEntry bEntry, MIMEMultipartRelated mpr, Operation op) throws IOException { - int bodyType = BindingEntry.USE_ENCODED; + Use bodyType = Use.ENCODED; List parts = mpr.getMIMEParts(); Iterator i = parts.iterator(); while (i.hasNext()) { @@ -1663,7 +1665,7 @@ "noUse", op.getName())); } if (use.equalsIgnoreCase("literal")) { - bodyType = BindingEntry.USE_LITERAL; + bodyType = Use.LITERAL; } } } @@ -1896,9 +1898,9 @@ boolean literalOutput = false; if (bEntry != null) { literalInput = bEntry.getInputBodyType(operation) == - BindingEntry.USE_LITERAL; + Use.LITERAL; literalOutput = bEntry.getOutputBodyType(operation) == - BindingEntry.USE_LITERAL; + Use.LITERAL; } // Query the input message No revision No revision 1.65.4.3 +16 -7 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java Index: JavaDeployWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v retrieving revision 1.65.4.2 retrieving revision 1.65.4.3 diff -u -r1.65.4.2 -r1.65.4.3 --- JavaDeployWriter.java 3 Oct 2002 20:11:20 -0000 1.65.4.2 +++ JavaDeployWriter.java 4 Oct 2002 20:20:57 -0000 1.65.4.3 @@ -71,6 +71,8 @@ import javax.wsdl.Service; import org.apache.axis.Constants; +import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.deployment.wsdd.WSDDConstants; import org.apache.axis.enum.Scope; @@ -285,18 +287,24 @@ String prefix = WSDDConstants.NS_PREFIX_WSDD_JAVA; String styleStr = ""; - - if (hasLiteral) { - styleStr = " style=\"document\""; - } + String useStr = ""; if (symbolTable.isWrapped()) { - styleStr = " style=\"wrapped\""; + styleStr = " style=\"" + Style.WRAPPED + "\""; + useStr = " use=\"" + Use.LITERAL + "\""; + } else { + styleStr = " style=\"" + + bEntry.getBindingStyle().getName() + "\""; + if (hasLiteral) { + useStr = " use=\"" + Use.LITERAL + "\""; + } else { + useStr = " use=\"" + Use.ENCODED + "\""; + } } pw.println(" <service name=\"" + serviceName + "\" provider=\"" + prefix +":RPC" - + "\"" + styleStr + ">"); + + "\"" + styleStr + useStr + ">"); pw.println(" <parameter name=\"wsdlTargetNamespace\" value=\"" + service.getQName().getNamespaceURI() + "\"/>"); @@ -359,7 +367,8 @@ if (params != null) { // Get the operation QName - QName elementQName = Utils.getOperationQName(bindingOper); + QName elementQName = + Utils.getOperationQName(bindingOper, bEntry, symbolTable); // Get the operation's return QName and type QName returnQName = null; 1.49.6.3 +2 -1 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java Index: JavaSkelWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java,v retrieving revision 1.49.6.2 retrieving revision 1.49.6.3 diff -u -r1.49.6.2 -r1.49.6.3 --- JavaSkelWriter.java 3 Oct 2002 20:11:20 -0000 1.49.6.2 +++ JavaSkelWriter.java 4 Oct 2002 20:20:57 -0000 1.49.6.3 @@ -226,7 +226,8 @@ // If we need to know the QName (if we have a namespace or // the actual method name doesn't match the XML we expect), // record it in the OperationDesc - QName elementQName = Utils.getOperationQName(bindingOper); + QName elementQName = + Utils.getOperationQName(bindingOper, bEntry, symbolTable); if (elementQName != null) { pw.println(" _oper.setElementQName(" + Utils.getNewQName(elementQName) + ");"); 1.98.4.3 +15 -21 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java Index: JavaStubWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v retrieving revision 1.98.4.2 retrieving revision 1.98.4.3 diff -u -r1.98.4.2 -r1.98.4.3 --- JavaStubWriter.java 3 Oct 2002 20:11:20 -0000 1.98.4.2 +++ JavaStubWriter.java 4 Oct 2002 20:20:58 -0000 1.98.4.3 @@ -56,6 +56,8 @@ import org.apache.axis.utils.JavaUtils; import org.apache.axis.utils.Messages; +import org.apache.axis.enum.Style; +import org.apache.axis.enum.Use; import org.apache.axis.wsdl.symbolTable.BindingEntry; import org.apache.axis.wsdl.symbolTable.CollectionTE; import org.apache.axis.wsdl.symbolTable.Element; @@ -363,7 +365,8 @@ Fault f = (Fault) i.next(); partTypes(v, f.getMessage().getOrderedParts(null), - (bEntry.getFaultBodyType(operation, f.getName()) == BindingEntry.USE_LITERAL)); + (bEntry.getFaultBodyType(operation, + f.getName()) == Use.LITERAL)); } } // Put all these types into a set. This operation eliminates all duplicates. @@ -574,14 +577,14 @@ boolean hasMIME = Utils.hasMIME(bEntry, operation); // Encoding: literal or encoded use. - int use = bEntry.getInputBodyType(operation.getOperation()); - if (use == BindingEntry.USE_LITERAL) { + Use use = bEntry.getInputBodyType(operation.getOperation()); + if (use == Use.LITERAL) { // Turn off encoding pw.println(" _call.setEncodingStyle(null);"); // turn off XSI types pw.println(" _call.setScopedProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);"); } - if (hasMIME || use == BindingEntry.USE_LITERAL) { + if (hasMIME || use == Use.LITERAL) { // If it is literal, turn off multirefs. // // If there are any MIME types, turn off multirefs. @@ -590,28 +593,18 @@ pw.println(" _call.setScopedProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);"); } - // Style: document, RPC, or wrapped - String styleStr = opStyle; // operation style override binding - if (styleStr == null) { // get default from binding - styleStr = "rpc"; - int style = bEntry.getBindingStyle(); - if (style == BindingEntry.STYLE_DOCUMENT) { - styleStr = "document"; - } - } - - // FIXME: this only checks for wrapped in a global way, which - // is not really right as some ops can be wrapped and some not - if (styleStr.equals("document") && symbolTable.isWrapped()) { - styleStr = "wrapped"; + Style style = Style.getStyle(opStyle, bEntry.getBindingStyle()); + if (style == Style.DOCUMENT && symbolTable.isWrapped()) { + style = Style.WRAPPED; } if (!hasMIME) { - pw.println(" _call.setOperationStyle(\"" + styleStr + "\");"); + pw.println(" _call.setOperationStyle(\"" + style.getName() + "\");"); + pw.println(" _call.setOperationUse(\"" + use.getName() + "\");"); } // Operation name - if (styleStr.equals("wrapped")) { + if (style == Style.WRAPPED) { // We need to make sure the operation name, which is what we // wrap the elements in, matches the Qname of the parameter // element. @@ -629,7 +622,8 @@ } } } else { - QName elementQName = Utils.getOperationQName(operation); + QName elementQName = + Utils.getOperationQName(operation, bEntry, symbolTable); if (elementQName != null) { pw.println(" _call.setOperationName(" + Utils.getNewQName(elementQName) + ");" ); 1.58.6.1 +26 -27 xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java Index: Utils.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v retrieving revision 1.58 retrieving revision 1.58.6.1 diff -u -r1.58 -r1.58.6.1 --- Utils.java 24 Sep 2002 17:30:29 -0000 1.58 +++ Utils.java 4 Oct 2002 20:20:58 -0000 1.58.6.1 @@ -57,6 +57,7 @@ import org.apache.axis.Constants; import org.apache.axis.utils.JavaUtils; +import org.apache.axis.enum.Style; import org.apache.axis.wsdl.symbolTable.BindingEntry; import org.apache.axis.wsdl.symbolTable.CollectionTE; @@ -527,12 +528,34 @@ * the soap:body namespace, if it exists, otherwise it is "". * * @param bindingOper the operation + * @param bEntry the symbol table binding entry + * @param symbolTable SymbolTable * @return the operation QName */ - public static QName getOperationQName(BindingOperation bindingOper) { + public static QName getOperationQName(BindingOperation bindingOper, + BindingEntry bEntry, + SymbolTable symbolTable) { + Operation operation = bindingOper.getOperation(); String operationName = operation.getName(); - QName elementQName = null; + + // For the wrapped case, use the part element's name...which is + // is the same as the operation name, but may have a different + // namespace ? + // example: + // <part name="paramters" element="ns:myelem"> + if (bEntry.getBindingStyle() == Style.DOCUMENT && + symbolTable.isWrapped()) { + Input input = operation.getInput(); + if (input != null) { + Map parts = input.getMessage().getParts(); + if (parts != null && !parts.isEmpty()) { + Iterator i = parts.values().iterator(); + Part p = (Part) i.next(); + return p.getElementName(); + } + } + } String ns = null; @@ -559,32 +582,8 @@ if (ns == null) { ns = ""; } - - // Get the qname from the first message part, if it is an element - // example: - // <part name="paramters" element="ns:myelem"> - Input input = operation.getInput(); - if (input != null) { - Map parts = input.getMessage().getParts(); - if (parts != null && !parts.isEmpty()) { - Iterator i = parts.values().iterator(); - Part p = (Part) i.next(); - elementQName = p.getElementName(); - } - } - // NOTE: it is possible for someone to define a part as an element - // while using rpc/encoded, which is wrong and we might want to catch it - // here. - - // If we didn't find an element declared in the part (assume it's a - // type), so the QName will be the operation name with the - // namespace (if any) from the binding soap:body tag. - if (elementQName == null) { - elementQName = new QName(ns, operationName); - } - - return elementQName; + return new QName(ns, operationName); } /**