Coverage Report - org.mule.transport.soap.axis.component.WebServiceWrapperComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
WebServiceWrapperComponent
85%
23/27
67%
8/12
1.857
 
 1  
 /*
 2  
  * $Id: WebServiceWrapperComponent.java 12228 2008-07-03 00:26:59Z aguenther $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.transport.soap.axis.component;
 12  
 
 13  
 import org.mule.DefaultMuleMessage;
 14  
 import org.mule.api.MuleContext;
 15  
 import org.mule.api.MuleEvent;
 16  
 import org.mule.api.MuleMessage;
 17  
 import org.mule.api.endpoint.EndpointBuilder;
 18  
 import org.mule.api.endpoint.OutboundEndpoint;
 19  
 import org.mule.config.i18n.CoreMessages;
 20  
 import org.mule.endpoint.EndpointURIEndpointBuilder;
 21  
 import org.mule.transport.soap.axis.AxisConnector;
 22  
 import org.mule.transport.soap.component.AbstractWebServiceWrapperComponent;
 23  
 
 24  
 import java.util.Map;
 25  
 
 26  18
 public class WebServiceWrapperComponent extends AbstractWebServiceWrapperComponent
 27  
 {
 28  
 
 29  
     private String use;
 30  
     private String style;
 31  
     private Map properties;
 32  
 
 33  
     protected MuleMessage doOnCall(MuleEvent event) throws Exception
 34  
     {
 35  6
         MuleContext muleContext = event.getMuleContext();
 36  
 
 37  
         String tempUrl;
 38  6
         if (addressFromMessage)
 39  
         {
 40  2
             tempUrl = event.getMessage().getStringProperty(WS_SERVICE_URL, null);
 41  2
             if (tempUrl == null)
 42  
             {
 43  0
                 throw new IllegalArgumentException(CoreMessages.propertyIsNotSetOnEvent(WS_SERVICE_URL)
 44  
                     .toString());
 45  
             }
 46  
         }
 47  
         else
 48  
         {
 49  4
             tempUrl = address;
 50  
         }
 51  6
         MuleMessage message = new DefaultMuleMessage(event.transformMessage());
 52  
 
 53  6
         if (properties != null && properties.get(AxisConnector.SOAP_METHODS) != null)
 54  
         {
 55  2
             message.addProperties((Map) properties.get(AxisConnector.SOAP_METHODS));
 56  
         }
 57  
 
 58  6
         EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("axis:" + tempUrl, muleContext);
 59  6
         if (use != null)
 60  
         {
 61  6
             endpointBuilder.setProperty(AxisConnector.USE, use);
 62  
         }
 63  6
         if (style != null)
 64  
         {
 65  6
             endpointBuilder.setProperty(AxisConnector.STYLE, style);
 66  
 
 67  
         }
 68  
 
 69  6
         OutboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(
 70  
             endpointBuilder);
 71  
 
 72  6
         MuleMessage result = event.getSession().sendEvent(message, endpoint);
 73  6
         return result;
 74  
     }
 75  
 
 76  
     public String getUse()
 77  
     {
 78  0
         return use;
 79  
     }
 80  
 
 81  
     public void setUse(String use)
 82  
     {
 83  18
         this.use = use;
 84  18
     }
 85  
 
 86  
     public String getStyle()
 87  
     {
 88  0
         return style;
 89  
     }
 90  
 
 91  
     public void setStyle(String style)
 92  
     {
 93  18
         this.style = style;
 94  18
     }
 95  
 
 96  
     public Map getProperties()
 97  
     {
 98  0
         return properties;
 99  
     }
 100  
 
 101  
     public void setProperties(Map properties)
 102  
     {
 103  6
         this.properties = properties;
 104  6
     }
 105  
 
 106  
 }