1 55 56 package org.jboss.axis.handlers; 57 58 import org.jboss.axis.AxisFault; 59 import org.jboss.axis.Message; 60 import org.jboss.axis.MessageContext; 61 import org.jboss.axis.message.SOAPEnvelopeAxisImpl; 62 import org.jboss.axis.utils.Messages; 63 import org.jboss.axis.utils.XMLUtils; 64 import org.jboss.logging.Logger; 65 import org.w3c.dom.Document ; 66 67 import java.io.StringBufferInputStream ; 68 69 72 public class EchoHandler extends BasicHandler 73 { 74 private static Logger log = Logger.getLogger(EchoHandler.class.getName()); 75 76 public void invoke(MessageContext msgContext) throws AxisFault 77 { 78 log.debug("Enter: EchoHandler::invoke"); 79 try 80 { 81 Message msg = msgContext.getRequestMessage(); 82 SOAPEnvelopeAxisImpl env = (SOAPEnvelopeAxisImpl)msg.getSOAPEnvelope(); 83 msgContext.setResponseMessage(new Message(env)); 84 } 85 catch (Exception e) 86 { 87 log.error(Messages.getMessage("exception00"), e); 88 throw AxisFault.makeFault(e); 89 } 90 log.debug("Exit: EchoHandler::invoke"); 91 } 92 93 public String wsdlStart1 = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + 94 "<definitions xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n" + 95 "xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" \n" + 96 "xmlns:mime=\"http://schemas.xmlsoap.org/wsdl/mime/\" \n" + 97 "xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" \n" + 98 "xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" \n" + 99 "xmlns:s0=\"http://tempuri.org/EchoService\" \n" + 100 "targetNamespace=\"http://tempuri.org/EchoService\" \n" + 101 "xmlns=\"http://schemas.xmlsoap.org/wsdl/\">" + 102 "<message name=\"request\">" + 103 "<part name=\"content\" type=\"xsd:anyType\" />" + 104 "</message>" + 105 "<message name=\"response\">" + 106 "<part name=\"content\" element=\"xsd:anyType\" />" + 107 "</message>" + 108 "<portType name=\"EchoSoap\">" + 109 "<operation name=\"doIt\">" + 110 "<input message=\"s0:request\" /> " + 111 "<output message=\"s0:response\" /> " + 112 "</operation>" + 113 "</portType>" + 114 "<binding name=\"EchoSoap\" type=\"s0:EchoSoap\">" + 115 "<soap:binding transport=\"http://schemas.xmlsoap.org/soap/http\" style=\"document\" />" + 116 "<operation name=\"doIt\">" + 117 "<soap:operation soapAction=\"http://tempuri.org/Echo\" style=\"document\" />" + 118 "<input>" + 119 "<soap:body use=\"literal\" />" + 120 "</input>" + 121 "<output>" + 122 "<soap:body use=\"literal\" />" + 123 "</output>" + 124 "</operation>" + 125 "</binding>" + 126 "<service name=\"Echo\">" + 127 "<port name=\"EchoSoap\" binding=\"s0:EchoSoap\">" + 128 "<soap:address location=\"http://"; 129 130 131 public String wsdlStart = 132 "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" + 133 "<wsdl:definitions targetNamespace=\"http://handlers.apache.org/EchoService\" \n" + 134 "xmlns=\"http://schemas.xmlsoap.org/wsdl/\" \n" + 135 "xmlns:apachesoap=\"http://xml.apache.org/xml-soap\" \n" + 136 "xmlns:impl=\"http://handlers.apache.org/EchoService\" \n" + 137 "xmlns:intf=\"http://handlers.apache.org/EchoService\" \n" + 138 "xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" \n" + 139 "xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" \n" + 140 "xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\" \n" + 141 "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> \n" + 142 "<wsdl:types> \n" + 143 "<schema targetNamespace=\"http://handlers.apache.org/EchoService\" \n" + 144 "xmlns=\"http://www.w3.org/2001/XMLSchema\"> \n" + 145 "<xsd:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\"/> \n" + 146 "<xsd:complexType name=\"echoElements\"> \n" + 147 " <xsd:sequence> \n" + 148 " <xsd:element name=\"content\" type=\"xsd:anyType\"/> \n" + 149 " </xsd:sequence>\n" + 150 "</xsd:complexType> \n" + 151 "<xsd:complexType name=\"echoElementsReturn\"> \n" + 152 " <xsd:sequence> \n" + 153 " <xsd:element name=\"content\" type=\"xsd:anyType\"/> \n" + 154 " </xsd:sequence> \n" + 155 "</xsd:complexType> \n" + 156 "</schema> \n" + 157 "</wsdl:types> \n" + 158 " <wsdl:message name=\"echoElementsResponse\"> \n" + 159 " <wsdl:part type=\"impl:echoElementsReturn\" name=\"echoElementsReturn\"/> \n" + 160 " </wsdl:message> \n" + 161 " <wsdl:message name=\"echoElementsRequest\"> \n" + 162 " <wsdl:part type=\"impl:echoElements\" name=\"part\"/> \n" + 163 " </wsdl:message> \n" + 164 " <wsdl:portType name=\"EchoService\"> \n" + 165 " <wsdl:operation name=\"doIt\"> \n" + 166 " <wsdl:input message=\"impl:echoElementsRequest\" name=\"echoElementsRequest\"/> \n" + 167 " <wsdl:output message=\"impl:echoElementsResponse\" name=\"echoElementsResponse\"/> \n" + 168 " </wsdl:operation> \n" + 169 " </wsdl:portType> \n" + 170 " <wsdl:binding name=\"EchoServiceSoapBinding\" type=\"impl:EchoService\"> \n" + 171 " <wsdlsoap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/> \n" + 172 " <wsdl:operation name=\"doIt\"> \n" + 173 " <wsdlsoap:operation soapAction=\"\"/> \n" + 174 " <wsdl:input name=\"echoElementsRequest\"> \n" + 175 " <wsdlsoap:body namespace=\"http://handlers.apache.org/EchoService\" use=\"literal\"/> \n" + 176 " </wsdl:input> \n" + 177 " <wsdl:output name=\"echoElementsResponse\"> \n" + 178 " <wsdlsoap:body namespace=\"http://handlers.apache.org/EchoService\" use=\"literal\"/> \n" + 179 " </wsdl:output> \n" + 180 " </wsdl:operation> \n" + 181 " </wsdl:binding> \n" + 182 " <wsdl:service name=\"EchoService\"> \n" + 183 " <wsdl:port binding=\"impl:EchoServiceSoapBinding\" name=\"EchoService\"> \n" + 184 " <wsdlsoap:address location=\""; 185 186 String wsdlEnd = " \"/></wsdl:port>\n" + 187 "</wsdl:service>\n" + 188 "</wsdl:definitions>\n"; 189 190 191 public void generateWSDL(MessageContext msgContext) throws AxisFault 192 { 193 try 194 { 195 String url = msgContext.getStrProp(MessageContext.TRANS_URL); 196 String wsdlString = wsdlStart + url + wsdlEnd; 197 Document doc = XMLUtils.newDocument(new StringBufferInputStream (wsdlString)); 198 msgContext.setProperty("WSDL", doc); 199 } 200 catch (Exception e) 201 { 202 throw AxisFault.makeFault(e); 203 } 204 } 205 } 206 207 ; 208 | Popular Tags |