1 8 package org.jboss.net.axis.message.addressing.handler; 9 10 import org.apache.axis.EngineConfiguration; 11 import org.apache.axis.MessageContext; 12 import org.apache.axis.client.Call; 13 import org.apache.axis.client.Service; 14 import org.apache.axis.message.addressing.Action; 15 import org.apache.axis.message.addressing.AddressingHeaders; 16 import org.apache.ws.axis.security.WSDoAllConstants; 17 import org.jboss.net.axis.server.JMXEngineConfigurationFactory; 18 19 import java.util.StringTokenizer ; 20 import java.util.Vector ; 21 22 47 public class AddressingHandler extends org.apache.axis.message.addressing.handler.AddressingHandler 48 { 49 52 public void init() 53 { 54 super.init(); 55 initializeCall(); 56 } 57 58 67 private void initializeCall() 68 { 69 String transportPackages = null; if (transportPackages != null) 71 { 72 StringTokenizer t = new StringTokenizer (transportPackages, ","); 73 while (t.hasMoreTokens()) 74 { 75 Call.addTransportPackage(t.nextToken().trim()); 76 } 77 } 78 79 String transports = null; if (transports != null) 81 { 82 StringTokenizer t = new StringTokenizer (transports, ","); 83 while (t.hasMoreTokens()) 84 { 85 String tToken = t.nextToken().trim(); 86 String [] transport = new String [2]; 87 88 if (tToken.indexOf(':') < 0 || tToken.indexOf(':') != tToken.lastIndexOf(':')) 89 { 90 log.warn(tToken + " is not in the proper form of [transport]:[class]"); 91 continue; 92 } 93 else 94 { 95 transport[0] = tToken.substring(0, tToken.indexOf(':')); 96 transport[1] = tToken.substring(tToken.indexOf(':') + 1); 97 } 98 99 String tName = transport[0]; 100 String tClassName = transport[1]; 101 Class tClass = null; 102 try 103 { 104 tClass = Class.forName(tClassName); 105 } 106 catch (ClassNotFoundException e) 107 { 108 log.warn("Unable to locate the class " + tClassName + " for the transport " + tName); 109 continue; 110 } 111 Call.setTransportForProtocol(tName, tClass); 112 } 113 } 114 } 115 116 119 protected void configureCall(Call call, MessageContext msgContext) 120 { 121 124 if (msgContext != null) 126 { 127 Vector wssResults = null; 128 wssResults = (Vector )msgContext.getProperty(WSDoAllConstants.RECV_RESULTS); 129 call.setProperty(WSDoAllConstants.RECV_RESULTS, wssResults); 130 } 131 } 132 133 136 protected Service getService(MessageContext msgContext) 137 { 138 String engineName = null; EngineConfiguration config = JMXEngineConfigurationFactory.newJMXFactory(engineName) 140 .getClientEngineConfig(); 141 return new Service(config); 142 } 143 144 148 protected void setTargetService(MessageContext msgCtx, AddressingHeaders headers) throws Exception 149 { 150 if (log.isDebugEnabled()) 151 log.debug("Entering: invoke(MessageContext)"); 152 Action action = headers.getAction(); 153 154 if (action != null) 155 { 156 String actionURI = null; msgCtx.setUseSOAPAction(true); 158 msgCtx.setSOAPActionURI(actionURI); 159 msgCtx.setTargetService(actionURI); 160 } 161 else 162 { 163 } 165 } 166 } | Popular Tags |