Package javax.wsdl

Examples of javax.wsdl.Operation


        //for each operation
        while (oplist.hasNext()) {
            minfo = new MethodInfo();
            methods.add(minfo);
            //add operation to operation List
            Operation op = (Operation) oplist.next();
            minfo.setMethodname(op.getName());
            System.out.println(op.getName()+"operation name .......................&&&&&&&&&&&");
            //setting the faults
            Map faults = op.getFaults();
      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.
              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.             
                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


        }
    }

    protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, Method method) {
        // rpc out-message-part-info class mapping
        Operation op = (Operation)o.getProperty(WSDLServiceBuilder.WSDL_OPERATION);

        if (initializeClassInfo(o, method, op == null ? null
            : CastUtils.cast(op.getParameterOrdering(), String.class))) {
            bindOperation(o, method);
            o.setProperty(ReflectionServiceFactoryBean.METHOD, method);
        } else {
            LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName());
        }
View Full Code Here

        int i = 0;
        Set wrapperElementQNames = new HashSet();
        JavaXmlTypeMappingType[] javaXmlTypeMappings = mapping.getJavaXmlTypeMappingArray();
        boolean hasEncoded = false;
        for (Iterator ops = operations.iterator(); ops.hasNext();) {
            Operation operation = (Operation) ops.next();
            String operationName = operation.getName();
            //the obvious method seems to be buggy
//            BindingOperation bindingOperation = binding.getBindingOperation(operationName, operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
            BindingOperation bindingOperation = null;
            List bops = binding.getBindingOperations();
            for (Iterator iterator = bops.iterator(); iterator.hasNext();) {
                BindingOperation bindingOperation1 = (BindingOperation) iterator.next();
                if (bindingOperation1.getOperation().equals(operation)) {
                    bindingOperation = bindingOperation1;
                    break;
                }
            }
            if (bindingOperation == null) {
                throw new DeploymentException("No BindingOperation for operation: " + operationName + ", input: " + operation.getInput().getName() + ", output: " + (operation.getOutput() == null ? "<none>" : operation.getOutput().getName()));
            }
            ServiceEndpointMethodMappingType methodMapping = WSDescriptorParser.getMethodMappingForOperation(operationName, methodMappings);
            HeavyweightOperationDescBuilder operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation, mapping, methodMapping, portStyle, exceptionMap, schemaInfoBuilder, javaXmlTypeMappings, classLoader, serviceEndpointInterface);
            OperationInfo operationInfo = operationDescBuilder.buildOperationInfo(soapVersion);
            operationInfos[i++] = operationInfo;
View Full Code Here

        serviceEndpointInterface = getServiceEndpointInterfaceLightweight(portType, mapping, classLoader);
//        Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface, context, module, classLoader);

        int i = 0;
        for (Iterator ops = operations.iterator(); ops.hasNext();) {
            Operation operation = (Operation) ops.next();
            Method method = WSDescriptorParser.getMethodForOperation(serviceEndpointInterface, operation);
            BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(), operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
            operationInfos[i++] = buildOperationInfoLightweight(method, bindingOperation, portStyle, soapVersion);
        }
        LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), Collections.EMPTY_SET);
        List typeInfo = builder.buildTypeInfo(mapping);
View Full Code Here

        int i = 0;
        Set wrapperElementQNames = new HashSet();
        JavaXmlTypeMappingType[] javaXmlTypeMappings = mapping.getJavaXmlTypeMappingArray();
        boolean hasEncoded = false;
        for (Iterator ops = operations.iterator(); ops.hasNext();) {
            Operation operation = (Operation) ops.next();
            String operationName = operation.getName();
            //the obvious method seems to be buggy
//            BindingOperation bindingOperation = binding.getBindingOperation(operationName, operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
            BindingOperation bindingOperation = null;
            List bops = binding.getBindingOperations();
            for (Iterator iterator = bops.iterator(); iterator.hasNext();) {
                BindingOperation bindingOperation1 = (BindingOperation) iterator.next();
                if (bindingOperation1.getOperation().equals(operation)) {
                    bindingOperation = bindingOperation1;
                    break;
                }
            }
            if (bindingOperation == null) {
                throw new DeploymentException("No BindingOperation for operation: " + operationName + ", input: " + operation.getInput().getName() + ", output: " + (operation.getOutput() == null ? "<none>" : operation.getOutput().getName()));
            }
            ServiceEndpointMethodMappingType methodMapping = WSDescriptorParser.getMethodMappingForOperation(operationName, methodMappings);
            HeavyweightOperationDescBuilder operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation, mapping, methodMapping, portStyle, exceptionMap, schemaInfoBuilder, javaXmlTypeMappings, classLoader, serviceEndpointInterface);
            OperationInfo operationInfo = operationDescBuilder.buildOperationInfo(soapVersion);
            operationInfos[i++] = operationInfo;
View Full Code Here

        serviceEndpointInterface = getServiceEndpointInterfaceLightweight(portType, mapping, classLoader);
//        Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface, context, module, classLoader);

        int i = 0;
        for (Iterator ops = operations.iterator(); ops.hasNext();) {
            Operation operation = (Operation) ops.next();
            Method method = WSDescriptorParser.getMethodForOperation(serviceEndpointInterface, operation);
            BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(), operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
            operationInfos[i++] = buildOperationInfoLightweight(method, bindingOperation, portStyle, soapVersion);
        }
        LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), Collections.EMPTY_SET);
        List typeInfo = builder.buildTypeInfo(mapping);
View Full Code Here

        sendEvent(Event.INTERFACE_CREATED, intf, getServiceClass());
    }

    protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, Method method) {
        // rpc out-message-part-info class mapping
        Operation op = (Operation)o.getProperty(WSDLServiceBuilder.WSDL_OPERATION);

        if (initializeClassInfo(o, method, op == null ? null
            : CastUtils.cast(op.getParameterOrdering(), String.class))) {
            bindOperation(o, method);
            o.setProperty(ReflectionServiceFactoryBean.METHOD, method);
            sendEvent(Event.INTERFACE_OPERATION_BOUND, o, method);
        } else {
            LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName());
View Full Code Here

    protected void buildPortTypeOperation(PortType portType,
                                          Collection<OperationInfo> operationInfos,
                                          final Definition def) {
        for (OperationInfo operationInfo : operationInfos) {
            Operation operation = null;
            try {
                operation = operationInfo.getProperty(
                    WSDLServiceBuilder.WSDL_OPERATION, Operation.class);
            } catch (ClassCastException e) {
                // do nothing
            }
           
            if (operation == null) {
                operation = def.createOperation();
                operation.setUndefined(false);
                operation.setName(operationInfo.getName().getLocalPart());
                addNamespace(operationInfo.getName().getNamespaceURI(), def);
                if (operationInfo.isOneWay()) {
                    operation.setStyle(OperationType.ONE_WAY);
                }
                addExtensibilityElements(operation, getWSDL11Extensors(operationInfo));
                Input input = def.createInput();
                input.setName(operationInfo.getInputName());
                Message message = def.createMessage();
                buildMessage(message, operationInfo.getInput(), def);
                this.addExtensibilityAttributes(input, getInputExtensionAttributes(operationInfo));
                this.addExtensibilityElements(input, getWSDL11Extensors(operationInfo.getInput()));
                input.setMessage(message);
                operation.setInput(input);
                operation.setParameterOrdering(operationInfo.getParameterOrdering());
               
                if (operationInfo.getOutput() != null) {
                    Output output = def.createOutput();
                    output.setName(operationInfo.getOutputName());
                    message = def.createMessage();
                    buildMessage(message, operationInfo.getOutput(), def);
                    this.addExtensibilityAttributes(output, getOutputExtensionAttributes(operationInfo));
                    this.addExtensibilityElements(output, getWSDL11Extensors(operationInfo.getOutput()));
                    output.setMessage(message);
                    operation.setOutput(output);
                }
                //loop to add fault
                Collection<FaultInfo> faults = operationInfo.getFaults();
                Fault fault = null;
                for (FaultInfo faultInfo : faults) {
                    fault = def.createFault();
                    fault.setName(faultInfo.getFaultName().getLocalPart());
                    message = def.createMessage();
                    buildMessage(message, faultInfo, def);
                    this.addExtensibilityAttributes(fault, faultInfo.getExtensionAttributes());
                    this.addExtensibilityElements(fault, getWSDL11Extensors(faultInfo));
                    fault.setMessage(message);
                    operation.addFault(fault);
                }
            }
            portType.addOperation(operation);
        }
    }
View Full Code Here

        List operations = portType.getOperations();
        if ( operations == null )
            throw new JAXRPCException( Messages.getMessage("noOperation01",
                                                           opName) );

        Operation op = null ;
        for ( int i = 0 ; i < operations.size() ; i++, op=null ) {
            op = (Operation) operations.get( i );
            if ( opName.equals( op.getName() ) ) break ;
        }
        if ( op == null )
            throw new JAXRPCException( Messages.getMessage("noOperation01",
                                                           opName) );
View Full Code Here

    private final void writeServiceTestCode(PrintWriter pw,
            String portName, PortType portType, PortTypeEntry ptEntry,
            Binding binding, BindingEntry bEntry) throws IOException {
        Iterator ops = portType.getOperations().iterator();
        while (ops.hasNext()) {
            Operation op = (Operation) ops.next();
            OperationType type = op.getStyle();
            Parameters params = bEntry.getParameters(op);
            // did we emit a constructor that throws?
            BooleanHolder bThrow = new BooleanHolder(false);

            // These operation types are not supported.  The signature
            // will be a string stating that fact.
            if (type == OperationType.NOTIFICATION
                    || type == OperationType.SOLICIT_RESPONSE) {
                pw.println("    " + params.signature);
                continue;
            }

            String javaOpName = Utils.xmlNameToJavaClass(op.getName());
            String testMethodName = "test" + counter++ + portName + javaOpName;
            pw.println("    public void " + testMethodName + "() throws Exception {");

            String bindingType = (String) bEntry.getDynamicVar(JavaBindingWriter.INTERFACE_NAME);
            writeBindingAssignment(pw, bindingType, portName);

           
            pw.println("        // Test operation");
            String indent = "";
            Map faultMap = op.getFaults();
            if (faultMap != null && faultMap.size() > 0) {
                // we are going to catch fault Exceptions
                pw.println("        try {");
                indent = "    ";
            }
            if (params.returnParam != null) {
                TypeEntry returnType = params.returnParam.getType();
                pw.print("        " + indent);
                pw.print(Utils.getParameterTypeName(params.returnParam));
                pw.print(" value = ");

                if (params.returnParam.getMIMEType() == null &&
                        Utils.isPrimitiveType(returnType)) {
                    if ("boolean".equals(returnType.getName())) {
                        pw.println("false;");
                    } else {
                        pw.println("-3;");
                    }
                } else {
                    pw.println("null;");
                }
            }

            pw.print  ("        " + indent);

            if (params.returnParam != null) {
                pw.print("value = ");
            }

            pw.print("binding.");
            pw.print(Utils.xmlNameToJava(op.getName()));
            pw.print("(");

            Iterator iparam = params.list.iterator();
            boolean isFirst = true;
View Full Code Here

TOP

Related Classes of javax.wsdl.Operation

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.