Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.NamespaceRegistry


/*     */     }
/*     */
/* 747 */     if (xmlName.getNamespaceURI().length() > 0)
/*     */     {
/* 749 */       CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
/* 750 */       NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
/* 751 */       xmlName = namespaceRegistry.registerQName(xmlName);
/*     */     }
/*     */
/* 754 */     Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());
/*     */     SOAPContentElement contentElement;
/* 757 */     if ((soapElement instanceof SOAPHeader))
View Full Code Here


/* 365 */       for (Field field : javaType.getFields())
/*     */       {
/* 367 */         if ((!Modifier.isStatic(field.getModifiers())) || (!field.getType().equals(javaType)))
/*     */           continue;
/* 369 */         Object ret = getValue.invoke(field.get(null), new Object[0]);
/* 370 */         String item = SimpleTypeBindings.marshal(enumType.getName(), ret, new NamespaceRegistry());
/* 371 */         simpleType.addLexicalEnumeration(item);
/*     */       }
/*     */
/*     */     }
/*     */     catch (Exception e)
View Full Code Here

/*     */   {
/* 221 */     assertFaultCode(faultEx.getFaultCode());
/*     */
/* 223 */     CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
/* 224 */     SerializationContext serContext = msgContext != null ? msgContext.getSerializationContext() : new SerializationContextJAXRPC();
/* 225 */     NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
/*     */
/* 227 */     MessageFactory factory = new MessageFactoryImpl();
/* 228 */     SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
/*     */
/* 230 */     SOAPEnvelopeImpl soapEnvelope = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
/* 231 */     SOAPBody soapBody = soapEnvelope.getBody();
/*     */
/* 233 */     QName faultCode = faultEx.getFaultCode();
/* 234 */     if (faultCode.getNamespaceURI().length() > 0) {
/* 235 */       faultCode = nsRegistry.registerQName(faultCode);
/*     */     }
/* 237 */     String faultString = getValidFaultString(faultEx);
/* 238 */     SOAPFault soapFault = soapBody.addFault(new NameImpl(faultCode), faultString);
/*     */
/* 240 */     String faultActor = faultEx.getFaultActor();
/* 241 */     if (faultActor != null)
/*     */     {
/* 243 */       SOAPElement soapElement = soapFault.addChildElement("faultactor");
/* 244 */       soapElement.addTextNode(faultActor);
/*     */     }
/*     */
/* 247 */     Exception faultCause = (Exception)faultEx.getCause();
/* 248 */     Detail detail = faultEx.getDetail();
/* 249 */     if (detail != null)
/*     */     {
/* 251 */       soapFault.addChildElement(detail);
/*     */     }
/* 253 */     else if ((faultCause != null) && (!(faultCause instanceof RuntimeException)))
/*     */     {
/* 255 */       Class javaType = faultCause.getClass();
/*     */
/* 257 */       TypeMapping typeMapping = serContext.getTypeMapping();
/*     */
/* 259 */       OperationMetaData opMetaData = msgContext.getOperationMetaData();
/* 260 */       if ((opMetaData != null) && (opMetaData.getFaultMetaData(javaType) != null))
/*     */       {
/* 262 */         FaultMetaData faultMetaData = opMetaData.getFaultMetaData(javaType);
/* 263 */         QName xmlName = faultMetaData.getXmlName();
/* 264 */         QName xmlType = faultMetaData.getXmlType();
/*     */
/* 266 */         xmlName = nsRegistry.registerQName(xmlName);
/*     */
/* 269 */         AbstractSerializerFactory serFactory = (AbstractSerializerFactory)typeMapping.getSerializer(javaType, xmlType);
/* 270 */         if (serFactory == null) {
/* 271 */           throw new JAXRPCException("Cannot obtain serializer factory for: " + xmlType);
/*     */         }
View Full Code Here

      super(localName);
   }

   public void setUp()
   {
      ctx = new NamespaceRegistry();
      for(int i = 0; i < prefix.length; ++i)
      {
         ctx.addPrefixMapping(prefix[i], uri[i]);
      }
   }
View Full Code Here

         throw new IllegalArgumentException("The element argument must not be null!");
      }
     
      ch.startDocument();

      process(e, ch, new NamespaceRegistry());

      ch.endDocument();
   }
View Full Code Here

         SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
         SOAPBody soapBody = soapEnvelope.getBody();
         SOAPHeader soapHeader = soapEnvelope.getHeader();

         // Get the namespace registry
         NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();

         Style style = opMetaData.getStyle();
         SOAPElement soapBodyElement = soapBody;
         if (style == Style.RPC)
         {
            boolean serialize = true;

            if (serialize)
            {
               QName opQName = opMetaData.getQName();
               Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));

               if (log.isDebugEnabled())
                  log.debug("Create RPC body element: " + opName);

               soapBodyElement = new SOAPBodyElementRpc(opName);
               soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);

               // Add soap encodingStyle
               if (opMetaData.getUse() == Use.ENCODED)
               {
                  String envURI = soapEnvelope.getNamespaceURI();
                  String envPrefix = soapEnvelope.getPrefix();
                  soapBodyElement.setAttributeNS(envURI, envPrefix + ":encodingStyle", Constants.URI_SOAP11_ENC);
               }
            }
         }

         for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
         {
            QName xmlName = paramMetaData.getXmlName();
            Object value = epInv.getRequestParamValue(xmlName);

            if (paramMetaData.isSwA())
            {
               // NOTE: swa:ref is handled by the AttachmentMarshaller callback
               CIDGenerator cidGenerator = reqMessage.getCidGenerator();
               AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
               reqMessage.addAttachmentPart(part);

               // Add the attachment to the standard property
               if (value instanceof DataHandler && msgContext instanceof MessageContextJAXWS)
               {
                  DataHandler dataHandler = (DataHandler)value;
                  Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
                  attachments.put(dataHandler.getContentType(), dataHandler);
               }
            }
            else
            {
               SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBodyElement;
               addParameterToMessage(paramMetaData, value, soapElement);
            }
         }

         // Add unbound headers
         if (unboundHeaders != null)
         {
            Iterator it = unboundHeaders.values().iterator();
            while (it.hasNext())
            {
               UnboundHeader unboundHeader = (UnboundHeader)it.next();
               if (unboundHeader.getMode() != ParameterMode.OUT)
               {
                  QName xmlName = unboundHeader.getXmlName();
                  Object value = unboundHeader.getHeaderValue();

                  xmlName = namespaceRegistry.registerQName(xmlName);
                  Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());

                  log.debug("Add unboundHeader element: " + soapName);
                  SOAPContentElement contentElement = new SOAPHeaderElementImpl(soapName);
                  contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
View Full Code Here

         // Disable MTOM for rpc/encoded
         if (opMetaData.isRPCEncoded())
            msgContext.put(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);

         // Get the namespace registry
         NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();

         if (opMetaData.isMessageEndpoint() == false)
         {
            Style style = opMetaData.getStyle();
            SOAPElement payloadParent = soapBody;
            if (style == Style.RPC)
            {
               payloadParent = null;
               Iterator it = soapBody.getChildElements();
               while (payloadParent == null && it.hasNext())
               {
                  Object childNode = it.next();
                  if (childNode instanceof SOAPElement)
                  {
                     payloadParent = (SOAPElement)childNode;
                  }
               }

               if (payloadParent == null)
                 throw new SOAPException("Cannot find RPC element in");

               QName elName = payloadParent.getElementQName();
               elName = namespaceRegistry.registerQName(elName);
            }

            int numParameters = 0;
            for (ParameterMetaData paramMetaData : opMetaData.getParameters())
            {
View Full Code Here

         SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
         SOAPHeader soapHeader = soapEnvelope.getHeader();
         SOAPBody soapBody = soapEnvelope.getBody();

         // Get the namespace registry
         NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();

         Style style = opMetaData.getStyle();
         SOAPElement soapBodyElement = soapBody;
         if (style == Style.RPC)
         {
            QName opQName = opMetaData.getResponseName();

            Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
            soapBodyElement = new SOAPBodyElementRpc(opName);
            soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);

            // Add soap encodingStyle
            if (opMetaData.getUse() == Use.ENCODED)
View Full Code Here

      // Make sure we have a prefix on qualified names
      if (xmlName.getNamespaceURI().length() > 0)
      {
         CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
         NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
         xmlName = namespaceRegistry.registerQName(xmlName);
      }

      Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());

      SOAPContentElement contentElement;
View Full Code Here

            nsimap.put(sns, ni);
            ni.setNamespaceRegistry(namespaceRegistry);
         }
      }

      NamespaceRegistry xsmRegistry = xsm.getNamespaceRegistry();
      Iterator iter = xsmRegistry.getRegisteredPrefixes();
      while (iter.hasNext())
      {
         String prefix = (String)iter.next();
         String ns = xsmRegistry.getNamespaceURI(prefix);
         this.namespaceRegistry.registerURI(ns, prefix);
      }

      anonymousMapper.rebuild();
   }
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.NamespaceRegistry

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.