Package org.jboss.ws.core.soap

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


      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();

      ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelope.getBytes());

      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      msgContext.setSOAPMessage(resMessage);

      EndpointInvocation epInv = new EndpointInvocation(opMetaData);    
View Full Code Here


      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();

      ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithBoundHeader.getBytes());

      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      msgContext.setSOAPMessage(resMessage);

      // Add bound header
View Full Code Here

      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();

      ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithUnboundHeader.getBytes());

      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      msgContext.setSOAPMessage(resMessage);

      QName xmlName = new QName("http://somens", "OutHeader");
View Full Code Here

      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();

      ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithFault.getBytes());

      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null, inputStream);

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      msgContext.setSOAPMessage(resMessage);

      try
View Full Code Here

public class JBWS2964TestCase extends TestCase
{
   public void testSaveChanges() throws Exception
   {
       MessageFactoryImpl mf = new MessageFactoryImpl();
       SOAPMessageImpl soapMessage = (SOAPMessageImpl)mf.createMessage();
       MimeHeaders mimeHeaders = new MimeHeaders();
       mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE,MimeConstants.TYPE_MULTIPART_RELATED);
       soapMessage.setMimeHeaders(mimeHeaders);
      
       SOAPMessageImpl tmp = (SOAPMessageImpl)mf.createMessage();
       tmp.setMimeHeaders(soapMessage.getMimeHeaders());
       tmp.saveChanges();
      
       assertEquals(MimeConstants.TYPE_MULTIPART_RELATED, soapMessage.getMimeHeaders().getHeader(MimeConstants.CONTENT_TYPE)[0]);
   }
View Full Code Here

            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);
               }
View Full Code Here

            XOPContext.setMTOMEnabled(false);
         else
            XOPContext.setMTOMEnabled(isMTOMEnabled());

         // Associate current message with message context
         SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
         msgContext.setSOAPMessage(reqMessage);

         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;
View Full Code Here

         log.debug("unbindRequestMessage: " + opMetaData.getQName());

      try
      {
         // Read the SOAPEnvelope from the reqMessage
         SOAPMessageImpl reqMessage = (SOAPMessageImpl)payload;
         SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
         SOAPHeader soapHeader = soapEnvelope.getHeader();
         SOAPBody soapBody = soapEnvelope.getBody();

         // Verify the SOAP version
         verifySOAPVersion(opMetaData, soapEnvelope);
View Full Code Here

            XOPContext.setMTOMEnabled(false);
         else
            XOPContext.setMTOMEnabled(isMTOMEnabled());

         // Associate current message with message context
         SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
         msgContext.setSOAPMessage(resMessage);

         // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
         // Specifically, the HTTP response entity-body must be empty.
         if (opMetaData.isOneWay())
         {
            resMessage.getSOAPPart().setContent(null);
            return resMessage;
         }

         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)
            {
              String envURI = soapEnvelope.getNamespaceURI();
              String envPrefix = soapEnvelope.getPrefix();
              soapBodyElement.setAttributeNS(envURI, envPrefix + ":encodingStyle", Constants.URI_SOAP11_ENC);
            }
         }

         // Add the return to the message
         ParameterMetaData retMetaData = opMetaData.getReturnParameter();
         if (retMetaData != null)
         {
            Object value = epInv.getReturnValue();

            // TODO calls to ParameterWrapping should be elsewhere
            if (opMetaData.isDocumentWrapped())
               value = ParameterWrapping.wrapResponseParameters(retMetaData, value, epInv.getOutParameters());

            if (retMetaData.isSwA())
            {
               CIDGenerator cidGenerator = resMessage.getCidGenerator();
               AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
               resMessage.addAttachmentPart(part);
               epInv.setReturnValue(part);

               // Add the attachment to the standard property
               if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS)
               {
                  DataHandler dataHandler = part.getDataHandler();
                  Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
                  attachments.put(part.getContentId(), dataHandler);
               }
            }
            else
            {
               SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBodyElement);
               epInv.setReturnValue(soapElement);
               soapElement.setObjectValue(value);
            }
         }

         // Add the out parameters to the message
         for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
         {
            QName xmlName = paramMetaData.getXmlName();
            Object value = epInv.getResponseParamValue(xmlName);
            if (paramMetaData.isSwA())
            {
               CIDGenerator cidGenerator = resMessage.getCidGenerator();
               AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
               resMessage.addAttachmentPart(part);

               // Add the attachment to the standard property
               if (value instanceof DataHandler && msgContext instanceof MessageContextJAXWS)
               {
                  DataHandler dataHandler = (DataHandler)value;
View Full Code Here

         {
            return;
         }

         // WS-Addressing might redirect the response, which results in an empty envelope
         SOAPMessageImpl resMessage = (SOAPMessageImpl)payload;
         SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
         if (soapEnvelope == null)
         {
            return;
         }
View Full Code Here

TOP

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

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.