Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 35041 invoked from network); 7 Feb 2005 23:43:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Feb 2005 23:43:04 -0000 Received: (qmail 86510 invoked by uid 500); 7 Feb 2005 23:43:04 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 86358 invoked by uid 500); 7 Feb 2005 23:43:03 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 86339 invoked by uid 99); 7 Feb 2005 23:43:03 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 07 Feb 2005 15:43:02 -0800 Received: (qmail 35025 invoked by uid 65534); 7 Feb 2005 23:43:01 -0000 Message-ID: <20050207234301.35024.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Mon, 07 Feb 2005 23:43:01 -0000 Subject: svn commit: r151790 - in geronimo/trunk/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/ axis-builder/src/test/org/apache/geronimo/axis/builder/ axis/src/java/org/apache/geronimo/axis/client/ j2ee-schema/src/java/org/apache/geronimo/schema/ To: scm@geronimo.apache.org From: djencks@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: djencks Date: Mon Feb 7 15:42:56 2005 New Revision: 151790 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D151790 Log: Handle holders/OUT/INOUT parameters more or less correctly Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/b= uilder/AxisBuilder.java geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/b= uilder/ServiceReferenceTest.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SE= IFactoryImpl.java geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/= SchemaConversionUtils.java Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/= axis/builder/AxisBuilder.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/= java/org/apache/geronimo/axis/builder/AxisBuilder.java?view=3Ddiff&r1=3D151= 789&r2=3D151790 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/b= uilder/AxisBuilder.java (original) +++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/b= uilder/AxisBuilder.java Mon Feb 7 15:42:56 2005 @@ -22,15 +22,20 @@ import java.io.ObjectOutputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; +import java.util.Calendar; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.jar.JarFile; import javax.wsdl.Binding; import javax.wsdl.BindingInput; @@ -41,8 +46,10 @@ import javax.wsdl.Part; import javax.wsdl.Port; import javax.wsdl.PortType; +import javax.wsdl.Types; import javax.wsdl.WSDLException; import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.UnknownExtensibilityElement; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.extensions.soap.SOAPBinding; import javax.wsdl.extensions.soap.SOAPBody; @@ -51,6 +58,27 @@ import javax.wsdl.xml.WSDLLocator; import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; +import javax.xml.rpc.holders.BigDecimalHolder; +import javax.xml.rpc.holders.BigIntegerHolder; +import javax.xml.rpc.holders.BooleanHolder; +import javax.xml.rpc.holders.BooleanWrapperHolder; +import javax.xml.rpc.holders.ByteArrayHolder; +import javax.xml.rpc.holders.ByteHolder; +import javax.xml.rpc.holders.ByteWrapperHolder; +import javax.xml.rpc.holders.CalendarHolder; +import javax.xml.rpc.holders.DoubleHolder; +import javax.xml.rpc.holders.DoubleWrapperHolder; +import javax.xml.rpc.holders.FloatHolder; +import javax.xml.rpc.holders.FloatWrapperHolder; +import javax.xml.rpc.holders.IntHolder; +import javax.xml.rpc.holders.IntegerWrapperHolder; +import javax.xml.rpc.holders.LongHolder; +import javax.xml.rpc.holders.LongWrapperHolder; +import javax.xml.rpc.holders.ObjectHolder; +import javax.xml.rpc.holders.QNameHolder; +import javax.xml.rpc.holders.ShortHolder; +import javax.xml.rpc.holders.ShortWrapperHolder; +import javax.xml.rpc.holders.StringHolder; =20 import net.sf.cglib.core.DefaultGeneratorStrategy; import net.sf.cglib.proxy.Callback; @@ -86,6 +114,7 @@ import org.apache.geronimo.j2ee.deployment.Module; import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder; import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; +import org.apache.geronimo.kernel.ClassLoading; import org.apache.geronimo.naming.reference.DeserializingReference; import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingDocument; import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType; @@ -96,9 +125,14 @@ import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType; import org.apache.geronimo.xbeans.j2ee.WsdlMessageMappingType; import org.apache.geronimo.xbeans.j2ee.WsdlReturnValueMappingType; -import org.apache.geronimo.kernel.ClassLoading; +import org.apache.geronimo.schema.SchemaConversionUtils; import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlObject; +import org.apache.xmlbeans.XmlCursor; import org.objectweb.asm.Type; +import org.w3.x2001.xmlSchema.SchemaDocument; +import org.w3.x2001.xmlSchema.ComplexType; +import org.w3c.dom.Element; import org.xml.sax.InputSource; =20 /** @@ -240,6 +274,8 @@ =20 Map wsdlPortMap =3D service.getPorts(); =20 + Map complexTypeMap =3D getComplexTypesInWsdl(definition); + for (Iterator iterator =3D wsdlPortMap.entrySet().iterator(); iter= ator.hasNext();) { Map.Entry entry =3D (Map.Entry) iterator.next(); String portName =3D (String) entry.getKey(); @@ -302,7 +338,7 @@ Operation operation =3D (Operation) ops.next(); BindingOperation bindingOperation =3D binding.getBindi= ngOperation(operation.getName(), operation.getInput().getName(), operation.= getOutput() =3D=3D null ? null : operation.getOutput().getName()); ServiceEndpointMethodMappingType methodMapping =3D get= MethodMappingForOperation(operation, methodMappings); - OperationInfo operationInfo =3D buildOperationInfoHeav= yweight(methodMapping, bindingOperation, portStyle, soapVersion, mapping, c= lassLoader); + OperationInfo operationInfo =3D buildOperationInfoHeav= yweight(methodMapping, bindingOperation, portStyle, soapVersion, complexTyp= eMap, mapping, classLoader); operationInfos[i++] =3D operationInfo; } JavaXmlTypeMappingType[] javaXmlTypeMappings =3D mapping.g= etJavaXmlTypeMappingArray(); @@ -382,7 +418,6 @@ } =20 private Class getServiceEndpointInterfaceLightweight(PortType portType= , JavaWsdlMappingType mappings, ClassLoader classLoader) throws DeploymentE= xception { -// PortType portType =3D port.getBinding().getPortType(); QName portTypeQName =3D portType.getQName(); String portTypeNamespace =3D portTypeQName.getNamespaceURI(); String portTypePackage =3D getPackageFromNamespace(portTypeNamespa= ce, mappings); @@ -396,23 +431,6 @@ throw new DeploymentException("Could not load service endpoint= interface type", e); } =20 -// Method[] methods =3D serviceInterface.getMethods(); -// String methodName =3D "get" + port.getName(); -// String serviceEndpointInterfaceShortName =3D port.getBinding().g= etPortType().getQName().getLocalPart(); -// for (int i =3D 0; i < methods.length; i++) { -// Method method =3D methods[i]; -// if (method.getName().equals(methodName)) { -// Class serviceEndpointInterface =3D method.getReturnType(= ); -// String longName =3D serviceEndpointInterface.getName(); -// String name =3D longName.substring(longName.lastIndexOf(= '=2E') + 1); -// if (!name.equals(serviceEndpointInterfaceShortName) && -// !Introspector.decapitalize(name).equals(serviceE= ndpointInterfaceShortName)) { -// throw new DeploymentException("unexpected name for s= ervice endpoint interface, expected ending: " + serviceEndpointInterfaceSho= rtName + ", found " + serviceEndpointInterface.getName()); -// } -// return serviceEndpointInterface; -// } -// } -// throw new DeploymentException("Could not find service endpoint i= nterface for port named " + port.getName()); } =20 private ServiceEndpointInterfaceMappingType getServiceEndpointInterfac= eMapping(ServiceEndpointInterfaceMappingType[] endpointMappings, QName port= TypeQName) throws DeploymentException { @@ -436,17 +454,6 @@ throw new DeploymentException("No element of class " + clazz.getNa= me() + " found"); } =20 -// private String getNamespaceFromPackage(String packageName, JavaWsdlM= appingType mapping) throws DeploymentException { -// PackageMappingType[] packageMappings =3D mapping.getPackageMappi= ngArray(); -// for (int i =3D 0; i < packageMappings.length; i++) { -// PackageMappingType packageMapping =3D packageMappings[i]; -// if (packageName.equals(packageMapping.getPackageType().getSt= ringValue().trim())) { -// return packageMapping.getNamespaceURI().getStringValue()= .trim(); -// } -// } -// throw new DeploymentException("Package " + packageName + " was n= ot mapped in jaxrpc mapping file"); -// } - private String getPackageFromNamespace(String namespace, JavaWsdlMappi= ngType mapping) throws DeploymentException { PackageMappingType[] packageMappings =3D mapping.getPackageMapping= Array(); for (int i =3D 0; i < packageMappings.length; i++) { @@ -512,6 +519,7 @@ throw new DeploymentException("Lightweight mapping has at most= one part in the (optional) output message, not: " + outputMessage.getParts= ().size()); } Class[] methodParamTypes =3D method.getParameterTypes(); + //TODO investigate getOrderedParts Map inputParts =3D inputMessage.getParts(); if (methodParamTypes.length !=3D inputParts.size()) { throw new DeploymentException("mismatch in parameter counts: m= ethod has " + methodParamTypes.length + " whereas the input message has " += inputParts.size()); @@ -570,7 +578,7 @@ return operationInfo; } =20 - public OperationInfo buildOperationInfoHeavyweight(ServiceEndpointMeth= odMappingType methodMapping, BindingOperation bindingOperation, Style defau= ltStyle, SOAPConstants soapVersion, JavaWsdlMappingType mapping, ClassLoade= r classLoader) throws DeploymentException { + public OperationInfo buildOperationInfoHeavyweight(ServiceEndpointMeth= odMappingType methodMapping, BindingOperation bindingOperation, Style defau= ltStyle, SOAPConstants soapVersion, Map complexTypeMap, JavaWsdlMappingType= mapping, ClassLoader classLoader) throws DeploymentException { =20 //TODO how can bindingOperation be null? Operation operation =3D bindingOperation.getOperation(); @@ -578,47 +586,104 @@ =20 =20 Message inputMessage =3D operation.getInput().getMessage(); + Message outputMessage =3D operation.getOutput() =3D=3D null ? null= : operation.getOutput().getMessage(); =20 boolean isWrappedElement =3D methodMapping.isSetWrappedElement(); =20 MethodParamPartsMappingType[] paramMappings =3D methodMapping.getM= ethodParamPartsMappingArray(); Type[] parameterASMTypes =3D new Type[paramMappings.length]; ParameterDesc[] parameterDescriptions =3D new ParameterDesc[paramM= appings.length]; + + Set inParamNames =3D new HashSet(); + Set outParamNames =3D new HashSet(); for (int i =3D 0; i < paramMappings.length; i++) { MethodParamPartsMappingType paramMapping =3D paramMappings[i]; int position =3D paramMapping.getParamPosition().getBigInteger= Value().intValue(); - String paramJavaTypeName =3D paramMapping.getParamType().getSt= ringValue().trim(); - Class paramJavaType =3D null; - try { - paramJavaType =3D ClassLoading.loadClass(paramJavaTypeName= , classLoader); - } catch (ClassNotFoundException e) { - throw new DeploymentException("could not load parameter ty= pe", e); - } =20 WsdlMessageMappingType wsdlMessageMappingType =3D paramMapping= .getWsdlMessageMapping(); - String parameterMode =3D wsdlMessageMappingType.getParameterMo= de().getStringValue().trim(); - byte mode =3D ParameterDesc.modeFromString(parameterMode); - boolean isSoapHeader =3D wsdlMessageMappingType.isSetSoapHeade= r(); - boolean inHeader =3D isSoapHeader && (mode =3D=3D ParameterDes= c=2EIN || mode =3D=3D ParameterDesc.INOUT); - boolean outHeader =3D isSoapHeader && (mode =3D=3D ParameterDe= sc.OUT || mode =3D=3D ParameterDesc.INOUT); QName wsdlMessageQName =3D wsdlMessageMappingType.getWsdlMessa= ge().getQNameValue(); String wsdlMessagePartName =3D wsdlMessageMappingType.getWsdlM= essagePartName().getStringValue().trim(); =20 + String parameterMode =3D wsdlMessageMappingType.getParameterMo= de().getStringValue().trim(); + byte mode =3D ParameterDesc.modeFromString(parameterMode); + boolean isInParam =3D mode =3D=3D ParameterDesc.IN || mode =3D= =3D ParameterDesc.INOUT; + boolean isOutParam =3D mode =3D=3D ParameterDesc.OUT || mode = =3D=3D ParameterDesc.INOUT; =20 - //TODO Must this be the inputMessage? Then we don't need defin= ition. - if (!wsdlMessageQName.equals(inputMessage.getQName())) { - throw new DeploymentException("QName of input message: " += inputMessage.getQName() + " does not match mapping message QName: " + wsdl= MessageQName); + if (isOutParam && outputMessage =3D=3D null) { + throw new DeploymentException("Mapping for output paramete= r " + wsdlMessagePartName + " found, but no output message for operation " = + operationName); } -// Message inputMessage =3D definition.getMessage(wsdlMessageQN= ame); - Part part =3D inputMessage.getPart(wsdlMessagePartName); + boolean isSoapHeader =3D wsdlMessageMappingType.isSetSoapHeade= r(); + boolean inHeader =3D isSoapHeader && isInParam; + boolean outHeader =3D isSoapHeader && isOutParam; + + Part part; + if (isInParam) { + if (!wsdlMessageQName.equals(inputMessage.getQName())) { + throw new DeploymentException("QName of input message:= " + inputMessage.getQName() + + " does not match mapping message QName: " + ws= dlMessageQName + " for operation " + operationName); + } + part =3D inputMessage.getPart(wsdlMessagePartName); + if (part =3D=3D null) { + throw new DeploymentException("No part for wsdlMessage= PartName " + wsdlMessagePartName + " in input message for operation " + ope= rationName); + } + inParamNames.add(wsdlMessagePartName); + if (isOutParam) { + //inout, check that part of same name and type is in o= utput message + Part outPart =3D outputMessage.getPart(wsdlMessagePart= Name); + if (outPart =3D=3D null) { + throw new DeploymentException("No part for wsdlMes= sagePartName " + wsdlMessagePartName + " in output message for INOUT parame= ter of operation " + operationName); + } + if (!part.getName().equals(outPart.getName())) { + throw new DeploymentException("Mismatched input pa= rt name: " + part.getName() + " and output part name: " + outPart.getName()= + " for INOUT parameter for wsdlMessagePartName " + wsdlMessagePartName + = " for operation " + operationName); + } + if (!(part.getElementName() =3D=3D null ? outPart.getE= lementName() =3D=3D null : part.getElementName().equals(outPart.getElementN= ame()))) { + throw new DeploymentException("Mismatched input pa= rt element name: " + part.getElementName() + " and output part element name= : " + outPart.getElementName() + " for INOUT parameter for wsdlMessagePartN= ame " + wsdlMessagePartName + " for operation " + operationName); + } + if (!(part.getTypeName() =3D=3D null ? outPart.getType= Name() =3D=3D null : part.getTypeName().equals(outPart.getTypeName()))) { + throw new DeploymentException("Mismatched input pa= rt type name: " + part.getTypeName() + " and output part type name: " + out= Part.getTypeName() + " for INOUT parameter for wsdlMessagePartName " + wsdl= MessagePartName + " for operation " + operationName); + } + outParamNames.add(wsdlMessagePartName); + } + } else if (isOutParam) { + if (!wsdlMessageQName.equals(outputMessage.getQName())) { + throw new DeploymentException("QName of output message= : " + outputMessage.getQName() + + " does not match mapping message QName: " + ws= dlMessageQName + " for operation " + operationName); + } + part =3D outputMessage.getPart(wsdlMessagePartName); + if (part =3D=3D null) { + throw new DeploymentException("No part for wsdlMessage= PartName " + wsdlMessagePartName + " in output message for operation " + op= erationName); + } + outParamNames.add(wsdlMessagePartName); + } else { + throw new AssertionError("a param mapping has to be IN or = OUT or INOUT"); + } + //TODO this makes little sense but may be correct, see comment= s in axis Parameter class //the part name qname is really odd. - QName partQName =3D isWrappedElement? part.getElementName(): n= ew QName("", part.getName()); + QName partQName =3D isWrappedElement ? part.getElementName() := new QName("", part.getName()); QName partTypeQName =3D part.getTypeName(); =20 - ParameterDesc parameterDesc =3D new ParameterDesc(partQName, m= ode, partTypeQName, paramJavaType, inHeader, outHeader); + //use complexTypeMap + boolean isComplexType =3D complexTypeMap.containsKey(partTypeQ= Name); + String paramJavaTypeName =3D paramMapping.getParamType().getSt= ringValue().trim(); + Class actualParamJavaType =3D getHolderType(paramJavaTypeName,= mode, partTypeQName, isComplexType, mapping, classLoader); + + ParameterDesc parameterDesc =3D new ParameterDesc(partQName, m= ode, partTypeQName, actualParamJavaType, inHeader, outHeader); parameterDescriptions[position] =3D parameterDesc; - parameterASMTypes[position] =3D Type.getType(paramJavaType); + parameterASMTypes[position] =3D Type.getType(actualParamJavaTy= pe); + } + + //check that all the parameters are there + for (int i =3D 0; i < parameterDescriptions.length; i++) { + ParameterDesc parameterDescription =3D parameterDescriptions[i= ]; + if (parameterDescription =3D=3D null) { + throw new DeploymentException("There is no mapping for par= ameter number " + i + " for operation " + operationName); + } + } + + //check that all input message parts are mapped + if (!inParamNames.equals(inputMessage.getParts().keySet())) { + throw new DeploymentException("Not all input message parts wer= e mapped for operation name" + operationName); } =20 =20 @@ -627,36 +692,47 @@ Class returnClass =3D null; Type returnASMType =3D Type.VOID_TYPE; =20 - Message outputMessage =3D operation.getOutput() =3D=3D null ? null= : operation.getOutput().getMessage(); if (methodMapping.isSetWsdlReturnValueMapping()) { + if (outputMessage =3D=3D null) { + throw new DeploymentException("No output message, but a ma= pping for it for operation " + operationName); + } WsdlReturnValueMappingType wsdlReturnValueMapping =3D methodMa= pping.getWsdlReturnValueMapping(); String returnClassName =3D wsdlReturnValueMapping.getMethodRet= urnValue().getStringValue().trim(); try { returnClass =3D ClassLoading.loadClass(returnClassName, cl= assLoader); } catch (ClassNotFoundException e) { - throw new DeploymentException("Could not load return type"= , e); + throw new DeploymentException("Could not load return type = for operation " + operationName, e); } =20 QName wsdlMessageQName =3D wsdlReturnValueMapping.getWsdlMessa= ge().getQNameValue(); =20 - if (outputMessage =3D=3D null) { - throw new DeploymentException("No output message, but a ma= pping for it!"); - } if (!wsdlMessageQName.equals(outputMessage.getQName())) { - throw new DeploymentException("OutputMessage has QName: " = + outputMessage.getQName() + " but mapping specifies: " + wsdlMessageQName); + throw new DeploymentException("OutputMessage has QName: " = + outputMessage.getQName() + " but mapping specifies: " + wsdlMessageQName = + " for operation " + operationName); } =20 if (wsdlReturnValueMapping.isSetWsdlMessagePartName()) { String wsdlMessagePartName =3D wsdlReturnValueMapping.getW= sdlMessagePartName().getStringValue().trim(); + if (outParamNames.contains(wsdlMessagePartName)) { + throw new DeploymentException("output message part " += wsdlMessagePartName + " has both an INOUT or OUT mapping and a return valu= e mapping for operation " + operationName); + } Part part =3D outputMessage.getPart(wsdlMessagePartName); returnQName =3D part.getElementName(); returnType =3D part.getTypeName(); + + outParamNames.add(wsdlMessagePartName); + + } else { + //what does this mean???? } =20 returnASMType =3D Type.getType(returnClass); =20 } =20 + if (outputMessage !=3D null && !outParamNames.equals(outputMessage= .getParts().keySet())) { + throw new DeploymentException("Not all output message parts we= re mapped to parameters or a return value for operation " + operationName); + } + OperationDesc operationDesc =3D new OperationDesc(operationName, p= arameterDescriptions, returnQName); operationDesc.setReturnType(returnType); operationDesc.setReturnClass(returnClass); @@ -688,6 +764,124 @@ String methodDesc =3D Type.getMethodDescriptor(returnASMType, para= meterASMTypes); OperationInfo operationInfo =3D new OperationInfo(operationDesc, u= sesSOAPAction, soapActionURI, soapVersion, operationQName, methodName, meth= odDesc); return operationInfo; + } + + Map getComplexTypesInWsdl(Definition definition) throws DeploymentExce= ption { + Map complexTypeMap =3D new HashMap(); + Types types =3D definition.getTypes(); + Map namespaceMap =3D definition.getNamespaces(); + if (types !=3D null) { + List schemas =3D types.getExtensibilityElements(); + for (Iterator iterator =3D schemas.iterator(); iterator.hasNex= t();) { + Object o =3D iterator.next(); + if (o instanceof UnknownExtensibilityElement) { + UnknownExtensibilityElement unknownExtensibilityElemen= t =3D (UnknownExtensibilityElement) o; + QName elementType =3D unknownExtensibilityElement.getE= lementType(); + if (new QName("http://www.w3.org/2001/XMLSchema", "sch= ema").equals(elementType)) { + Element element =3D unknownExtensibilityElement.ge= tElement(); + try { + XmlObject xmlObject =3D SchemaConversionUtils.= parse(element); + XmlCursor cursor =3D xmlObject.newCursor(); + try { + cursor.toFirstContentToken(); + for (Iterator namespaces =3D namespaceMap.= entrySet().iterator(); namespaces.hasNext();) { + Map.Entry entry =3D (Map.Entry) names= paces.next(); + cursor.insertNamespace((String)entry.g= etKey(), (String)entry.getValue()); + } + } finally { + cursor.dispose(); + } + SchemaDocument schemaDoc =3D (SchemaDocument) = xmlObject.changeType(SchemaDocument.type); + SchemaConversionUtils.validateDD(schemaDoc); + SchemaDocument.Schema schema =3D schemaDoc.get= Schema(); + String targetNamespace =3D schema.getTargetNam= espace(); + ComplexType[] complexTypes =3D schema.getCompl= exTypeArray(); + for (int j =3D 0; j < complexTypes.length; j++= ) { + ComplexType complexType =3D complexTypes[j= ]; + String complexTypeName =3D complexType.get= Name(); + QName complexTypeQName =3D new QName(targe= tNamespace, complexTypeName); + complexTypeMap.put(complexTypeQName, compl= exType); + } + } catch (XmlException e) { + throw new DeploymentException("Invalid schema = in wsdl", e); + } + } else { + //problems?? + } + } + } + } + return complexTypeMap; + } + + private static final Map rpcHolderClasses =3D new HashMap(); + + static { + rpcHolderClasses.put(BigDecimal.class, BigDecimalHolder.class); + rpcHolderClasses.put(BigInteger.class, BigIntegerHolder.class); + rpcHolderClasses.put(boolean.class, BooleanHolder.class); + rpcHolderClasses.put(Boolean.class, BooleanWrapperHolder.class); + rpcHolderClasses.put(byte[].class, ByteArrayHolder.class); + rpcHolderClasses.put(byte.class, ByteHolder.class); + rpcHolderClasses.put(Byte.class, ByteWrapperHolder.class); + rpcHolderClasses.put(Calendar.class, CalendarHolder.class); + rpcHolderClasses.put(double.class, DoubleHolder.class); + rpcHolderClasses.put(Double.class, DoubleWrapperHolder.class); + rpcHolderClasses.put(float.class, FloatHolder.class); + rpcHolderClasses.put(Float.class, FloatWrapperHolder.class); + rpcHolderClasses.put(int.class, IntHolder.class); + rpcHolderClasses.put(Integer.class, IntegerWrapperHolder.class); + rpcHolderClasses.put(long.class, LongHolder.class); + rpcHolderClasses.put(Long.class, LongWrapperHolder.class); + rpcHolderClasses.put(Object.class, ObjectHolder.class); + rpcHolderClasses.put(QName.class, QNameHolder.class); + rpcHolderClasses.put(short.class, ShortHolder.class); + rpcHolderClasses.put(Short.class, ShortWrapperHolder.class); + rpcHolderClasses.put(String.class, StringHolder.class); + } + + private Class getHolderType(String paramJavaTypeName, byte mode, QName= typeQName, boolean isComplexType, JavaWsdlMappingType mapping, ClassLoader= classLoader) throws DeploymentException { + Class paramJavaType =3D null; + if (mode =3D=3D ParameterDesc.IN) { + try { + paramJavaType =3D ClassLoading.loadClass(paramJavaTypeName= , classLoader); + } catch (ClassNotFoundException e) { + throw new DeploymentException("could not load parameter ty= pe", e); + } + return paramJavaType; + } else { + String holderName; + if (isComplexType) { + String namespace =3D typeQName.getNamespaceURI(); + String packageName =3D getPackageFromNamespace(namespace,= mapping); + StringBuffer buf =3D new StringBuffer(packageName.length(= ) + typeQName.getLocalPart().length() + 14); + buf.append(packageName).append(".holders.").append(typeQN= ame.getLocalPart()).append("Holder"); + buf.setCharAt(packageName.length() + 9, Character.toUpper= Case(typeQName.getLocalPart().charAt(0))); + holderName =3D buf.toString(); + } else { + try { + paramJavaType =3D ClassLoading.loadClass(paramJavaType= Name, classLoader); + } catch (ClassNotFoundException e) { + throw new DeploymentException("could not load paramete= r type", e); + } + Class holder =3D (Class) rpcHolderClasses.get(paramJavaTyp= e); + if (holder !=3D null) { + return holder; + } + String paramTypeName =3D paramJavaType.getName(); + StringBuffer buf =3D new StringBuffer(paramTypeName.length= () + 14); + int dot =3D paramTypeName.lastIndexOf("."); + //foo.Bar >>> foo.holders.BarHolder + buf.append(paramTypeName.substring(0, dot)).append(".holde= rs").append(paramTypeName.substring(dot)).append("Holder"); + holderName =3D buf.toString(); + } + try { + Class holder =3D ClassLoading.loadClass(holderName, classL= oader); + return holder; + } catch (ClassNotFoundException e) { + throw new DeploymentException("Could not load holder class= ", e); + } + } } =20 =20 Modified: geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/= axis/builder/ServiceReferenceTest.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/= test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?view=3Ddiff= &r1=3D151789&r2=3D151790 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/b= uilder/ServiceReferenceTest.java (original) +++ geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/b= uilder/ServiceReferenceTest.java Mon Feb 7 15:42:56 2005 @@ -257,6 +257,14 @@ testInteropPort((InteropTestPortType) sei2); } =20 + public void testBuildComplexTypeMap() throws Exception { + WSDLFactory factory =3D WSDLFactory.newInstance(); + WSDLReader reader =3D factory.newWSDLReader(); + Definition definition =3D reader.readWSDL(wsdlFile.toURI().toStrin= g()); + AxisBuilder builder =3D new AxisBuilder(); + Map complexTypeMap =3D builder.getComplexTypesInWsdl(definition); + assertEquals(7, complexTypeMap.size()); + } =20 =20 private OperationInfo buildOperationInfoForMockOperation(AxisBuilder b= uilder) throws NoSuchMethodException, DeploymentException, WSDLException { Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/cli= ent/SEIFactoryImpl.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org= /apache/geronimo/axis/client/SEIFactoryImpl.java?view=3Ddiff&r1=3D151789&r2= =3D151790 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SE= IFactoryImpl.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SE= IFactoryImpl.java Mon Feb 7 15:42:56 2005 @@ -61,6 +61,9 @@ OperationInfo operationInfo =3D operationInfos[i]; Signature signature =3D operationInfo.getSignature(); MethodProxy methodProxy =3D MethodProxy.find(serviceEndpointCl= ass, signature); + if (methodProxy =3D=3D null) { + throw new RuntimeException("No method proxy for operationI= nfo " + signature); + } int index =3D methodProxy.getSuperIndex(); sortedOperationInfos[index] =3D operationInfo; } Modified: geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/s= chema/SchemaConversionUtils.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-schema/src/j= ava/org/apache/geronimo/schema/SchemaConversionUtils.java?view=3Ddiff&r1=3D= 151789&r2=3D151790 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/= SchemaConversionUtils.java (original) +++ geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/= SchemaConversionUtils.java Mon Feb 7 15:42:56 2005 @@ -35,6 +35,7 @@ import org.apache.xmlbeans.XmlOptions; import org.apache.xmlbeans.SchemaType; import org.apache.xmlbeans.XmlDocumentProperties; +import org.w3c.dom.Element; =20 /** * @version $Rev$ $Date$ @@ -74,6 +75,15 @@ public static XmlObject parse(String xml) throws XmlException { ArrayList errors =3D new ArrayList(); XmlObject parsed =3D XmlObject.Factory.parse(xml, createXmlOptions= (errors)); + if (errors.size() !=3D 0) { + throw new XmlException(errors.toArray().toString()); + } + return parsed; + } + + public static XmlObject parse(Element element) throws XmlException { + ArrayList errors =3D new ArrayList(); + XmlObject parsed =3D XmlObject.Factory.parse(element, createXmlOpt= ions(errors)); if (errors.size() !=3D 0) { throw new XmlException(errors.toArray().toString()); }