You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by in...@apache.org on 2007/02/27 11:43:59 UTC

svn commit: r512217 - in /webservices/synapse/trunk/java/modules/core/src: main/java/org/apache/synapse/config/ main/java/org/apache/synapse/config/xml/ main/java/org/apache/synapse/core/axis2/ test/java/org/apache/synapse/config/xml/

Author: indika
Date: Tue Feb 27 02:43:57 2007
New Revision: 512217

URL: http://svn.apache.org/viewvc?view=rev&rev=512217
Log:
Change  the proxy service  factory and serializer to reflect new proxy service syntax
fixed a bug in a proxy service
add function to sequence mediator factory to create Anonymous sequence 

Added:
    webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java
Modified:
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/Util.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorSerializer.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/Util.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/Util.java?view=diff&rev=512217&r1=512216&r2=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/Util.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/Util.java Tue Feb 27 02:43:57 2007
@@ -36,6 +36,7 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.URI;
 
 public class Util {
 
@@ -60,7 +61,7 @@
             } catch (XMLStreamException e) {
                 handleException("Error converting to a StreamSource", e);
             }
-            
+
         } else {
             handleException("Cannot convert object to a StreamSource");
         }
@@ -82,7 +83,14 @@
                 handleException("Error converting to a StreamSource", e);
             }
 
-        } else {
+        } else if (o instanceof URI){
+            try {
+                return ((URI)(o)).toURL().openStream();                   
+            } catch (IOException e) {
+                handleException("Error opening stream form URI",e);
+            }
+        }
+        else {
             handleException("Cannot convert object to a StreamSource");
         }
         return null;

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java?view=diff&rev=512217&r1=512216&r2=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java Tue Feb 27 02:43:57 2007
@@ -25,23 +25,26 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.core.axis2.ProxyService;
+import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import java.util.Iterator;
 import java.util.StringTokenizer;
 import java.util.ArrayList;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 /**
  * Creates a ProxyService instance using the XML fragment specification
- *
+ * <p/>
  * <proxy name="string" [description="string"] [transports="(http|https|jms)+|all"]>
- *   <target sequence="name" | endpoint="name"/>?   // default is main sequence
- *   <wsdl key="string">?
- *   <schema key="string">*
- *   <policy key="string">*
- *   <property name="string" value="string"/>*
- *   <enableRM/>+
- *   <enableSec/>+
+ * <target sequence="name" | endpoint="name"/>?   // default is main sequence
+ * <wsdl key="string">?
+ * <schema key="string">*
+ * <policy key="string">*
+ * <property name="string" value="string"/>*
+ * <enableRM/>+
+ * <enableSec/>+
  * </proxy>
  */
 public class ProxyServiceFactory {
@@ -60,7 +63,7 @@
         }
 
         OMAttribute statistics = elem.getAttribute(
-                    new QName(Constants.NULL_NAMESPACE, Constants.STATISTICS_ATTRIB_NAME));
+                new QName(Constants.NULL_NAMESPACE, Constants.STATISTICS_ATTRIB_NAME));
         if (statistics != null) {
             String statisticsValue = statistics.getAttributeValue();
             if (statisticsValue != null) {
@@ -76,13 +79,13 @@
         if (trans != null) {
             String transports = trans.getAttributeValue();
             if (transports == null || ProxyService.ALL_TRANSPORTS.equals(transports)) {
-                        // default to all transports using service name as destination
+                // default to all transports using service name as destination
             } else {
                 StringTokenizer st = new StringTokenizer(transports, " ,");
                 ArrayList transportList = new ArrayList();
-                while(st.hasMoreTokens()) {
+                while (st.hasMoreTokens()) {
                     String token = st.nextToken();
-                    if(token.length() != 0) {
+                    if (token.length() != 0) {
                         transportList.add(token);
                     }
                 }
@@ -102,43 +105,91 @@
         }
         OMAttribute startOnLoad = elem.getAttribute(
                 new QName(Constants.NULL_NAMESPACE, "startOnLoad"));
-        if(startOnLoad != null) {
+        if (startOnLoad != null) {
             proxy.setStartOnLoad(Boolean.valueOf(startOnLoad.getAttributeValue()).booleanValue());
         } else {
             proxy.setStartOnLoad(true);
         }
 
+        // setting the description of the proxy service
+        OMElement descriptionElement = elem.getFirstChildWithName(
+                new QName(Constants.SYNAPSE_NAMESPACE, "description"));
+        if (descriptionElement != null) {
+            proxy.setDescription(descriptionElement.getText().trim());
+        }
+
         // read definition of the target of this proxy service. The target could be an 'endpoint'
         // or a named sequence. If none of these are specified, the messages would be mediated
         // by the Synapse main mediator
-        OMElement target  = elem.getFirstChildWithName(
+        OMElement target = elem.getFirstChildWithName(
                 new QName(Constants.SYNAPSE_NAMESPACE, "target"));
         if (target != null) {
-            OMAttribute inSequence = target.getAttribute(
-                    new QName(Constants.NULL_NAMESPACE, "inSequence"));
+            SequenceMediatorFactory mediatorFactory = new SequenceMediatorFactory();
+            OMAttribute inSequence = target.getAttribute(new QName(Constants.NULL_NAMESPACE, "inSequence"));
             if (inSequence != null) {
                 proxy.setTargetInSequence(inSequence.getAttributeValue());
+            } else {
+                OMElement inSequenceElement = target.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "inSequence"));
+                if (inSequenceElement != null) {
+                    proxy.setTargetInLineInSequence(mediatorFactory.createAnonymousSequence(inSequenceElement));
+                }
             }
-            OMAttribute outSequence = target.getAttribute(
-                    new QName(Constants.NULL_NAMESPACE, "outSequence"));
+            OMAttribute outSequence = target.getAttribute(new QName(Constants.NULL_NAMESPACE, "outSequence"));
             if (outSequence != null) {
                 proxy.setTargetOutSequence(outSequence.getAttributeValue());
+            } else {
+                OMElement outSequenceElement = target.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "outSequence"));
+                if (outSequenceElement != null) {
+                    proxy.setTargetInLineOutSequence(mediatorFactory.createAnonymousSequence(outSequenceElement));
+                }
             }
-            OMAttribute tgtEndpt = target.getAttribute(
-                    new QName(Constants.NULL_NAMESPACE, "endpoint"));
+            OMAttribute faultSequence = target.getAttribute(new QName(Constants.NULL_NAMESPACE, "faultSequence"));
+            if (faultSequence != null) {
+                proxy.setTargetFaultSequence(faultSequence.getAttributeValue());
+            } else {
+                OMElement faultSequenceElement = target.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "faultSequence"));
+                if (faultSequenceElement != null) {
+                    proxy.setTargetInLineOutSequence(mediatorFactory.createAnonymousSequence(faultSequenceElement));
+                }
+            }
+            OMAttribute tgtEndpt = target.getAttribute(new QName(Constants.NULL_NAMESPACE, "endpoint"));
             if (tgtEndpt != null) {
                 proxy.setTargetEndpoint(tgtEndpt.getAttributeValue());
+            } else {
+                OMElement endpointElement = target.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "endpoint"));
+                if (endpointElement != null) {
+                    proxy.setTargetInLineEndpoint(EndpointFactory.createEndpoint(endpointElement, true));
+                }
             }
         }
 
         // read the WSDL, Schemas and Policies and set to the proxy service
-        OMElement wsdl = elem.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "wsdl"));
+        OMElement wsdl = elem.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "publish-wsdl"));
         if (wsdl != null) {
             OMAttribute wsdlkey = wsdl.getAttribute(new QName(Constants.NULL_NAMESPACE, "key"));
-            if (wsdlkey == null) {
-                handleException("The 'key' attribute is required for the base WSDL definition");
-            } else {
+            if (wsdlkey != null) {
                 proxy.setWSDLKey(wsdlkey.getAttributeValue());
+            } else {
+                OMAttribute wsdlURI = wsdl.getAttribute(new QName(Constants.NULL_NAMESPACE, "uri"));
+                if (wsdlURI != null) {
+                    try {
+                        proxy.setWsdlURI(new URI(wsdlURI.getAttributeValue()));
+                    } catch (URISyntaxException e) {
+                        String msg = "Error creating uri for proxy service wsdl";
+                        log.error(msg);
+                        handleException(msg, e);
+                    }
+                } else {
+                    OMElement wsdl11 = wsdl.getFirstChildWithName(new QName(WSDLConstants.WSDL1_1_NAMESPACE, "definitions"));
+                    if (wsdl11 != null) {
+                        proxy.setInLineWSDL(wsdl11);
+                    } else {
+                        OMElement wsdl20 = wsdl.getFirstChildWithName(new QName(WSDLConstants.WSDL2_0_NAMESPACE, "descriptions"));
+                        if (wsdl20 != null) {
+                            proxy.setInLineWSDL(wsdl20);
+                        }
+                    }
+                }
             }
         }
 
@@ -162,15 +213,19 @@
         }
 
         Iterator props = elem.getChildrenWithName(
-                new QName(Constants.SYNAPSE_NAMESPACE, "property"));
+                new QName(Constants.SYNAPSE_NAMESPACE, "parameter"));
         while (props.hasNext()) {
             Object o = props.next();
             if (o instanceof OMElement) {
                 OMElement prop = (OMElement) o;
                 OMAttribute pname = prop.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
-                OMAttribute value = prop.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
-                if (pname != null && value != null) {
-                    proxy.addProperty(pname.getAttributeValue(), value.getAttributeValue());
+                OMElement propertyValue = prop.getFirstElement();
+                if (pname != null) {
+                    if (propertyValue != null) {
+                        proxy.addProperty(pname.getAttributeValue(), propertyValue);
+                    } else {
+                        proxy.addProperty(pname.getAttributeValue(), prop.getText().trim());
+                    }
                 } else {
                     handleException("Invalid property specified for proxy service : " + name);
                 }
@@ -179,15 +234,15 @@
             }
         }
 
-        if (elem.getFirstChildWithName(
-                new QName(Constants.SYNAPSE_NAMESPACE, "enableRM")) != null) {
-            proxy.setWsRMEnabled(true);
-        }
-
-        if (elem.getFirstChildWithName(
-                new QName(Constants.SYNAPSE_NAMESPACE, "enableSec")) != null) {
-            proxy.setWsSecEnabled(true);
-        }
+//        if (elem.getFirstChildWithName(
+//                new QName(Constants.SYNAPSE_NAMESPACE, "enableRM")) != null) {
+//            proxy.setWsRMEnabled(true);
+//        }
+//
+//        if (elem.getFirstChildWithName(
+//                new QName(Constants.SYNAPSE_NAMESPACE, "enableSec")) != null) {
+//            proxy.setWsSecEnabled(true);
+//        }
 
         return proxy;
     }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java?view=diff&rev=512217&r1=512216&r2=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java Tue Feb 27 02:43:57 2007
@@ -19,27 +19,27 @@
 
 package org.apache.synapse.config.xml;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.*;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.synapse.config.Endpoint;
 import org.apache.synapse.core.axis2.ProxyService;
 
 import java.util.Iterator;
 import java.util.ArrayList;
+import java.net.URI;
 
 /**
  * <proxy name="string" [description="string"] [transports="(http|https|jms)+|all"]>
- *   <target sequence="name" | endpoint="name"/>?   // default is main sequence
- *   <wsdl key="string">?
- *   <schema key="string">*
- *   <policy key="string">*
- *   <property name="string" value="string"/>*
- *   <enableRM/>+
- *   <enableSec/>+
+ * <target sequence="name" | endpoint="name"/>?   // default is main sequence
+ * <wsdl key="string">?
+ * <schema key="string">*
+ * <policy key="string">*
+ * <property name="string" value="string"/>*
+ * <enableRM/>+
+ * <enableSec/>+
  * </proxy>
  */
 public class ProxyServiceSerializer {
@@ -55,28 +55,20 @@
         OMElement proxy = fac.createOMElement("proxy", synNS);
         if (service.getName() != null) {
             proxy.addAttribute(fac.createOMAttribute(
-                "name", nullNS, service.getName()));
+                    "name", nullNS, service.getName()));
         } else {
             handleException("Invalid proxy service. Service name is required");
         }
-
-        if (service.getDescription() != null) {
-            proxy.addAttribute(fac.createOMAttribute(
-                "description", nullNS, service.getDescription()));
-        }
-
-        String wsdlKey = service.getWSDLKey();
-        if(wsdlKey != null) {
-            OMElement wsdl = fac.createOMElement("wsdl", synNS);
-            wsdl.addAttribute(fac.createOMAttribute(
-                "key", nullNS, wsdlKey));
-            proxy.addChild(wsdl);
+        String descriptionStr = service.getDescription();
+        if (descriptionStr != null) {
+            OMElement description = fac.createOMElement("description", synNS);
+            description.addChild(fac.createOMText(descriptionStr));
+            proxy.addChild(description);
         }
-
-        if (service.getTransports() != null && service.getTransports().size() != 0) {
-            ArrayList transports = service.getTransports();
+        ArrayList transports = service.getTransports();
+        if (transports != null && !transports.isEmpty()) {
             String transportStr = "" + transports.get(0);
-            for(int i = 1; i < transports.size(); i++) {
+            for (int i = 1; i < transports.size(); i++) {
                 transportStr = transportStr + " " + transports.get(i);
             }
             proxy.addAttribute(fac.createOMAttribute("transports", nullNS, transportStr));
@@ -84,26 +76,81 @@
 
         if (service.isStartOnLoad()) {
             proxy.addAttribute(fac.createOMAttribute(
-                "startOnLoad", nullNS, "true"));
+                    "startOnLoad", nullNS, "true"));
         } else {
             proxy.addAttribute(fac.createOMAttribute(
-                "startOnLoad", nullNS, "false"));
+                    "startOnLoad", nullNS, "false"));
         }
+        String endpoint = service.getTargetEndpoint();
 
-        if (service.getTargetEndpoint() != null) {
-            OMElement target = fac.createOMElement("target", synNS);
+        OMElement target = fac.createOMElement("target", synNS);
+        Endpoint inLineEndpoint = service.getTargetInLineEndpoint();
+        if (endpoint != null) {
             target.addAttribute(fac.createOMAttribute(
-                "endpoint", nullNS, service.getTargetEndpoint()));
+                    "endpoint", nullNS, endpoint));
+            proxy.addChild(target);
+        } else if (inLineEndpoint != null) {
+            EndpointSerializer.serializeEndpoint(inLineEndpoint, target);
             proxy.addChild(target);
-        } else if (service.getTargetInSequence() != null || service.getTargetOutSequence() != null) {
-            OMElement target = fac.createOMElement("target", synNS);
-            if (service.getTargetInSequence() != null) {
-                target.addAttribute(fac.createOMAttribute("inSequence", nullNS, service.getTargetInSequence()));
+        } else {
+            String inSeq = service.getTargetInSequence();
+            String outSeq = service.getTargetOutSequence();
+            String faultSeq = service.getTargetFaultSequence();
+            SequenceMediatorSerializer serializer = new SequenceMediatorSerializer();
+            if (inSeq != null) {
+                target.addAttribute(fac.createOMAttribute("inSequence", nullNS, inSeq));
+                proxy.addChild(target);
+            } else {
+                SequenceMediator inLineInSeq = service.getTargetInLineInSequence();
+                if (inLineInSeq != null) {
+                    OMElement inSeqElement = serializer.serializeAnonymousSequence(null, inLineInSeq);
+                    inSeqElement.setLocalName("inSequence");
+                    target.addChild(inSeqElement);
+                    proxy.addChild(target);
+                }
             }
-            if (service.getTargetOutSequence() != null) {
-                target.addAttribute(fac.createOMAttribute("outSequence", nullNS, service.getTargetOutSequence()));
+            if (outSeq != null) {
+                target.addAttribute(fac.createOMAttribute("outSequence", nullNS, outSeq));
+                proxy.addChild(target);
+            } else {
+                SequenceMediator inLineOutSeq = service.getTargetInLineOutSequence();
+                if (inLineOutSeq != null) {
+                    OMElement outSeqElement = serializer.serializeAnonymousSequence(null, inLineOutSeq);
+                    outSeqElement.setLocalName("outSequence");
+                    target.addChild(outSeqElement);
+                    proxy.addChild(target);
+                }
             }
-            proxy.addChild(target);
+            if (faultSeq != null) {
+                target.addAttribute(fac.createOMAttribute("faultSequence", nullNS, faultSeq));
+                proxy.addChild(target);
+            } else {
+                SequenceMediator inLineFaultSeq = service.getTargetInLineFaultSequence();
+                if (inLineFaultSeq != null) {
+                    OMElement faultSeqElement = serializer.serializeAnonymousSequence(null, inLineFaultSeq);
+                    faultSeqElement.setLocalName("faultSequence");
+                    target.addChild(faultSeqElement);
+                    proxy.addChild(target);
+                }
+            }
+
+        }
+
+        String wsdlKey = service.getWSDLKey();
+        URI wsdlUri = service.getWsdlURI();
+        Object inLineWSDL = service.getInLineWSDL();
+        OMElement wsdl = fac.createOMElement("publish-wsdl", synNS);
+        if (wsdlKey != null) {
+            wsdl.addAttribute(fac.createOMAttribute(
+                    "key", nullNS, wsdlKey));
+            proxy.addChild(wsdl);
+        } else if (inLineWSDL != null) {
+            wsdl.addChild((OMNode) inLineWSDL);
+            proxy.addChild(wsdl);
+        } else if (wsdlUri != null) {
+            wsdl.addAttribute(fac.createOMAttribute(
+                    "uri", nullNS, wsdlUri.toString()));
+            proxy.addChild(wsdl);
         }
 
         // TODO still schemas are not used
@@ -115,27 +162,34 @@
             String policyKey = (String) iter.next();
             OMElement policy = fac.createOMElement("policy", synNS);
             policy.addAttribute(fac.createOMAttribute(
-                "key", nullNS, policyKey));
+                    "key", nullNS, policyKey));
             proxy.addChild(policy);
         }
 
         iter = service.getPropertyMap().keySet().iterator();
         while (iter.hasNext()) {
             String propertyName = (String) iter.next();
-            OMElement property = fac.createOMElement("property", synNS);
-            property.addAttribute(fac.createOMAttribute(
-                "name", nullNS, propertyName));
+            OMElement property = fac.createOMElement("parameter", synNS);
             property.addAttribute(fac.createOMAttribute(
-                "value", nullNS, (String) service.getPropertyMap().get(propertyName)));
-            proxy.addChild(property);
+                    "name", nullNS, propertyName));
+            Object value = service.getPropertyMap().get(propertyName);
+            if (value != null) {
+                if (value instanceof String) {
+                    property.setText(((String) value).trim());
+                    proxy.addChild(property);
+                } else if (value instanceof OMNode) {
+                    property.addChild((OMNode) value);
+                    proxy.addChild(property);
+                }
+            }
         }
 
-        if (service.isWsRMEnabled()) {
-            proxy.addChild(fac.createOMElement("enableRM", synNS));
-        }
-        if (service.isWsSecEnabled()) {
-            proxy.addChild(fac.createOMElement("enableSec", synNS));
-        }
+//        if (service.isWsRMEnabled()) {
+//            proxy.addChild(fac.createOMElement("enableRM", synNS));
+//        }
+//        if (service.isWsSecEnabled()) {
+//            proxy.addChild(fac.createOMElement("enableSec", synNS));
+//        }
 
         int isEnableStatistics = service.getStatisticsEnable();
         String statisticsValue = null;

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorFactory.java?view=diff&rev=512217&r1=512216&r2=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorFactory.java Tue Feb 27 02:43:57 2007
@@ -54,6 +54,28 @@
         return SEQUENCE_Q;
     }
 
+    public SequenceMediator createAnonymousSequence(OMElement elem) {
+        SequenceMediator seqMediator = new SequenceMediator();
+        OMAttribute e = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "onError"));
+        if (e != null) {
+            seqMediator.setErrorHandler(e.getAttributeValue());
+        }
+        initMediator(seqMediator, elem);
+        super.addChildren(elem, seqMediator);
+        OMAttribute statistics = elem.getAttribute(
+                new QName(Constants.NULL_NAMESPACE, Constants.STATISTICS_ATTRIB_NAME));
+        if (statistics != null) {
+            String statisticsValue = statistics.getAttributeValue();
+            if (statisticsValue != null) {
+                if (Constants.STATISTICS_ENABLE.equals(statisticsValue)) {
+                    seqMediator.setStatisticsEnable(org.apache.synapse.Constants.STATISTICS_ON);
+                } else if (Constants.STATISTICS_DISABLE.equals(statisticsValue)) {
+                    seqMediator.setStatisticsEnable(org.apache.synapse.Constants.STATISTICS_OFF);
+                }
+            }
+        }
+        return seqMediator;
+    }
     public Mediator createMediator(OMElement elem) {
 
         SequenceMediator seqMediator = new SequenceMediator();

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorSerializer.java?view=diff&rev=512217&r1=512216&r2=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SequenceMediatorSerializer.java Tue Feb 27 02:43:57 2007
@@ -32,18 +32,42 @@
  *   mediator+
  * &lt;/sequence&gt;
  * </pre>
- *
+ * <p/>
  * OR
- *
+ * <p/>
  * <pre>
  * &lt;sequence ref="name"/&gt;
  * </pre>
  */
-public class SequenceMediatorSerializer extends AbstractListMediatorSerializer
-     {
+public class SequenceMediatorSerializer extends AbstractListMediatorSerializer {
 
     private static final Log log = LogFactory.getLog(SequenceMediatorSerializer.class);
 
+    public OMElement serializeAnonymousSequence(OMElement parent, SequenceMediator mediator) {
+        OMElement sequence = fac.createOMElement("sequence", synNS);
+        int isEnableStatistics = mediator.getStatisticsEnable();
+        String statisticsValue = null;
+        if (isEnableStatistics == org.apache.synapse.Constants.STATISTICS_ON) {
+            statisticsValue = Constants.STATISTICS_ENABLE;
+        } else if (isEnableStatistics == org.apache.synapse.Constants.STATISTICS_OFF) {
+            statisticsValue = Constants.STATISTICS_DISABLE;
+        }
+        if (statisticsValue != null) {
+            sequence.addAttribute(fac.createOMAttribute(
+                    Constants.STATISTICS_ATTRIB_NAME, nullNS, statisticsValue));
+        }
+        if (mediator.getErrorHandler() != null) {
+            sequence.addAttribute(fac.createOMAttribute(
+                    "onError", nullNS, mediator.getErrorHandler()));
+        }
+        finalizeSerialization(sequence, mediator);
+        super.serializeChildren(sequence, mediator.getList());
+        if (parent != null) {
+            parent.addChild(sequence);
+        }
+        return sequence;
+    }
+
     public OMElement serializeMediator(OMElement parent, Mediator m) {
 
         if (!(m instanceof SequenceMediator)) {
@@ -57,12 +81,12 @@
         // except make sure that we refer back to the registry key used when we loaded ourself
         if (mediator.isDynamic()) {
             sequence.addAttribute(fac.createOMAttribute(
-                "name", nullNS, mediator.getName()));
+                    "name", nullNS, mediator.getName()));
             sequence.addAttribute(fac.createOMAttribute(
-                "key", nullNS, mediator.getRegistryKey()));            
-            
+                    "key", nullNS, mediator.getRegistryKey()));
+
         } else {
-            
+
             int isEnableStatistics = mediator.getStatisticsEnable();
             String statisticsValue = null;
             if (isEnableStatistics == org.apache.synapse.Constants.STATISTICS_ON) {
@@ -77,16 +101,16 @@
 
             if (mediator.getRef() != null) {
                 sequence.addAttribute(fac.createOMAttribute(
-                    "ref", nullNS, mediator.getRef()));
+                        "ref", nullNS, mediator.getRef()));
             } else if (mediator.getName() != null) {
                 sequence.addAttribute(fac.createOMAttribute(
-                    "name", nullNS, mediator.getName()));
+                        "name", nullNS, mediator.getName()));
 
                 if (mediator.getErrorHandler() != null) {
                     sequence.addAttribute(fac.createOMAttribute(
-                        "onError", nullNS, mediator.getErrorHandler()));
+                            "onError", nullNS, mediator.getErrorHandler()));
                 }
-                finalizeSerialization(sequence,mediator);
+                finalizeSerialization(sequence, mediator);
                 super.serializeChildren(sequence, mediator.getList());
             }
         }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?view=diff&rev=512217&r1=512216&r2=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java Tue Feb 27 02:43:57 2007
@@ -20,6 +20,7 @@
 package org.apache.synapse.core.axis2;
 
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.description.*;
@@ -31,127 +32,232 @@
 import org.apache.neethi.PolicyEngine;
 import org.apache.synapse.Constants;
 import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.base.SequenceMediator;
 import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.config.Util;
+import org.apache.synapse.config.Endpoint;
+import org.apache.synapse.config.XMLToObjectMapper;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
 import java.util.*;
+import java.net.URI;
+import java.net.URLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
 
 /**
  * <proxy name="string" [description="string"] [transports="(http|https|jms)+|all"]>
- *   <target sequence="name" | endpoint="name"/>?   // default is main sequence
- *   <wsdl key="string">?
- *   <schema key="string">*
- *   <policy key="string">*
- *   <property name="string" value="string"/>*
- *   <enableRM/>+
- *   <enableSec/>+
+ * <target sequence="name" | endpoint="name"/>?   // default is main sequence
+ * <wsdl key="string">?
+ * <schema key="string">*
+ * <policy key="string">*
+ * <property name="string" value="string"/>*
+ * <enableRM/>+
+ * <enableSec/>+
  * </proxy>
  */
 public class ProxyService {
 
     private static final Log log = LogFactory.getLog(ProxyService.class);
     private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
-    /** The proxy service name */
+    /**
+     * The proxy service name
+     */
     private String name;
-    /** The proxy service description */
+    /**
+     * The proxy service description
+     */
     private String description;
-    /** The transport/s over which this service should be exposed */
+    /**
+     * The transport/s over which this service should be exposed
+     */
     //private String transports;
     private ArrayList transports;
-    /** The target endpoint, if assigned */
+    /**
+     * The target endpoint, if assigned
+     */
     private String targetEndpoint = null;
-    /** The target inSequence, if assigned */
+    /**
+     * The target inSequence, if assigned
+     */
     private String targetInSequence = null;
-    /** The target outSequence, if assigned */
+    /**
+     * The target outSequence, if assigned
+     */
     private String targetOutSequence = null;
+    /**
+     * The target faultSequence, if assigned
+     */
+    private String targetFaultSequence = null;
+    /**
+     * The target endpoint, if assigned
+     */
+    private Endpoint targetInLineEndpoint = null;
+    /**
+     * The target inSequence, if assigned
+     */
+    private SequenceMediator targetInLineInSequence = null;
+    /**
+     * The target outSequence, if assigned
+     */
+    private SequenceMediator targetInLineOutSequence = null;
+    /**
+     * The target faultSequence, if assigned
+     */
+    private SequenceMediator targetInLineFaultSequence = null;
     // if a target endpoint or sequence is not specified,
     // the default Synapse main mediator will be used
-    /** A list properties */
+    /**
+     * A list properties
+     */
     private Map properties = new HashMap();
 
-    /** The key for the base WSDL, if specified */
+    /**
+     * The key for the base WSDL, if specified
+     */
     private String wsdlKey;
-    /** The keys for any supplied schemas */
+    /**
+     * The URI for the base WSDL, if specified
+     */
+    private URI wsdlURI;
+    /**
+     * Inline XML representation of wsdl
+     */
+    private Object inLineWSDL;
+    /**
+     * The keys for any supplied schemas
+     */
     private List schemaKeys = new ArrayList();
-    /** The keys for any supplied policies that would apply at the service level */
+    /**
+     * The keys for any supplied policies that would apply at the service level
+     */
     private List serviceLevelPolicies = new ArrayList();
-    /** Should WS RM (default configuration) be engaged on this service */
+    /**
+     * Should WS RM (default configuration) be engaged on this service
+     */
     private boolean wsRMEnabled = false;
-    /** Should WS Sec (default configuration) be engaged on this service */
+    /**
+     * Should WS Sec (default configuration) be engaged on this service
+     */
     private boolean wsSecEnabled = false;
-    /** This will say weather need to start the service at the load or not */
+    /**
+     * This will say weather need to start the service at the load or not
+     */
     private boolean startOnLoad = true;
-    /** This will hold the status of the proxy weather it is running or not */
+    /**
+     * This will hold the status of the proxy weather it is running or not
+     */
     private boolean running = false;
 
     public static final String ALL_TRANSPORTS = "all";
 
-    /**  To decide to whether statistics should have collected or not */
+    /**
+     * To decide to whether statistics should have collected or not
+     */
     private int statisticsEnable = Constants.STATISTICS_UNSET;
-
-
-    /** The variable that indicate tracing on or off for the current mediator */
+    /**
+     * The variable that indicate tracing on or off for the current mediator
+     */
     protected int traceState = Constants.TRACING_UNSET;
 
-    public ProxyService() {}
+    public ProxyService() {
+    }
 
     public AxisService buildAxisService(SynapseConfiguration synCfg, AxisConfiguration axisCfg) {
 
         AxisService proxyService = null;
+        InputStream wsdlInputStream = null;
+        OMElement wsdlElement = null;
         if (wsdlKey != null) {
+            Object keyObject = synCfg.getProperty(wsdlKey);
+            if (keyObject instanceof OMElement) {
+                wsdlElement = (OMElement) keyObject;
+            }
+        } else if (inLineWSDL != null) {
+            wsdlElement = (OMElement) inLineWSDL;
+        } else if (wsdlURI != null) {
             try {
-                InputStream wsdlInputStream = Util.getInputStream(synCfg.getProperty(wsdlKey));
-                // detect version of the WSDL 1.1 or 2.0
-                OMNamespace documentElementNS = new StAXOMBuilder(
-                        wsdlInputStream).getDocumentElement().getNamespace();
-
-                wsdlInputStream = Util.getInputStream(synCfg.getProperty(wsdlKey));
-
-                if (documentElementNS != null) {
-                    WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
-                    if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.
-                        equals(documentElementNS.getNamespaceURI())) {
-                        wsdlToAxisServiceBuilder =
-                            new WSDL20ToAxisServiceBuilder(wsdlInputStream, null, null);
-
-                    } else if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.
-                        equals(documentElementNS.getNamespaceURI())) {
-                        wsdlToAxisServiceBuilder =
-                            new WSDL11ToAxisServiceBuilder(wsdlInputStream, null, null);
-                    } else {
-                        handleException("Unknown WSDL format.. not WSDL 1.1 or WSDL 2.0");
+                URL url = wsdlURI.toURL();
+                if (url != null) {
+                    URLConnection urlc = url.openConnection();
+                    try {
+                        if (urlc != null) {
+                            XMLStreamReader parser = XMLInputFactory.newInstance().
+                                    createXMLStreamReader(urlc.getInputStream());
+                            StAXOMBuilder builder = new StAXOMBuilder(parser);
+                            wsdlElement = builder.getDocumentElement();
+                            // detach from URL connection and keep in memory
+                            // TODO remove this
+                            wsdlElement.build();
+                        }
+                    } catch (XMLStreamException e) {
+                        log.warn("Content at URL : " + url + " is non XML..");
                     }
 
-                    if (wsdlToAxisServiceBuilder == null) {
-                        throw new SynapseException(
-                                "Could not get the WSDL to Axis Service Builder");
+                }
+            } catch (MalformedURLException e) {
+                handleException("Malformed URI for wsdl", e);
+            } catch (IOException e) {
+                handleException("Error reading from wsdl URI", e);
+            }
+        }
+        if (wsdlElement != null) {
+            OMNamespace wsdlNamespace = wsdlElement.getNamespace();
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            try {
+                wsdlElement.serialize(baos);
+                wsdlInputStream = new ByteArrayInputStream(baos.toByteArray());
+            } catch (XMLStreamException e) {
+                handleException("Error converting to a StreamSource", e);
+            }
+            if (wsdlInputStream != null) {
+                try {
+                    // detect version of the WSDL 1.1 or 2.0
+                    if (wsdlNamespace != null) {
+                        WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
+                        if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.
+                                equals(wsdlNamespace.getNamespaceURI())) {
+                            wsdlToAxisServiceBuilder =
+                                    new WSDL20ToAxisServiceBuilder(wsdlInputStream, null, null);
+
+                        } else if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.
+                                equals(wsdlNamespace.getNamespaceURI())) {
+                            wsdlToAxisServiceBuilder =
+                                    new WSDL11ToAxisServiceBuilder(wsdlInputStream, null, null);
+                        } else {
+                            handleException("Unknown WSDL format.. not WSDL 1.1 or WSDL 2.0");
+                        }
+
+                        if (wsdlToAxisServiceBuilder == null) {
+                            throw new SynapseException(
+                                    "Could not get the WSDL to Axis Service Builder");
+                        }
+                        proxyService = wsdlToAxisServiceBuilder.populateService();
+                        proxyService.setWsdlFound(true);
+
+                    } else {
+                        handleException("Unknown WSDL format.. not WSDL 1.1 or WSDL 2.0");
                     }
-                    proxyService = wsdlToAxisServiceBuilder.populateService();
-                    proxyService.setWsdlFound(true);
 
-                } else {
-                    handleException("Unknown WSDL format.. not WSDL 1.1 or WSDL 2.0");
+                } catch (AxisFault af) {
+                    handleException("Error building service from WSDL", af);
+                } catch (IOException ioe) {
+                    handleException("Error reading WSDL", ioe);
                 }
-
-            } catch (XMLStreamException e) {
-                handleException("Error reading WSDL defined by registry key : " + wsdlKey, e);
-            } catch (AxisFault af) {
-                handleException("Error building service from WSDL defined by registry key : "
-                        + wsdlKey, af);
-            } catch (IOException ioe) {
-                handleException("Error reading WSDL from WSDL defined by registry key : "
-                        + wsdlKey, ioe);
             }
         } else {
             // this is for POX... create a dummy service and an operation for which
             // our SynapseDispatcher will properly dispatch to
             proxyService = new AxisService();
             AxisOperation mediateOperation =
-                new InOutAxisOperation(new QName("mediate"));
+                    new InOutAxisOperation(new QName("mediate"));
             proxyService.addOperation(mediateOperation);
         }
 
@@ -177,8 +283,8 @@
         // process parameters
         Iterator iter = properties.keySet().iterator();
         while (iter.hasNext()) {
-            String name  = (String) iter.next();
-            String value = (String) properties.get(name);
+            String name = (String) iter.next();
+            Object value = properties.get(name);
 
             Parameter p = new Parameter();
             p.setName(name);
@@ -188,29 +294,33 @@
                 proxyService.addParameter(p);
             } catch (AxisFault af) {
                 handleException("Error setting property : " + name + "" +
-                    "to proxy service as a Parameter", af);
+                        "to proxy service as a Parameter", af);
             }
         }
 
         // if service level policies are specified, apply them
         if (!serviceLevelPolicies.isEmpty()) {
-
             Policy svcEffectivePolicy = null;
-
             iter = serviceLevelPolicies.iterator();
             while (iter.hasNext()) {
                 String policyKey = (String) iter.next();
-                if (svcEffectivePolicy == null) {
-                    svcEffectivePolicy = PolicyEngine.getPolicy(
-                        Util.getStreamSource(synCfg.getProperty(policyKey)).getInputStream());
-                } else {
-                    svcEffectivePolicy = (Policy) svcEffectivePolicy.merge(
-                        PolicyEngine.getPolicy(
-                            Util.getStreamSource(synCfg.getProperty(policyKey)).getInputStream()));
+                Object policyProp = synCfg.getProperty(policyKey);
+                if (policyProp != null) {
+                    if (svcEffectivePolicy == null) {
+
+                        svcEffectivePolicy = PolicyEngine.getPolicy(
+                                Util.getStreamSource(policyProp).getInputStream());
+                    } else {
+                        svcEffectivePolicy = (Policy) svcEffectivePolicy.merge(
+                                PolicyEngine.getPolicy(
+                                        Util.getStreamSource(policyProp).getInputStream()));
+                    }
                 }
             }
             PolicyInclude pi = proxyService.getPolicyInclude();
-            pi.addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY, svcEffectivePolicy);
+            if (pi != null && svcEffectivePolicy != null) {
+                pi.addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY, svcEffectivePolicy);
+            }
         }
 
         // create a custom message receiver for this proxy service to use a given named
@@ -226,6 +336,9 @@
             if (targetOutSequence != null) {
                 msgRcvr.setTargetOutSequence(targetOutSequence);
             }
+            if (targetFaultSequence != null) {
+                msgRcvr.setTargetFaultSequence(targetFaultSequence);
+            }
         }
 
         iter = proxyService.getOperations();
@@ -300,7 +413,7 @@
         return transports;
     }
 
-    public void addProperty(String name, String value) {
+    public void addProperty(String name, Object value) {
         properties.put(name, value);
     }
 
@@ -436,5 +549,61 @@
      */
     public void setTraceState(int traceState) {
         this.traceState = traceState;
+    }
+
+    public String getTargetFaultSequence() {
+        return targetFaultSequence;
+    }
+
+    public void setTargetFaultSequence(String targetFaultSequence) {
+        this.targetFaultSequence = targetFaultSequence;
+    }
+
+    public Object getInLineWSDL() {
+        return inLineWSDL;
+    }
+
+    public void setInLineWSDL(Object inLineWSDL) {
+        this.inLineWSDL = inLineWSDL;
+    }
+
+    public URI getWsdlURI() {
+        return wsdlURI;
+    }
+
+    public void setWsdlURI(URI wsdlURI) {
+        this.wsdlURI = wsdlURI;
+    }
+
+    public Endpoint getTargetInLineEndpoint() {
+        return targetInLineEndpoint;
+    }
+
+    public void setTargetInLineEndpoint(Endpoint targetInLineEndpoint) {
+        this.targetInLineEndpoint = targetInLineEndpoint;
+    }
+
+    public SequenceMediator getTargetInLineInSequence() {
+        return targetInLineInSequence;
+    }
+
+    public void setTargetInLineInSequence(SequenceMediator targetInLineInSequence) {
+        this.targetInLineInSequence = targetInLineInSequence;
+    }
+
+    public SequenceMediator getTargetInLineOutSequence() {
+        return targetInLineOutSequence;
+    }
+
+    public void setTargetInLineOutSequence(SequenceMediator targetInLineOutSequence) {
+        this.targetInLineOutSequence = targetInLineOutSequence;
+    }
+
+    public SequenceMediator getTargetInLineFaultSequence() {
+        return targetInLineFaultSequence;
+    }
+
+    public void setTargetInLineFaultSequence(SequenceMediator targetInLineFaultSequence) {
+        this.targetInLineFaultSequence = targetInLineFaultSequence;
     }
 }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java?view=diff&rev=512217&r1=512216&r2=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java Tue Feb 27 02:43:57 2007
@@ -27,10 +27,12 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.Mediator;
 import org.apache.synapse.MessageContext;
+import org.apache.synapse.mediators.base.SequenceMediator;
 import org.apache.synapse.statistics.StatisticsUtils;
 import org.apache.synapse.statistics.impl.EndPointStatisticsStack;
 import org.apache.synapse.statistics.impl.ProxyServiceStatisticsStack;
 import org.apache.synapse.config.Endpoint;
+import org.apache.axiom.om.OMNode;
 
 /**
  * This is the MessageReceiver set to act on behalf of Proxy services.
@@ -39,7 +41,9 @@
 
     private static final Log log = LogFactory.getLog(ProxyServiceMessageReceiver.class);
 
-    /** The name of the Proxy Service */
+    /**
+     * The name of the Proxy Service
+     */
     private String name = null;
 
     /**
@@ -61,6 +65,16 @@
      */
     private String targetOutSequence = null;
 
+    private String targetFaultSequence = null;
+       /** The target endpoint, if assigned   */
+    private Endpoint targetInLineEndpoint = null;
+    /** The target inSequence, if assigned */
+    private SequenceMediator targetInLineInSequence = null;
+    /** The target outSequence, if assigned  */
+    private SequenceMediator targetInLineOutSequence = null;
+    /** The target faultSequence, if assigned  */
+    private SequenceMediator targetInLineFaultSequence = null;
+
     public void receive(org.apache.axis2.context.MessageContext mc) throws AxisFault {
 
         log.debug("Proxy Service " + name + " received a new message...");
@@ -71,7 +85,7 @@
         }
 
         MessageContext synCtx = MessageContextCreatorForAxis2.getSynapseMessageContext(mc);
-        
+
         // Setting Required property to collect the proxy service statistics
         boolean statisticsEnable;
         ProxyService currentProxyService = synCtx.getConfiguration().getProxyService(name);
@@ -97,7 +111,7 @@
                 log.debug("Forwarding message directly to the endpoint named : " + targetEndpoint);
 
                 org.apache.axis2.context.MessageContext axisInMsgContext =
-                    ((Axis2MessageContext) synCtx).getAxis2MessageContext();
+                        ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                 Axis2FlexibleMEPClient.send(endpoint, synCtx);
             }
 
@@ -123,7 +137,7 @@
                     mediator.mediate(synCtx);
                 }
 
-            // else default to the Synapse main mediator
+                // else default to the Synapse main mediator
             } else {
                 log.debug("Using default 'main' mediator for message mediation");
                 synCtx.getEnvironment().injectMessage(synCtx);
@@ -133,6 +147,7 @@
 
     /**
      * Specify a named target endpoint for direct message forwarding
+     *
      * @param targetEndpoint the name of the target endpoint to be used
      */
     public void setTargetEndpoint(String targetEndpoint) {
@@ -141,6 +156,7 @@
 
     /**
      * Specify a named target sequence to be used for message mediation for incoming messages
+     *
      * @param targetInSequence the name of the target sequence to be used for incoming messages
      */
     public void setTargetInSequence(String targetInSequence) {
@@ -149,6 +165,7 @@
 
     /**
      * Specify a named target sequence to be used for message mediation for outgoing messages
+     *
      * @param targetOutSequence the name of the target sequence to be used for outgoing messages
      */
     public void setTargetOutSequence(String targetOutSequence) {
@@ -157,9 +174,30 @@
 
     /**
      * Set the name of the corresponding proxy service
+     *
      * @param name the proxy service name
      */
     public void setName(String name) {
         this.name = name;
+    }
+
+    public void setTargetFaultSequence(String targetFaultSequence) {
+        this.targetFaultSequence = targetFaultSequence;
+    }
+
+    public void setTargetInLineEndpoint(Endpoint targetInLineEndpoint) {
+        this.targetInLineEndpoint = targetInLineEndpoint;
+    }
+
+    public void setTargetInLineInSequence(SequenceMediator targetInLineInSequence) {
+        this.targetInLineInSequence = targetInLineInSequence;
+    }
+
+    public void setTargetInLineOutSequence(SequenceMediator targetInLineOutSequence) {
+        this.targetInLineOutSequence = targetInLineOutSequence;
+    }
+
+    public void setTargetInLineFaultSequence(SequenceMediator targetInLineFaultSequence) {
+        this.targetInLineFaultSequence = targetInLineFaultSequence;
     }
 }

Added: webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java?view=auto&rev=512217
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java (added)
+++ webservices/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/ProxyServiceSerializationTest.java Tue Feb 27 02:43:57 2007
@@ -0,0 +1,75 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.synapse.core.axis2.ProxyService;
+
+/**
+ *
+ *
+ */
+
+public class ProxyServiceSerializationTest extends AbstractTestCase {
+
+
+    public void testProxyServiceSerializationSenarioOne() throws Exception {
+        String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"name\" startOnLoad=\"true\"  transports=\"http\"><description>description</description><target inSequence=\"inseqname\" outSequence=\"outseqname\" faultSequence=\"faultseqname\" /><publish-wsdl uri=\"http://uri\" ></publish-wsdl><policy key=\"key\"/><parameter name=\"para\">text</parameter></proxy>";
+        OMElement inputOM = createOMElement(inputXml);
+        ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
+        OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
+        assertTrue(comparator.compare(resultOM, inputOM));
+    }
+
+    public void testProxyServiceSerializationSenarioTwo() throws Exception {
+        String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" startOnLoad=\"true\" name=\"name\"  transports=\"http\"><description>description</description><target endpoint=\"epr\" /><publish-wsdl key=\"key\"></publish-wsdl><policy key=\"key\"/><parameter name=\"para\">text</parameter></proxy>";
+        OMElement inputOM = createOMElement(inputXml);
+        ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
+        OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
+        assertTrue(comparator.compare(resultOM, inputOM));
+    }
+
+    public void testProxyServiceSerializationSenarioThree() throws Exception {
+        String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"name\" startOnLoad=\"true\"  transports=\"http\"><description>description</description><target><inSequence onError=\"ref\"><send/></inSequence></target><publish-wsdl  key=\"key\"></publish-wsdl><policy key=\"key\"/><parameter name=\"para\">text</parameter></proxy>";
+        OMElement inputOM = createOMElement(inputXml);
+        ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
+        OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
+        assertTrue(comparator.compare(resultOM, inputOM));
+    }
+
+//    public void testProxyServiceSerializationSenarioFour() throws Exception {
+//        String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"name\" startOnLoad=\"true\"  transports=\"http\"><description>description</description><target><inSequence><send/></inSequence></target><publish-wsdl><wsdl:definitions  xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\"></wsdl:definitions></publish-wsdl><policy key=\"key\"/><parameter name=\"para\">text</parameter></proxy>";
+//        OMElement inputOM = createOMElement(inputXml);
+//
+//        ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
+//        OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
+//        assertTrue(comparator.compare(resultOM, inputOM));
+//    }
+    public void testProxyServiceSerializationSenarioFive() throws Exception {
+        String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" startOnLoad=\"true\" name=\"name\"  transports=\"http\"><description>description</description><target><endpoint address=\"http://www.example.com/testepr\" /></target><publish-wsdl uri=\"http://uri\"></publish-wsdl><policy key=\"key\"/><parameter name=\"para\">text</parameter></proxy>";
+        OMElement inputOM = createOMElement(inputXml);
+        ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
+        OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);     
+        assertTrue(comparator.compare(resultOM, inputOM));
+    }
+//     public void testProxyServiceSerializationSenarioSix() throws Exception {
+//        String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" startOnLoad=\"true\" name=\"name\"  transports=\"http\"><description>description</description><target><endpoint address=\"http://www.example.com/testepr\" /></target><publish-wsdl uri=\"http://uri\" key=\"key\"></publish-wsdl><policy key=\"key\"/><parameter name=\"para\"><inline xmlns=\"http://customns\"><test/></inline></parameter></proxy>";
+//        OMElement inputOM = createOMElement(inputXml);
+//        ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
+//        OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
+//        assertTrue(comparator.compare(resultOM, inputOM));
+//    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org