Package org.jboss.ws

Examples of org.jboss.ws.WSException


   public TypeMappingImpl getTypeMapping()
   {
      Use encStyle = getEncodingStyle();
      TypeMappingImpl typeMapping = (TypeMappingImpl)tmRegistry.getTypeMapping(encStyle.toURI());
      if (typeMapping == null)
         throw new WSException("No type mapping for encoding style: " + encStyle);

      return typeMapping;
   }
View Full Code Here


               {
                  encStyle = epMetaData.getEncodingStyle();
               }
               else if (encStyle.equals(epMetaData.getEncodingStyle()) == false)
               {
                  throw new WSException("Conflicting encoding styles not supported");
               }
            }
         }
         else
         {
View Full Code Here

   /** Assert that the given namespace is the WSDL's target namespace */
   public void assertTargetNamespace(String targetNS)
   {
      if (getServiceName().getNamespaceURI().equals(targetNS) == false)
         throw new WSException("Requested namespace is not WSDL target namespace: " + targetNS);
   }
View Full Code Here

         {
            expandContainerChildren();
         }
         catch (SOAPException ex)
         {
            throw new WSException("Cannot expand container children", ex);
         }
         next = new DOMContent(container);
      }
      else
      {
View Full Code Here

      log.debug("getObjectValue [xmlType=" + xmlType + ",javaType=" + javaType + "]");

      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)
         {
            Class objType = obj.getClass();
            boolean isAssignable = JavaUtils.isAssignableFrom(javaType, objType);
            if (!isAssignable && javaType.isArray())
            {
               try
               {
                  Method toArrayMethod = objType.getMethod("toArray");
                  Class returnType = toArrayMethod.getReturnType();
                  if (JavaUtils.isAssignableFrom(javaType, returnType))
                  {
                     Method getValueMethod = objType.getMethod("getValue");
                     Object value = getValueMethod.invoke(obj);
                     if (value != null)
                     {
                        // Do not invoke toArray if getValue returns null
                        obj = toArrayMethod.invoke(obj);
                     }
                     else
                     {
                        // if the fragment did not indicate a null return
                        // by an xsi:nil we return an empty array
                        Class componentType = javaType.getComponentType();
                        obj = Array.newInstance(componentType, 0);
                     }
                     isAssignable = true;
                  }
               }
               catch (Exception e)
               {
                  // ignore
               }
            }

            if (!isAssignable)
            {
               // handle XOP simple types, i.e. in RPC/LIT
               try
               {
                  String contentType = MimeUtils.resolveMimeType(javaType);
                  log.debug("Adopt DataHandler to " + javaType + ", contentType " + contentType);

                  DataSource ds = new SwapableMemoryDataSource(((DataHandler)obj).getInputStream(), contentType);
                  DataHandler dh = new DataHandler(ds);
                  obj = dh.getContent();

                  // 'application/octet-stream' will return a byte[] instead fo the stream
                  if (obj instanceof InputStream)
                  {
                     ByteArrayOutputStream bout = new ByteArrayOutputStream();
                     dh.writeTo(bout);
                     obj = bout.toByteArray();
                  }
               }
               catch (IOException e)
               {
                  throw new WSException("Failed to adopt XOP content type", e);
               }

               if (!JavaUtils.isAssignableFrom(javaType, obj.getClass()))
               {
                  throw new WSException("Java type '" + javaType + "' is not assignable from: " + objType.getName());
               }
            }
         }
      }
      catch (BindingException e)
      {
         throw new WSException(e);
      }

      log.debug("objectValue: " + (obj != null ? obj.getClass().getName() : null));

      return obj;
View Full Code Here

            }
         }
      }

      if (deserializerFactory == null)
         throw new WSException("Cannot obtain deserializer factory for: [xmlType=" + xmlType + ",javaType=" + javaType + "]");

      return deserializerFactory;
   }
View Full Code Here

      QName qname = container.getElementQName();
      QName contentRootName = DOMUtils.getElementQName(domElement);
      boolean artificalElement = (SOAPContentElement.GENERIC_PARAM_NAME.equals(qname) || SOAPContentElement.GENERIC_RETURN_NAME.equals(qname));

      if (!artificalElement && !contentRootName.equals(qname))
         throw new WSException("Content root name does not match element name: " + contentRootName + " != " + qname);

      // Remove all child nodes
      container.removeContents();

      // In case of dispatch and provider we use artifical element names
View Full Code Here

         if (created != null)
            digest.update(created.getBytes("UTF-8"));
      }
      catch (UnsupportedEncodingException e)
      {
         throw new WSException(e);
      }
   }
View Full Code Here

   private void constructRPCParameters(ServiceEndpointMethodMapping semm, WSDLInterfaceOperation wiop, WSDLBindingOperation bindingOperation)
   {
      WSDLInterfaceOperationInput win = WSDLUtils.getWsdl11Input(wiop);
      if (win == null)
         throw new WSException("RPC endpoints require an input message");
      String wsdlMessageName = win.getMessageName().getLocalPart();
      JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());

      RPCSignature signature = new RPCSignature(wiop);
      int i = 0;
View Full Code Here

   }

   private boolean unwrapRequest(ServiceEndpointMethodMapping methodMapping, String messageName, String containingElement, XSTypeDefinition xt)
   {
      if (xt instanceof XSComplexTypeDefinition == false)
         throw new WSException("Tried to unwrap a non-complex type.");

      List<MethodParamPartsMapping> partsMappings = new ArrayList<MethodParamPartsMapping>();

      XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt;
View Full Code Here

TOP

Related Classes of org.jboss.ws.WSException

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.