Package org.jboss.ws.core.soap

Examples of org.jboss.ws.core.soap.SOAPBodyImpl


         {
            Source source = (Source)obj;
            if (mode == Mode.PAYLOAD)
            {
               reqMsg = (SOAPMessageImpl)factory.createMessage();
               SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
               SOAPContentElement bodyElement = new SOAPBodyElementDoc(SOAPBodyElementDoc.GENERIC_PARAM_NAME);
               bodyElement = (SOAPContentElement)soapBody.addChildElement(bodyElement);
               XMLFragment xmlFragment = new XMLFragment(source);
               bodyElement.setXMLFragment(xmlFragment);

               // validate payload if necessary
               if (validateDispatch)
               {
                  // expand to DOM will validate the contents
                  xmlFragment.toElement();
               }

            }
            if (mode == Mode.MESSAGE)
            {
               TransformerFactory tf = TransformerFactory.newInstance();
               ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
               tf.newTransformer().transform(source, new StreamResult(baos));
               reqMsg = (SOAPMessageImpl)factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
            }
         }
         else if (jaxbContext != null)
         {
            Marshaller marshaller = jaxbContext.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
            ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
            marshaller.marshal(obj, baos);

            reqMsg = (SOAPMessageImpl)factory.createMessage();
            SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
            SOAPContentElement bodyElement = new SOAPBodyElementDoc(SOAPBodyElementDoc.GENERIC_PARAM_NAME);
            bodyElement = (SOAPContentElement)soapBody.addChildElement(bodyElement);
            StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
            bodyElement.setXMLFragment(new XMLFragment(source));
         }
      }
      catch (RuntimeException rte)
View Full Code Here


         }
         else if (Source.class.isAssignableFrom(type))
         {
            if (mode == Mode.PAYLOAD)
            {
               SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();

               SOAPFault soapFault = soapBody.getFault();
               if (soapFault != null)
                  throw new SOAPFaultException(soapFault);

               SOAPElement soapElement = soapBody.getBodyElement();
               retObj = new DOMSource(soapElement);
            }
            if (mode == Mode.MESSAGE)
            {
               SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
               String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
               retObj = new StreamSource(new StringReader(xmlMessage));
            }
         }
         else if (jaxbContext != null)
         {
            SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
            SOAPElement soapElement = soapBody.getBodyElement();

            log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            retObj = unmarshaller.unmarshal(soapElement);
         }
View Full Code Here

         throw new IllegalArgumentException("Not a SOAPMessageImpl: " + dataObject);

      try
      {
         SOAPMessage soapMessage = (SOAPMessage)dataObject;
         SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
         SOAPBodyElement payload = soapBody.getBodyElement();
         new BadgerFishDOMDocumentSerializer(output).serialize(payload);
      }
      catch (SOAPException ex)
      {
         IOException ioex = new IOException("Cannot serialize: " + dataObject);
View Full Code Here

         {
            SOAPMessage soapMessage = (SOAPMessage)resMessage;
            if (soapMessage.getAttachments().hasNext())
               throw new IllegalStateException("Attachments not supported with JSON");
           
            SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
            BadgerFishDOMDocumentSerializer serializer = new BadgerFishDOMDocumentSerializer(output);
            serializer.serialize(soapBody.getBodyElement());
         }
         else
         {
            resMessage.writeTo(output);
         }
View Full Code Here

         // Report a MustUnderstand fault
         if (opMetaData == null)
         {
            String faultString;

            SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
            SOAPBodyElement soapBodyElement = soapBody.getBodyElement();
            if (soapBodyElement != null)
            {
               Name soapName = soapBodyElement.getElementName();
               faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
            }
View Full Code Here

         throw new IllegalArgumentException("Not a SOAPMessageImpl: " + dataObject);

      try
      {
         SOAPMessage soapMessage = (SOAPMessage)dataObject;
         SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
         SOAPBodyElement payload = soapBody.getBodyElement();
         new BadgerFishDOMDocumentSerializer(output).serialize(payload);
      }
      catch (SOAPException ex)
      {
         IOException ioex = new IOException("Cannot serialize: " + dataObject);
View Full Code Here

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

         SOAPHeader soapHeader = soapEnvelope.getHeader();
         SOAPBodyImpl soapBody = (SOAPBodyImpl)soapEnvelope.getBody();
         SOAPBodyElement soapBodyElement = soapBody.getBodyElement();

         // Translate the SOAPFault to an exception and throw it
         if (soapBodyElement instanceof SOAPFaultImpl)
            throwFaultException((SOAPFaultImpl)soapBodyElement);
View Full Code Here

         // Report a MustUnderstand fault
         if (opMetaData == null)
         {
            String faultString;

            SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
            SOAPBodyElement soapBodyElement = soapBody.getBodyElement();
            if (soapBodyElement != null)
            {
               Name soapName = soapBodyElement.getElementName();
               faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
            }
View Full Code Here

/*     */       {
/*  90 */         Source source = (Source)obj;
/*  91 */         if (this.mode == Service.Mode.PAYLOAD)
/*     */         {
/*  93 */           reqMsg = (SOAPMessageImpl)factory.createMessage();
/*  94 */           SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
/*  95 */           SOAPContentElement bodyElement = new SOAPBodyElementDoc(SOAPBodyElementDoc.GENERIC_PARAM_NAME);
/*  96 */           bodyElement = (SOAPContentElement)soapBody.addChildElement(bodyElement);
/*  97 */           XMLFragment xmlFragment = new XMLFragment(source);
/*  98 */           bodyElement.setXMLFragment(xmlFragment);
/*     */
/* 101 */           if (this.validateDispatch)
/*     */           {
/* 104 */             xmlFragment.toElement();
/*     */           }
/*     */         }
/*     */
/* 108 */         if (this.mode == Service.Mode.MESSAGE)
/*     */         {
/* 110 */           TransformerFactory tf = TransformerFactory.newInstance();
/* 111 */           ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
/* 112 */           tf.newTransformer().transform(source, new StreamResult(baos));
/* 113 */           reqMsg = (SOAPMessageImpl)factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray()));
/*     */         }
/*     */       }
/* 116 */       else if (this.jaxbContext != null)
/*     */       {
/* 118 */         Marshaller marshaller = this.jaxbContext.createMarshaller();
/* 119 */         marshaller.setProperty("jaxb.fragment", Boolean.valueOf(true));
/* 120 */         ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
/* 121 */         marshaller.marshal(obj, baos);
/*     */
/* 123 */         reqMsg = (SOAPMessageImpl)factory.createMessage();
/* 124 */         SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
/* 125 */         SOAPContentElement bodyElement = new SOAPBodyElementDoc(SOAPBodyElementDoc.GENERIC_PARAM_NAME);
/* 126 */         bodyElement = (SOAPContentElement)soapBody.addChildElement(bodyElement);
/* 127 */         StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
/* 128 */         bodyElement.setXMLFragment(new XMLFragment(source));
/*     */       }
/*     */     }
/*     */     catch (RuntimeException rte)
View Full Code Here

/*     */       }
/* 157 */       else if (Source.class.isAssignableFrom(this.type))
/*     */       {
/* 159 */         if (this.mode == Service.Mode.PAYLOAD)
/*     */         {
/* 161 */           SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
/*     */
/* 163 */           SOAPFault soapFault = soapBody.getFault();
/* 164 */           if (soapFault != null) {
/* 165 */             throw new SOAPFaultException(soapFault);
/*     */           }
/* 167 */           SOAPElement soapElement = soapBody.getBodyElement();
/* 168 */           retObj = new DOMSource(soapElement);
/*     */         }
/* 170 */         if (this.mode == Service.Mode.MESSAGE)
/*     */         {
/* 172 */           SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
/* 173 */           String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
/* 174 */           retObj = new StreamSource(new StringReader(xmlMessage));
/*     */         }
/*     */       }
/* 177 */       else if (this.jaxbContext != null)
/*     */       {
/* 179 */         SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
/* 180 */         SOAPElement soapElement = soapBody.getBodyElement();
/*     */
/* 182 */         this.log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
/* 183 */         Unmarshaller unmarshaller = this.jaxbContext.createUnmarshaller();
/* 184 */         retObj = unmarshaller.unmarshal(soapElement);
/*     */       }
View Full Code Here

TOP

Related Classes of org.jboss.ws.core.soap.SOAPBodyImpl

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.