Package org.jboss.ws.core.binding

Examples of org.jboss.ws.core.binding.SerializationContext


      {
         soapFault = soapBody.addFault(getFallbackFaultCode(), getFallbackFaultString(ex));
      }

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      SerializationContext serContext = msgContext.getSerializationContext();

      NameImpl faultCode = (NameImpl)soapFault.getFaultCodeAsName();
      if (faultCode.getURI().length() > 0)
         serContext.getNamespaceRegistry().registerQName(faultCode.toQName());

      OperationMetaData opMetaData = msgContext.getOperationMetaData();
      Class<? extends Exception> exClass = ex.getClass();
      if (opMetaData != null && opMetaData.getFaultMetaData(exClass) != null)
      {
View Full Code Here


      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      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
         TypeMappingImpl typeMapping = serContext.getTypeMapping();
         AbstractDeserializerFactory deserializerFactory = getDeserializerFactory(typeMapping, javaType, xmlType);
         DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer();

         obj = des.deserialize(container, serContext);
         if (obj != null)
View Full Code Here

      Detail detail = soapFault.getDetail();
      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (detail != null && msgContext != null)
      {
         log.debug("Processing detail");
         SerializationContext serContext = msgContext.getSerializationContext();
         TypeMapping typeMapping = serContext.getTypeMapping();

         Iterator it = detail.getDetailEntries();
         while (it.hasNext())
         {
            DetailEntry deElement = (DetailEntry)it.next();
            QName xmlName = deElement.getElementQName();
            log.debug("Processing detail entry: " + xmlName);

            OperationMetaData opMetaData = msgContext.getOperationMetaData();
            FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
            if (faultMetaData != null)
            {
               log.debug("Deserialize fault: " + faultMetaData);
               QName xmlType = faultMetaData.getXmlType();
               Class<?> faultBeanClass = faultMetaData.getFaultBean();

               // Get the deserializer from the type mapping
               AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(faultBeanClass, xmlType);
               if (desFactory == null)
                  throw new WebServiceException("Cannot obtain deserializer factory: xmlType=" + xmlType + ", javaType=" + faultBeanClass);

               // http://jira.jboss.org/jira/browse/JBWS-955
               // Cannot deserialize fault detail
               String prefix = deElement.getPrefix();
               if (prefix != null && prefix.length() > 0)
               {
                  String nsURI = deElement.getNamespaceURI();
                  if (nsURI.length() > 0 && deElement.getAttributeNS(Constants.NS_XMLNS, prefix).length() == 0)
                  {
                     try
                     {
                        deElement.addNamespaceDeclaration(prefix, nsURI);
                     }
                     catch (SOAPException e)
                     {
                        log.warn("Declaration of detail entry namespace failed", e);
                     }
                  }
               }

               // Try jaxb deserialization
               try
               {
                  Class[] types = opMetaData.getEndpointMetaData().getRegisteredTypes().toArray(new Class[0]);
                  serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, types);

                  Source source = new DOMSource(deElement);
                  DeserializerSupport des = (DeserializerSupport)desFactory.getDeserializer();
                  Object faultBean = des.deserialize(xmlName, xmlType, source, serContext);
View Full Code Here

      SOAPBody soapBody = soapMessage.getSOAPBody();

      SOAPFault soapFault = soapBody.addFault(getFallbackFaultCode(), getFallbackFaultString(ex));

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      SerializationContext serContext = msgContext.getSerializationContext();

      NameImpl faultCode = (NameImpl)soapFault.getFaultCodeAsName();
      if (faultCode.getURI().length() > 0)
         serContext.getNamespaceRegistry().registerQName(faultCode.toQName());

      OperationMetaData opMetaData = msgContext.getOperationMetaData();
      Class<? extends Exception> exClass = ex.getClass();
      if (opMetaData != null && opMetaData.getFaultMetaData(exClass) != null)
      {
View Full Code Here

      Detail detail = soapFault.getDetail();
      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (detail != null && msgContext != null)
      {
         log.debug("Processing detail");
         SerializationContext serContext = msgContext.getSerializationContext();
         TypeMapping typeMapping = serContext.getTypeMapping();

         Iterator it = detail.getDetailEntries();
         while (it.hasNext())
         {
            DetailEntry deElement = (DetailEntry)it.next();
            QName xmlName = deElement.getElementQName();
            log.debug("Processing detail entry: " + xmlName);

            OperationMetaData opMetaData = msgContext.getOperationMetaData();
            FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
            if (faultMetaData != null)
            {
               log.debug("Deserialize fault: " + faultMetaData);
               QName xmlType = faultMetaData.getXmlType();
               Class<?> faultBeanClass = faultMetaData.getFaultBean();

               // Get the deserializer from the type mapping
               AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(faultBeanClass, xmlType);
               if (desFactory == null)
                  throw new WebServiceException("Cannot obtain deserializer factory: xmlType=" + xmlType + ", javaType=" + faultBeanClass);

               // http://jira.jboss.org/jira/browse/JBWS-955
               // Cannot deserialize fault detail
               String prefix = deElement.getPrefix();
               if (prefix != null && prefix.length() > 0)
               {
                  String nsURI = deElement.getNamespaceURI();
                  if (nsURI.length() > 0 && deElement.getAttributeNS(Constants.NS_XMLNS, prefix).length() == 0)
                  {
                     try
                     {
                        deElement.addNamespaceDeclaration(prefix, nsURI);
                     }
                     catch (SOAPException e)
                     {
                        log.warn("Declaration of detail entry namespace failed", e);
                     }
                  }
               }

               // Try jaxb deserialization
               try
               {
                  Class[] types = opMetaData.getEndpointMetaData().getRegisteredTypes().toArray(new Class[0]);
                  serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, types);

                  Source source = new DOMSource(deElement);
                  DeserializerSupport des = (DeserializerSupport)desFactory.getDeserializer();
                  Object faultBean = des.deserialize(xmlName, xmlType, source, serContext);
View Full Code Here

      SOAPBody soapBody = soapMessage.getSOAPBody();

      SOAPFault soapFault = soapBody.addFault(getFallbackFaultCode(), getFallbackFaultString(ex));

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      SerializationContext serContext = msgContext.getSerializationContext();

      NameImpl faultCode = (NameImpl)soapFault.getFaultCodeAsName();
      if (faultCode.getURI().length() > 0)
         serContext.getNamespaceRegistry().registerQName(faultCode.toQName());

      OperationMetaData opMetaData = msgContext.getOperationMetaData();
      Class<? extends Exception> exClass = ex.getClass();
      if (opMetaData != null && opMetaData.getFaultMetaData(exClass) != null)
      {
View Full Code Here

/*     */
/* 137 */     CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
/* 138 */     if (msgContext == null) {
/* 139 */       throw new WSException("MessageContext not available");
/*     */     }
/* 141 */     SerializationContext serContext = msgContext.getSerializationContext();
/* 142 */     serContext.setJavaType(javaType);
/*     */
/* 144 */     TypeMappingImpl typeMapping = serContext.getTypeMapping();
/* 145 */     XMLFragment xmlFragment = null;
/*     */     try
/*     */     {
/*     */       SerializerSupport ser;
/*     */       SerializerSupport ser;
View Full Code Here

/*     */
/* 159 */     log.debug("getObjectValue [xmlType=" + xmlType + ",javaType=" + javaType + "]");
/*     */
/* 161 */     CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
/* 162 */     if (msgContext == null) {
/* 163 */       throw new WSException("MessageContext not available"); } SerializationContext serContext = msgContext.getSerializationContext();
/* 166 */     ParameterMetaData pmd = this.container.getParamMetaData();
/* 167 */     OperationMetaData opMetaData = pmd.getOperationMetaData();
/* 168 */     serContext.setProperty(ParameterMetaData.class.getName(), pmd);
/* 169 */     serContext.setJavaType(javaType);
/* 170 */     List registeredTypes = opMetaData.getEndpointMetaData().getRegisteredTypes();
/* 171 */     serContext.setProperty("org.jboss.ws.jaxb.context.types", registeredTypes.toArray(new Class[0]));
/*     */     Object obj;
/*     */     try { TypeMappingImpl typeMapping = serContext.getTypeMapping();
/* 177 */       AbstractDeserializerFactory deserializerFactory = getDeserializerFactory(typeMapping, javaType, xmlType);
/* 178 */       DeserializerSupport des = deserializerFactory.getDeserializer();
/*     */
/* 180 */       obj = des.deserialize(this.container, serContext);
/* 181 */       if (obj != null)
View Full Code Here

/*  74 */     Detail detail = soapFault.getDetail();
/*  75 */     CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
/*  76 */     if ((detail != null) && (msgContext != null))
/*     */     {
/*  78 */       log.debug("Processing detail");
/*  79 */       SerializationContext serContext = msgContext.getSerializationContext();
/*  80 */       TypeMapping typeMapping = serContext.getTypeMapping();
/*     */
/*  82 */       Iterator it = detail.getDetailEntries();
/*  83 */       while (it.hasNext())
/*     */       {
/*  85 */         DetailEntry deElement = (DetailEntry)it.next();
/*  86 */         QName xmlName = deElement.getElementQName();
/*  87 */         log.debug("Processing detail entry: " + xmlName);
/*     */
/*  89 */         OperationMetaData opMetaData = msgContext.getOperationMetaData();
/*  90 */         FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
/*  91 */         if (faultMetaData != null)
/*     */         {
/*  93 */           log.debug("Deserialize fault: " + faultMetaData);
/*  94 */           QName xmlType = faultMetaData.getXmlType();
/*  95 */           Class faultBeanClass = faultMetaData.getFaultBean();
/*     */
/*  98 */           AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(faultBeanClass, xmlType);
/*  99 */           if (desFactory == null) {
/* 100 */             throw new WebServiceException("Cannot obtain deserializer factory: xmlType=" + xmlType + ", javaType=" + faultBeanClass);
/*     */           }
/*     */
/* 104 */           String prefix = deElement.getPrefix();
/* 105 */           if ((prefix != null) && (prefix.length() > 0))
/*     */           {
/* 107 */             String nsURI = deElement.getNamespaceURI();
/* 108 */             if ((nsURI.length() > 0) && (deElement.getAttributeNS("http://www.w3.org/2000/xmlns/", prefix).length() == 0))
/*     */             {
/*     */               try
/*     */               {
/* 112 */                 deElement.addNamespaceDeclaration(prefix, nsURI);
/*     */               }
/*     */               catch (SOAPException e)
/*     */               {
/* 116 */                 log.warn("Declaration of detail entry namespace failed", e);
/*     */               }
/*     */             }
/*     */
/*     */           }
/*     */
/*     */           try
/*     */           {
/* 124 */             Class[] types = (Class[])opMetaData.getEndpointMetaData().getRegisteredTypes().toArray(new Class[0]);
/* 125 */             serContext.setProperty("org.jboss.ws.jaxb.context.types", types);
/*     */
/* 127 */             Source source = new DOMSource(deElement);
/* 128 */             DeserializerSupport des = desFactory.getDeserializer();
/* 129 */             Object faultBean = des.deserialize(xmlName, xmlType, source, serContext);
/*     */
View Full Code Here

/* 247 */     SOAPBody soapBody = soapMessage.getSOAPBody();
/*     */
/* 249 */     SOAPFault soapFault = soapBody.addFault(getFallbackFaultCode(), getFallbackFaultString(ex));
/*     */
/* 251 */     CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
/* 252 */     SerializationContext serContext = msgContext.getSerializationContext();
/*     */
/* 254 */     NameImpl faultCode = (NameImpl)soapFault.getFaultCodeAsName();
/* 255 */     if (faultCode.getURI().length() > 0) {
/* 256 */       serContext.getNamespaceRegistry().registerQName(faultCode.toQName());
/*     */     }
/* 258 */     OperationMetaData opMetaData = msgContext.getOperationMetaData();
/* 259 */     Class exClass = ex.getClass();
/* 260 */     if ((opMetaData != null) && (opMetaData.getFaultMetaData(exClass) != null))
/*     */     {
View Full Code Here

TOP

Related Classes of org.jboss.ws.core.binding.SerializationContext

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.