Package org.jboss.ws.metadata.umdm

Examples of org.jboss.ws.metadata.umdm.OperationMetaData


      {
         Class javaType = faultCause.getClass();

         TypeMapping typeMapping = serContext.getTypeMapping();

         OperationMetaData opMetaData = msgContext.getOperationMetaData();
         if (opMetaData != null && opMetaData.getFaultMetaData(javaType) != null)
         {
            FaultMetaData faultMetaData = opMetaData.getFaultMetaData(javaType);
            QName xmlName = faultMetaData.getXmlName();
            QName xmlType = faultMetaData.getXmlType();

            xmlName = nsRegistry.registerQName(xmlName);
View Full Code Here


      try
      {
         boolean oneway = false;
         EndpointInvocation sepInv = null;
         OperationMetaData opMetaData = null;
         CommonBinding binding = bindingProvider.getCommonBinding();
         binding.setHeaderSource(delegate);

         if (binding instanceof CommonSOAPBinding)
            XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
        
         // call the request handler chain
         boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);

         // Unbind the request message
         if (handlersPass)
         {
            // Get the operation meta data from the SOAP message
            opMetaData = getDispatchDestination(sepMetaData, reqMessage);
            msgContext.setOperationMetaData(opMetaData);
            oneway = opMetaData.isOneWay();

            /*
             * From JAX-WS 10.2.1 - "7. If the node does not understand how to process
             * the message, then neither handlers nor the endpoint
             * are invoked and instead the binding generates a SOAP must
View Full Code Here

      return msgContext;
   }

   private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException
   {
      OperationMetaData opMetaData;

      String bindingID = epMetaData.getBindingId();
      if (HTTPBinding.HTTP_BINDING.equals(bindingID))
      {
         if (epMetaData.getOperations().size() != 1)
View Full Code Here

         throw new WSException("MessageContext not available");

      SerializationContext serContext = msgContext.getSerializationContext();
      serContext.setJavaType(javaType);
      ParameterMetaData pmd = container.getParamMetaData();
      OperationMetaData opMetaData = pmd.getOperationMetaData();
      List<Class> registeredTypes = opMetaData.getEndpointMetaData().getRegisteredTypes();
      serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, registeredTypes.toArray(new Class[0]));

      TypeMappingImpl typeMapping = serContext.getTypeMapping();
      XMLFragment xmlFragment = null;
      try
View Full Code Here

            operationName = anWebMethod.operationName();
         }
      }

      String targetNS = epMetaData.getPortTypeName().getNamespaceURI();
      OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, operationName), javaName);
      opMetaData.setOneWay(method.isAnnotationPresent(Oneway.class));
      opMetaData.setSOAPAction(soapAction);

      if (method.isAnnotationPresent(SOAPBinding.class))
      {
         SOAPBinding anBinding = method.getAnnotation(SOAPBinding.class);
         if (anBinding.style() != SOAPBinding.Style.DOCUMENT || epMetaData.getStyle() != Style.DOCUMENT)
            throw new IllegalArgumentException("@SOAPBinding must be specified using DOCUMENT style when placed on a method");
         opMetaData.setParameterStyle(anBinding.parameterStyle());
      }

      epMetaData.addOperation(opMetaData);

      // Build parameter meta data
      // Attachment annotations on SEI parameters
      List<AttachmentScanResult> scanResult = ReflectiveAttachmentRefScanner.scanMethod(method);

      Class[] parameterTypes = method.getParameterTypes();
      Type[] genericTypes = method.getGenericParameterTypes();
      Annotation[][] parameterAnnotations = method.getParameterAnnotations();
      ParameterMetaData wrapperParameter = null, wrapperOutputParameter = null;
      List<WrappedParameter> wrappedParameters = null, wrappedOutputParameters = null;

      // Force paramter style to wrapped
      if (method.isAnnotationPresent(RequestWrapper.class) || method.isAnnotationPresent(ResponseWrapper.class))
      {
         epMetaData.setParameterStyle(ParameterStyle.WRAPPED);
      }

      if (opMetaData.isDocumentWrapped())
      {
         wrapperParameter = createRequestWrapper(opMetaData, method);
         wrappedParameters = new ArrayList<WrappedParameter>(parameterTypes.length);
         wrapperParameter.setWrappedParameters(wrappedParameters);

         if (!opMetaData.isOneWay())
         {
            wrapperOutputParameter = createResponseWrapper(opMetaData, method);
            wrappedOutputParameters = new ArrayList<WrappedParameter>(parameterTypes.length + 1);
            wrapperOutputParameter.setWrappedParameters(wrappedOutputParameters);
         }
      }

      for (int i = 0; i < parameterTypes.length; i++)
      {
         Class javaType = parameterTypes[i];
         Type genericType = genericTypes[i];
         String javaTypeName = javaType.getName();
         WebParam anWebParam = getWebParamAnnotation(method, i);
         boolean isHeader = anWebParam != null && anWebParam.header();
         boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
         ParameterMode mode = getParameterMode(anWebParam, javaType);

         // Assert one-way
         if (opMetaData.isOneWay() && mode != ParameterMode.IN)
            throw new IllegalArgumentException("A one-way operation can not have output parameters [" + "method = " + method.getName() + ", parameter = " + i + "]");

         if (HolderUtils.isHolderType(javaType))
         {
            genericType = HolderUtils.getGenericValueType(genericType);
            javaType = JavaUtils.erasure(genericType);
            javaTypeName = javaType.getName();
         }

         if (isWrapped)
         {
            QName wrappedElementName = getWebParamName(opMetaData, i, anWebParam);
            String variable = convertToVariable(wrappedElementName.getLocalPart());

            WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName, javaTypeName, variable, i);
            wrappedParameter.setTypeArguments(convertTypeArguments(javaType, genericType));

            if (mode != ParameterMode.OUT)
               wrappedParameters.add(wrappedParameter);

            if (mode != ParameterMode.IN)
            {
               wrappedParameter.setHolder(true);

               // WrappedParameters can not be shared between request/response objects (accessors)
               if (mode == ParameterMode.INOUT)
                  wrappedParameter = new WrappedParameter(wrappedParameter);
               wrappedOutputParameters.add(wrappedParameter);
            }

            processAttachmentAnnotationsWrapped(scanResult, i, wrappedParameter);
         }
         else
         {
            QName xmlName = getWebParamName(opMetaData, i, anWebParam);

            ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, javaTypeName);
            paramMetaData.setInHeader(isHeader);
            paramMetaData.setIndex(i);
            paramMetaData.setMode(mode);

            /*
             * Note: The TCK enforces the following rule in the spec regarding
             * partName: "This is only used if the operation is rpc style or if
             * the operation is document style and the parameter style is BARE."
             *
             * This seems to be a flaw in the spec, because the intention is
             * obviously to prevent the ambiguity of wrapped parameters that
             * specify different partName values. There is, however, no reason
             * that this limitation should apply to header parameters since they
             * are never wrapped. In order to comply we adhere to this confusing
             * rule, although I will ask for clarification.
             */
            if (anWebParam != null && !opMetaData.isDocumentWrapped() && anWebParam.partName().length() > 0)
               paramMetaData.setPartName(anWebParam.partName());

            opMetaData.addParameter(paramMetaData);
            javaTypes.add(javaType);
            typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));

            processAttachmentAnnotations(scanResult, i, paramMetaData);
            processMIMEBinding(epMetaData, opMetaData, paramMetaData);
         }
      }

      // Build result meta data
      Class returnType = method.getReturnType();
      Type genericReturnType = method.getGenericReturnType();
      String returnTypeName = returnType.getName();
      if (!(returnType == void.class))
      {
         if (opMetaData.isOneWay())
            throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");

         WebResult anWebResult = method.getAnnotation(WebResult.class);
         boolean isHeader = anWebResult != null && anWebResult.header();
         boolean isWrappedBody = opMetaData.isDocumentWrapped() && !isHeader;
         QName xmlName = getWebResultName(opMetaData, anWebResult);

         if (isWrappedBody)
         {
            WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
            wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));

            // insert at the beginning just for prettiness
            wrappedOutputParameters.add(0, wrapped);

            processAttachmentAnnotationsWrapped(scanResult, -1, wrapped);
         }
         else
         {
            ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName);
            retMetaData.setInHeader(isHeader);
            retMetaData.setIndex(-1);
            retMetaData.setMode(ParameterMode.OUT);

            // Special case: If we have a document/literal wrapped message, then
            // the return metadata must be the wrapper type that is sent in the
            // body. So, in order to handle headers that are mapped to the java
            // return value, we have to add them to a parameter with an index of
            // -1 to signify the return value. All other binding styles use the
            // expected return value mechanism.
            if (opMetaData.isDocumentWrapped())
            {
               opMetaData.addParameter(retMetaData);
            }
            else
            {
               // See above comment in the parameter for loop section as to why
               // we prevent customization of part names on document wrapped
               // header parameters.
               if (anWebResult != null && anWebResult.partName().length() > 0)
                  retMetaData.setPartName(anWebResult.partName());

               opMetaData.setReturnParameter(retMetaData);
            }

            javaTypes.add(returnType);
            typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations()));

            processAttachmentAnnotations(scanResult, -1, retMetaData);
            processMIMEBinding(epMetaData, opMetaData, retMetaData);
         }
      }

      // Generate wrapper beans
      if (opMetaData.isDocumentWrapped())
      {
         if (wrapperParameter.loadWrapperBean() == null)
            wrapperGenerator.generate(wrapperParameter);

         Class wrapperClass = wrapperParameter.getJavaType();
         javaTypes.add(wrapperClass);

         // In case there is no @XmlRootElement
         typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
         if (!opMetaData.isOneWay())
         {
            if (wrapperOutputParameter.loadWrapperBean() == null)
               wrapperGenerator.generate(wrapperOutputParameter);

            wrapperClass = wrapperOutputParameter.getJavaType();
View Full Code Here

      if (msgContext == null)
         throw new WSException("MessageContext not available");

      SerializationContext serContext = msgContext.getSerializationContext();
      ParameterMetaData pmd = container.getParamMetaData();
      OperationMetaData opMetaData = pmd.getOperationMetaData();
      serContext.setProperty(ParameterMetaData.class.getName(), pmd);
      serContext.setJavaType(javaType);
      List<Class> registeredTypes = opMetaData.getEndpointMetaData().getRegisteredTypes();
      serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, registeredTypes.toArray(new Class[0]));

      try
      {
         // Get the deserializer from the type mapping
View Full Code Here

      decoder.decode(message.getSOAPPart(), secHeaderElement);

      if (log.isTraceEnabled())
         log.trace("Decoded Message:\n" + DOMWriter.printNode(message.getSOAPPart(), true));

      OperationMetaData opMetaData = ctx.getOperationMetaData();
      if (opMetaData == null)
      {
         // Get the operation meta data from the soap message
         // for the server side inbound message.
         EndpointMetaData epMetaData = ctx.getEndpointMetaData();
         opMetaData = message.getOperationMetaData(epMetaData);
      }

      String operation = null;
      String port = null;
      if (opMetaData != null)
      {
         operation = opMetaData.getQName().toString();
         port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
      }

      List<OperationDescription<RequireOperation>> operations = buildRequireOperations(configuration, operation, port);

      decoder.verify(operations);
View Full Code Here

   }  
  
 
  private static Config getConfig(CommonMessageContext ctx, WSSecurityConfiguration configuration, SOAPMessageImpl message) throws SOAPException
   {
      OperationMetaData opMetaData = ctx.getOperationMetaData();
      if (opMetaData == null)
      {
         // Get the operation meta data from the soap message
         // for the server side inbound message.
         EndpointMetaData epMetaData = ctx.getEndpointMetaData();
         opMetaData = message.getOperationMetaData(epMetaData);
      }

      String operation = null;
      String port = null;
      if (opMetaData != null)
      {
         operation = opMetaData.getQName().toString();
         port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
      }

      return getConfig(configuration, port, operation);
   }
View Full Code Here

         if (ctx != null)
         {
            EndpointMetaData epMetaData = ctx.getEndpointMetaData();
            QName port = epMetaData.getPortName();

            OperationMetaData opMetaData = ctx.getOperationMetaData();
            if (opMetaData == null)
            {
               // Get the operation meta data from the soap message
               // for the server side inbound message.
               SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage();
               try
               {
                  opMetaData = soapMessage.getOperationMetaData(epMetaData);
               }
               catch (SOAPException e)
               {
                  throw new WebServiceException("Error while looking for the operation meta data: " + e);
               }
            }
            if (opMetaData != null)
               operationConfig = selectOperationConfig(configuration, port, opMetaData.getQName());
         }
      }
      //null operationConfig means default behavior
      return operationConfig != null ? operationConfig : configuration.getDefaultConfig();
   }
View Full Code Here

      EndpointMetaData epMetaData = ctx.getEndpointMetaData();
      String port = epMetaData.getPortName().getLocalPart();
     
      String opName = null;
      OperationMetaData opMetaData = ctx.getOperationMetaData();
      if (opMetaData != null)
         opName = opMetaData.getQName().toString();

      Config opConfig = getConfig(config, port, opName);
      log.debug("WS-Security config: " + opConfig);

      // Nothing to process
View Full Code Here

TOP

Related Classes of org.jboss.ws.metadata.umdm.OperationMetaData

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.