org.ow2.petals.binding.soap.util
Class Marshaller

java.lang.Object
  extended by org.ow2.petals.binding.soap.util.Marshaller

public final class Marshaller
extends java.lang.Object

A marshaller to create JBI message from SOAP ones and vice versa.

Author:
Christophe HAMERLING (chamerling) - eBM WebSourcing

Method Summary
static void copyAttachments(javax.jbi.messaging.NormalizedMessage from, org.apache.axis2.context.MessageContext to)
          Add the normalized message attachments to the Axis message context.
static void copyAttachments(org.apache.axiom.om.OMElement from, javax.jbi.messaging.NormalizedMessage to)
          Create the JBI message from the OMElement object.
static org.apache.axiom.soap.SOAPBody createSOAPBody(org.apache.axiom.soap.SOAPFactory factory, org.apache.axiom.soap.SOAPEnvelope envelope, javax.xml.transform.Source source)
          Create a SOAPBody from a source
static org.apache.axiom.soap.SOAPBody createSOAPBodyWithFault(org.apache.axiom.soap.SOAPFactory factory, org.apache.axiom.soap.SOAPEnvelope envelope, javax.xml.transform.Source source)
          Create a SOAPBody from a source
static org.apache.axiom.soap.SOAPEnvelope createSOAPEnvelope(org.apache.axiom.soap.SOAPFactory factory, javax.jbi.messaging.NormalizedMessage nm, boolean isJBIFault)
          Creates a SOAP response from a NormalizedMessage
static javax.xml.transform.Source createSource(org.apache.axiom.soap.SOAPEnvelope envelope, boolean removeRootBodyElement)
          Create a the JBI payload from the SOAP body.
static void fillSOAPBodyWithAttachments(org.apache.axiom.soap.SOAPFactory soapFactory, org.apache.axis2.context.MessageContext messageContext)
           Handles attachments.
static void setAttachments(org.apache.axiom.attachments.Attachments attachments, javax.jbi.messaging.NormalizedMessage to)
          Put the SOAP attachments in the normalized message
static void setProperties(org.apache.axis2.context.MessageContext from, javax.jbi.messaging.NormalizedMessage to)
          Copy properties from a SOAP message to the normalized message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createSource

public static javax.xml.transform.Source createSource(org.apache.axiom.soap.SOAPEnvelope envelope,
                                                      boolean removeRootBodyElement)
                                               throws java.lang.Exception
Create a the JBI payload from the SOAP body. The SOAP envelope is required to get namespaces.

Parameters:
envelope -
removeRootBodyElement -
Returns:
Throws:
java.lang.Exception

setAttachments

public static void setAttachments(org.apache.axiom.attachments.Attachments attachments,
                                  javax.jbi.messaging.NormalizedMessage to)
Put the SOAP attachments in the normalized message

Parameters:
attachments -
to -

setProperties

public static void setProperties(org.apache.axis2.context.MessageContext from,
                                 javax.jbi.messaging.NormalizedMessage to)
                          throws java.lang.Exception
Copy properties from a SOAP message to the normalized message

Parameters:
from -
to - Normalized message
Throws:
java.lang.Exception

createSOAPBody

public static org.apache.axiom.soap.SOAPBody createSOAPBody(org.apache.axiom.soap.SOAPFactory factory,
                                                            org.apache.axiom.soap.SOAPEnvelope envelope,
                                                            javax.xml.transform.Source source)
                                                     throws org.apache.axis2.AxisFault
Create a SOAPBody from a source

Parameters:
factory -
envelope -
response -
Returns:
Throws:
org.apache.axis2.AxisFault

createSOAPBodyWithFault

public static org.apache.axiom.soap.SOAPBody createSOAPBodyWithFault(org.apache.axiom.soap.SOAPFactory factory,
                                                                     org.apache.axiom.soap.SOAPEnvelope envelope,
                                                                     javax.xml.transform.Source source)
                                                              throws org.apache.axis2.AxisFault
Create a SOAPBody from a source

Parameters:
factory -
envelope -
response -
Returns:
Throws:
org.apache.axis2.AxisFault

createSOAPEnvelope

public static org.apache.axiom.soap.SOAPEnvelope createSOAPEnvelope(org.apache.axiom.soap.SOAPFactory factory,
                                                                    javax.jbi.messaging.NormalizedMessage nm,
                                                                    boolean isJBIFault)
                                                             throws org.apache.axis2.AxisFault
Creates a SOAP response from a NormalizedMessage

Parameters:
factory - soap factory
nm - NormalizedMessage containing the response
Returns:
a SOAPEnveloppe created from the nm NomalizedMessage content
Throws:
org.apache.axis2.AxisFault

copyAttachments

public static void copyAttachments(javax.jbi.messaging.NormalizedMessage from,
                                   org.apache.axis2.context.MessageContext to)
Add the normalized message attachments to the Axis message context.

Parameters:
from -
to -
Throws:
org.apache.axis2.AxisFault

fillSOAPBodyWithAttachments

public static final void fillSOAPBodyWithAttachments(org.apache.axiom.soap.SOAPFactory soapFactory,
                                                     org.apache.axis2.context.MessageContext messageContext)

Handles attachments. Two cases can occurs:

In the first case, it is needed to replace the XML node that declares the attachement by the same using OMElement (it's needed by Axis API).

In the other case, each attachment is added, using MTOM/XOP, in the special node inside the SOAP Body: <soapbc:attachments xmlns:soapbc="http://petals.ow2.org/ns/soapbc">/<soapbc:attachment>

Parameters:
soapFactory -
messageContext -

copyAttachments

public static void copyAttachments(org.apache.axiom.om.OMElement from,
                                   javax.jbi.messaging.NormalizedMessage to)
Create the JBI message from the OMElement object.

Parameters:
from -
to -


Copyright © 2005-2010 OW2 Consortium. All Rights Reserved.