Package javax.wsdl

Examples of javax.wsdl.Part


        }

        if (isRequestResponse) {
            for (Part part : outputParts) {
                if (!parameterList.contains(part.getName())) {
                    Part inpart = inputMessage.getPart(part.getName());
                    if (inpart == null || (inpart != null && !isSamePart(inpart, part))) {
                        outputUnlistedParts.add(part);
                    }
                }
            }

            if (outputUnlistedParts.size() == 1) {
                processReturn(method, outputUnlistedParts.get(0));
                outputPartsMap.remove(outputUnlistedParts.get(0));
                outputUnlistedParts.clear();
            } else {
                processReturn(method, null);
            }
        }

        // now create list of paramModel with parts
        // first for the ordered list
        int index = 0;
        int size = parameterList.size();
        while (index < size) {
            String partName = parameterList.get(index);
            Part part = inputPartsMap.get(partName);
            JavaType.Style style = JavaType.Style.IN;
            if (part == null) {
                part = outputPartsMap.get(partName);
                style = JavaType.Style.OUT;
            } else if (outputPartsMap.get(partName) != null
View Full Code Here


                List partList = operation.getInput().getMessage().getOrderedParts( null );
                parameterOrder = new Vector();
                Iterator partListIterator = partList.iterator();
                while ( partListIterator.hasNext() )
                {
                    Part part = (Part) partListIterator.next();
                    parameterOrder.add( part.getName() );
                }
            }

            ArrayList argNames = new ArrayList();

            Iterator parameterIterator = parameterOrder.iterator();
            while ( parameterIterator.hasNext() )
            {
                String param = (String) parameterIterator.next();
                Part part = operation.getInput().getMessage().getPart( param );
                if ( part == null )
                {
                    part = operation.getOutput().getMessage().getPart( param );
                }
                if ( part == null )
                    throw new Exception( "Part '" + param
                            + "' from parameterOrder not found in input or output message" );
                argNames.add( part.getName() );
            }

            fieldInParameterNames = new String[argNames.size()];
            for ( int i = 0; i < argNames.size(); i++ )
            {
                fieldInParameterNames[i] = (String) argNames.get( i );
            }

            // Deal with output parts if operation is Request-Response
            if ( operation.getStyle().equals( OperationType.REQUEST_RESPONSE ) )
            {
                argNames = new ArrayList();
                // Get the returnPart attribute if it exists
                String returnPart = fieldEJOEOperationModel.getReturnPart();
                Iterator outputPartsIterator = operation.getOutput().getMessage().getOrderedParts( null ).iterator();
                while ( outputPartsIterator.hasNext() )
                {
                    Part part = (Part) outputPartsIterator.next();
                    String partName = part.getName();
                    if ( partName != null && returnPart != null && partName.equals( returnPart ) )
                    {
                        // Put return part first in the list of output parts
                        argNames.add( 0, partName );
                    }
                    else
                    {
                        argNames.add( part.getName() );
                    }
                }

                // Populate an array of output message part names
                fieldOutParameterNames = new String[argNames.size()];
View Full Code Here

      addFaultInfo(faults,minfo);
            Iterator paramlist = null;
            //add each parameter to parameter list
            if ("document".equals(bindingEntry.getBindingStyle().getName())){
        paramlist = op.getInput().getMessage().getParts().values().iterator();
        Part part = (Part) paramlist.next();
        QName minfoqname;
        element = symbolTable.getElement(part.getElementName());
        if ( element == null ) {
          // the part reference a type.
          qname =  symbolTable.getType(part.getTypeName()).getQName();
          minfoqname = symbolTable.getType(part.getTypeName()).getQName();
        }
        else {
          qname = element.getRefType().getQName();
          minfoqname = element.getQName();
        }
        if (qname != null){
          minfo.setInputMessage(minfoqname);
          System.out.println(minfoqname.getLocalPart()+"setInputMessage.............?????????????");
          type = this.typeMap.getType(qname);
          boolean wrapped = true; //TODO take this from a commandline argument
          if (wrapped){
            if(type == null)
               throw new WrapperFault("unregisterd type "+qname+" refered");
            else{
              /* if(type.getLanguageSpecificName().startsWith(">")){*/ //anyway skip the wrapping element type even if it is a named type.
              //get inner attributes and elements and add them as parameters
              ArrayList elementlist = new ArrayList();
              Iterator names = type.getElementnames();
              while (names.hasNext()){
                elementlist.add(names.next());
              }
              Type innerType;
              for (int i = 0 ; i < elementlist.size(); i++) {
                String elementname = (String)elementlist.get(i);
                innerType = type.getElementForElementName(elementname).getType();
                pinfo = new ParameterInfo(innerType,elementname);
                pinfo.setElementName(type.getElementForElementName(elementname).getName());
                if (innerType.getName().equals(CUtils.anyTypeQname))
                  pinfo.setAnyType(true);
                minfo.addInputParameter(pinfo);   
              }
              //remove the type that represents the wrapping element so that such type is not created.
              //following is commented for the moment because the same element can be refered by more
              //than one message. Also this complex type may be used as a type while it is the wrapping
              //element here
              //this.typeMap.removeType(qname);
            }
          }
          else{
           
          }
        }
        }
          else{
        minfo.setInputMessage(op.getInput().getMessage().getQName());
             if (op.getParameterOrdering() != null){
               for (int ix=0; ix < op.getParameterOrdering().size(); ix++){
            Part p = (Part)(op.getInput().getMessage().getParts().get((String)op.getParameterOrdering().get(ix)));
            if (p == null) continue;
            pinfo = createParameterInfo(p);
            if (null != pinfo) minfo.addInputParameter(pinfo);
               }
             }
             else {
          paramlist = op.getInput().getMessage().getParts().values().iterator();
          while (paramlist.hasNext()) { //RPC style messages can have multiple parts
            Part p = (Part) paramlist.next();
            pinfo = createParameterInfo(p);
            if (null != pinfo) minfo.addInputParameter(pinfo);
          }              
             }
           }
            //get the return type
      if(op.getOutput()!=null){
              Iterator returnlist = op.getOutput().getMessage().getParts().values().iterator();
        if (returnlist.hasNext() && "document".equals(bindingEntry.getBindingStyle().getName())){
          Part part = (Part) returnlist.next();
          QName minfoqname;
          element = symbolTable.getElement(part.getElementName());
          if ( element == null ) {
            // the part reference a type.
            qname =  symbolTable.getType(part.getTypeName()).getQName();
            minfoqname = symbolTable.getType(part.getTypeName()).getQName();
          }
          else {
            qname = element.getRefType().getQName();
            minfoqname = element.getQName();
          }
          if (qname != null){
            minfo.setOutputMessage(minfoqname);
            type = this.typeMap.getType(qname);       
            boolean wrapped = true; //TODO take this from a commandline argument
            if (wrapped){
              if(type == null)
                 throw new WrapperFault("unregisterd type "+qname+" refered");
              else{
                /*if(type.getLanguageSpecificName().startsWith(">")){*///anyway skip the wrapping element type even if it is a named type.
                //get inner attributes and elements and add them as parameters
                ArrayList elementlist = new ArrayList();
                Iterator names = type.getElementnames();
                while (names.hasNext()){
                  elementlist.add(names.next());
                }
                Type innerType;
                for (int i = 0 ; i < elementlist.size(); i++) {
                  String elementname = (String)elementlist.get(i);
                  innerType = type.getElementForElementName(elementname).getType();
                  pinfo = new ParameterInfo(innerType,elementname);
                  pinfo.setElementName(type.getElementForElementName(elementname).getName());
                  if (innerType.getName().equals(CUtils.anyTypeQname))
                    pinfo.setAnyType(true);
                  minfo.addOutputParameter(pinfo);   
                }             
                //remove the type that represents the wrapping element so that such type is not created.             
                //following is commented for the moment because the same element can be refered by more
                //than one message. Also this complex type may be used as a type while it is the wrapping
                //element here
                //this.typeMap.removeType(qname);
              }
            }
            else{
            }
          }
        }
        else{
      //added on 1-jun-2004
            minfo.setInputMessage(op.getInput().getMessage().getQName());
            minfo.setOutputMessage(op.getOutput().getMessage().getQName());
           // minfo.setFaultMessage();
          if (op.getParameterOrdering() != null){
            
            for (int ix=0; ix < op.getParameterOrdering().size(); ix++){
              Part p = (Part)(op.getOutput().getMessage().getParts().get((String)op.getParameterOrdering().get(ix)));
              if (p == null) continue;
              pinfo = createParameterInfo(p);
              if (null != pinfo) minfo.addOutputParameter(pinfo);
            }
            /* there can be more output parameters than in parameterOrder list (partial parameter ordering) */
            returnlist = op.getOutput().getMessage().getParts().values().iterator();
            while (returnlist.hasNext()) { //RPC style messages can have multiple parts
              Part p = (Part) returnlist.next();
              if (op.getParameterOrdering().contains(p.getName())) continue;
              pinfo = createParameterInfo(p);
              if (null != pinfo) minfo.addOutputParameter(pinfo);
            }                               
          }
          else {
            returnlist = op.getOutput().getMessage().getParts().values().iterator();
            while (returnlist.hasNext()) { //RPC style messages can have multiple parts
              Part p = ((Part) returnlist.next());
              pinfo = createParameterInfo(p);
              if (null != pinfo) minfo.addOutputParameter(pinfo);
            }
          }
        }
View Full Code Here

        Operation operation = definition.createOperation();
        operation.setName(operationName);
        operation.setStyle(OperationType.REQUEST_RESPONSE);
        Input input = definition.createInput();
        Message inputMessage = definition.createMessage();
        Part inputPart = definition.createPart();
        inputPart.setName("string");
        inputPart.setTypeName(new QName("http://www.w3.org/2001/XMLSchema", "string"));
        inputMessage.addPart(inputPart);
        operation.setInput(input);
        input.setMessage(inputMessage);
        Output output = definition.createOutput();
        Message outputMessage = definition.createMessage();
View Full Code Here

        }

        // Map the input parts to method args
        int i = 0;
        for (Iterator parts = inputParts.iterator(); parts.hasNext();) {
            Part part = (Part) parts.next();
            String partName = part.getName();
            QName name = new QName("", partName);
            byte mode = ParameterDesc.IN;
            QName typeQName = part.getTypeName() == null ? part.getElementName() : part.getTypeName();
            Class javaClass = methodParamTypes[i++];
            //lightweight mapping has no parts in headers, so inHeader and outHeader are false
            ParameterDesc parameter = new ParameterDesc(name, mode, typeQName, javaClass, false, false);
            operationDesc.addParameter(parameter);
        }

        // Can't have multiple return values
        if (output != null && output.getParts().size() > 1) {
            throw new DeploymentException("Lightweight mapping has at most one part in the (optional) output message, not: " + output.getParts().size());
        }

        // Map the return message, if there is one
        if (output != null && output.getParts().size() == 1) {
            Part part = (Part) output.getParts().values().iterator().next();

            // Set the element name
            QName returnName = part.getElementName() == null ? new QName(part.getName()) : part.getElementName();
            operationDesc.setReturnQName(returnName);

            // Set the element type
            QName returnType = part.getTypeName() == null ? part.getElementName() : part.getTypeName();
            operationDesc.setReturnType(returnType);

            operationDesc.setReturnClass(method.getReturnType());
        }
View Full Code Here

    private QName getOperationQName() {
        if (wrappedStyle) {
            Map parts = operation.getInput().getMessage().getParts();
            if (parts != null && !parts.isEmpty()) {
                for (Iterator iterator = parts.values().iterator(); iterator.hasNext();) {
                    Part part = (Part) iterator.next();
                    return part.getElementName();
                }
            }
        }
        return getOperationNameFromSOAPBody();
View Full Code Here

            parameterDescriptions[position] = parameterDesc;
        }

        if (wrappedStyle) {
            Part inputPart = getWrappedPart(input);
            QName name = inputPart.getElementName();
            SchemaType operationType = (SchemaType) schemaInfoBuilder.getComplexTypesInWsdl().get(name);

            Set expectedInParams = new HashSet();

            // schemaType should be complex using xsd:sequence compositor
            SchemaParticle parametersType = operationType.getContentModel();
            //parametersType can be null if the element has empty content such as
//            <element name="getMarketSummary">
//             <complexType>
//              <sequence/>
//             </complexType>
//            </element>

            if (parametersType != null) {
                if (SchemaParticle.ELEMENT == parametersType.getParticleType()) {
                    expectedInParams.add(parametersType.getName().getLocalPart());
                } else if (SchemaParticle.SEQUENCE == parametersType.getParticleType()) {
                    SchemaParticle[] parameters = parametersType.getParticleChildren();
                    for (int i = 0; i < parameters.length; i++) {
                        expectedInParams.add(parameters[i].getName().getLocalPart());
                    }
                }
            }
            if (!inParamNames.equals(expectedInParams)) {
                throw new DeploymentException("Not all wrapper children were mapped for operation name" + operationName);
            }
        } else {
            //check that all input message parts are mapped
            if (!inParamNames.equals(input.getParts().keySet())) {
                throw new DeploymentException("Not all input message parts were mapped for operation name" + operationName);
            }
        }

        Class[] paramTypes = new Class[parameterDescriptions.length];
        for (int i = 0; i < parameterDescriptions.length; i++) {
            ParameterDesc parameterDescription = parameterDescriptions[i];
            if (parameterDescription == null) {
                throw new DeploymentException("There is no mapping for parameter number " + i + " for operation " + operationName);
            }
            operationDesc.addParameter(parameterDescription);
            paramTypes[i] = parameterDescription.getJavaType();
        }

        String methodName = methodMapping.getJavaMethodName().getStringValue().trim();
        Method method = null;
        try {
            method = serviceEndpointInterface.getMethod(methodName, paramTypes);
        } catch (NoSuchMethodException e) {
            String args = "(";
            for (int i = 0; i < paramTypes.length; i++) {
                args += paramTypes[i].getName();
                if (i < paramTypes.length - 1) {
                    args += ",";
                }
            }
            args += ")";

            throw new DeploymentException("Mapping references non-existent method in service-endpoint: " + methodName + args);
        }

        operationDesc.setMethod(method);

        // MAP RETURN TYPE
        operationDesc.setMep(operation.getStyle());
        if (methodMapping.isSetWsdlReturnValueMapping()) {
            mapReturnType();
        } else if (operation.getStyle() == OperationType.REQUEST_RESPONSE) {
            //TODO WARNING THIS APPEARS TO SUBVERT THE COMMENT IN j2ee_jaxrpc_mapping_1_1.xsd IN service-endpoint-method-mappingType:
            //The wsdl-return-value-mapping is not specified for one-way operations.
            operationDesc.setReturnQName(null);             //??
            operationDesc.setReturnType(XMLType.AXIS_VOID);
            operationDesc.setReturnClass(void.class);
        }

        if (null != output && wrappedStyle) {
            Part inputPart = getWrappedPart(output);
            QName name = inputPart.getElementName();
            SchemaType operationType = (SchemaType) schemaInfoBuilder.getComplexTypesInWsdl().get(name);

            Set expectedOutParams = new HashSet();

            // schemaType should be complex using xsd:sequence compositor
View Full Code Here

            if (outParamNames.contains(wsdlMessagePartName)) {
                throw new DeploymentException("output message part " + wsdlMessagePartName + " has both an INOUT or OUT mapping and a return value mapping for operation " + operationName);
            }

            if (wrappedStyle) {
                Part outPart = getWrappedPart(output);
                SchemaParticle returnParticle = getWrapperChild(outPart, wsdlMessagePartName);
                //TODO this makes little sense but may be correct, see comments in axis Parameter class
                //the part name qname is really odd.
                returnQName = new QName("", returnParticle.getName().getLocalPart());
                returnType = returnParticle.getType().getName();
            } else if (rpcStyle) {
                Part part = output.getPart(wsdlMessagePartName);
                if (part == null) {
                    throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName + " in output message for operation " + operationName);
                }
                returnQName = new QName("", part.getName());
                returnType = part.getTypeName();
            } else {
                Part part = output.getPart(wsdlMessagePartName);
                if (part == null) {
                    throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName + " in output message for operation " + operationName);
                }
                returnQName = getPartName(part);
                returnType = returnQName;
View Full Code Here

        boolean outHeader = isSoapHeader && isOutParam;

        QName paramQName;
        QName paramTypeQName;

        Part part = null;
        SchemaParticle inParameter = null;
        if (isInParam) {
            if (!wsdlMessageQName.equals(input.getQName())) {
                throw new DeploymentException("QName of input message: " + input.getQName() +
                        " does not match mapping message QName: " + wsdlMessageQName + " for operation " + operationName);
            }
            if (wrappedStyle) {
                Part inPart = getWrappedPart(input);
                // the local name of the global element refered by the part is equal to the operation name
                QName name = inPart.getElementName();
                if (false == name.getLocalPart().equals(operationName)) {
                    throw new DeploymentException("message " + input.getQName() + " refers to a global element named " +
                            name.getLocalPart() + ", which is not equal to the operation name " + operationName);
                }
                inParameter = getWrapperChild(inPart, wsdlMessagePartName);
                //TODO this makes little sense but may be correct, see comments in axis Parameter class
                //the part name qname is really odd.
                paramQName = new QName("", inParameter.getName().getLocalPart());
                paramTypeQName = inParameter.getType().getName();
            } else if (rpcStyle) {
                part = input.getPart(wsdlMessagePartName);
                if (part == null) {
                    throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName + " in input message for operation " + operationName);
                }
                //TODO this makes little sense but may be correct, see comments in axis Parameter class
                //the part name qname is really odd.
                paramQName = new QName("", part.getName());
                paramTypeQName = part.getTypeName();
            } else {
                part = input.getPart(wsdlMessagePartName);
                if (part == null) {
                    throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName + " in input message for operation " + operationName);
                }
                paramQName = getPartName(part);
                paramTypeQName = paramQName;
            }
            inParamNames.add(wsdlMessagePartName);
            if (isOutParam) {
                if (wrappedStyle) {
                    Part outPart = getWrappedPart(output);
                    SchemaParticle outParameter = getWrapperChild(outPart, wsdlMessagePartName);
                    if (inParameter.getType() != outParameter.getType()) {
                        throw new DeploymentException("The wrapper children " + wsdlMessagePartName +
                                " do not have the same type for operation " + operationName);
                    }
                } else if (rpcStyle) {
                    //inout, check that part of same name and type is in output message
                    Part outPart = output.getPart(wsdlMessagePartName);
                    if (outPart == null) {
                        throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName + " in output message for INOUT parameter of operation " + operationName);
                    }
                    // TODO this cannot happen.
                    if (!part.getName().equals(outPart.getName())) {
                        throw new DeploymentException("Mismatched input part name: " + part.getName() + " and output part name: " + outPart.getName() + " for INOUT parameter for wsdlMessagePartName " + wsdlMessagePartName + " for operation " + operationName);
                    }
                    if (!(part.getElementName() == null ? outPart.getElementName() == null : part.getElementName().equals(outPart.getElementName()))) {
                        throw new DeploymentException("Mismatched input part element name: " + part.getElementName() + " and output part element name: " + outPart.getElementName() + " for INOUT parameter for wsdlMessagePartName " + wsdlMessagePartName + " for operation " + operationName);
                    }
                    if (!(part.getTypeName() == null ? outPart.getTypeName() == null : part.getTypeName().equals(outPart.getTypeName()))) {
                        throw new DeploymentException("Mismatched input part type name: " + part.getTypeName() + " and output part type name: " + outPart.getTypeName() + " for INOUT parameter for wsdlMessagePartName " + wsdlMessagePartName + " for operation " + operationName);
                    }
                } else {
                    part = output.getPart(wsdlMessagePartName);
                    if (part == null) {
                        throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName + " in output message for operation " + operationName);
                    }
                    paramQName = getPartName(part);
                    paramTypeQName = paramQName;
                }
                outParamNames.add(wsdlMessagePartName);
            }
        } else if (isOutParam) {
            if (!wsdlMessageQName.equals(output.getQName())) {
                throw new DeploymentException("QName of output message: " + output.getQName() +
                        " does not match mapping message QName: " + wsdlMessageQName + " for operation " + operationName);
            }
            if (wrappedStyle) {
                Part outPart = getWrappedPart(output);
                SchemaParticle outParameter = getWrapperChild(outPart, wsdlMessagePartName);
                //TODO this makes little sense but may be correct, see comments in axis Parameter class
                //the part name qname is really odd.
                paramQName = new QName("", outParameter.getName().getLocalPart());
                paramTypeQName = outParameter.getType().getName();
View Full Code Here

        QName name = helper.createQNameCorbaNamespace(faultName);
        Iterator parts = fault.getMessage().getParts().values().iterator();

        if (parts.hasNext()) {
            Part part = (Part)parts.next();
            schemaType = helper.lookUpType(part);

            if (schemaType != null && !helper.isSchemaTypeException(schemaType)) {
                corbaex = new org.apache.schemas.yoko.bindings.corba.Exception();
                corbaex.setName(schemaType.getName());
                corbaex.setQName(schemaType.getQName());
                CorbaTypeImpl corbaTypeImpl =
                    helper.convertSchemaToCorbaType(schemaType, part.getTypeName(), null, null, false);
                if (corbaTypeImpl != null) {
                    MemberType member = new MemberType();
                    member.setName(corbaTypeImpl.getQName().getLocalPart());
                    member.setIdltype(corbaTypeImpl.getQName());
                    corbaex.getMember().add(member);
                }
            } else {
                QName elementName = part.getElementName();
                QName schematypeName = helper.checkPrefix(schemaType.getQName());
                corbaex = createCorbaException(name, schematypeName, schemaType, elementName);
            }
        } else {           
            String msgStr = "Fault " + fault.getMessage().getQName().getLocalPart()
View Full Code Here

TOP

Related Classes of javax.wsdl.Part

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.