Hi,
See enclosed diff. Specifically the url :)
thanks,
dims
On 1/16/07, Lin Sun <[EMAIL PROTECTED]> wrote:
Hi Dims, just curious... how were you able to verify '?wsdl' working? I
haven't been able to get '?wsdl' working with the cxfpojows test case.
Thanks, Lin
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, January 15, 2007 2:08 PM
To: [email protected]
Subject: svn commit: r496446 -
/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geron
imo/axis2/Axis2WebServiceContainer.java
Author: dims
Date: Mon Jan 15 11:07:43 2007
New Revision: 496446
URL: http://svn.apache.org/viewvc?view=rev&rev=496446
Log:
get ?wsdl working. next step is to get the actual call working
Modified:
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
mo/axis2/Axis2WebServiceContainer.java
Modified:
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
mo/axis2/Axis2WebServiceContainer.java
URL:
http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/sr
c/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=dif
f&rev=496446&r1=496445&r2=496446
============================================================================
==
---
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
mo/axis2/Axis2WebServiceContainer.java (original)
+++
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
mo/axis2/Axis2WebServiceContainer.java Mon Jan 15 11:07:43 2007
@@ -44,6 +44,7 @@
import javax.xml.namespace.QName;
import java.io.PrintWriter;
import java.net.SocketException;
+import java.net.URI;
import java.util.HashMap;
import java.util.Map;
@@ -58,7 +59,7 @@
private transient final ClassLoader classLoader;
private final String endpointClassName;
private final PortInfo portInfo;
- ConfigurationContext configurationContext =
ConfigurationContextFactory.createEmptyConfigurationContext();
+ private ConfigurationContext configurationContext;
private String contextRoot = null;
public Axis2WebServiceContainer(PortInfo portInfo, String
endpointClassName, ClassLoader classLoader) {
@@ -66,10 +67,13 @@
this.endpointClassName = endpointClassName;
this.portInfo = portInfo;
try {
+ configurationContext =
ConfigurationContextFactory.createDefaultConfigurationContext();
AxisService service =
AxisService.createService(endpointClassName,
configurationContext.getAxisConfiguration(), RPCMessageReceiver.class);
configurationContext.getAxisConfiguration().addService(service);
} catch (AxisFault af) {
throw new RuntimeException(af);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
}
@@ -144,12 +148,9 @@
} else {
response.setStatusCode(500);
String msg = ex.getMessage();
- if (msg == null || msg.trim().length() == 0) {
- msg = "Exception message unknown";
- }
response.setHeader(HTTPConstants.HEADER_CONTENT_TYPE,
"text/plain");
PrintWriter pw = new
PrintWriter(response.getOutputStream());
- pw.write(msg);
+ ex.printStackTrace(pw);
pw.flush();
}
}
@@ -184,7 +185,8 @@
final String servicePath =
configurationContext.getServiceContextPath();
final String contextPath = (servicePath.startsWith("/") ?
servicePath : "/" + servicePath) + "/";
- String uri = request.getURI().toString();
+ URI uri = request.getURI();
+ String path = uri.getPath();
String soapAction =
request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
// TODO: Port this section
@@ -209,14 +211,14 @@
// }
if (request.getMethod() == Request.GET) {
- if (!uri.startsWith(contextPath)) {
+ if (!path.startsWith(contextPath)) {
response.setStatusCode(301);
response.setHeader("Location", contextPath);
return;
}
- if (uri.indexOf("?") < 0) {
- if (!uri.endsWith(contextPath)) {
- String serviceName = uri.replaceAll(contextPath, "");
+ if (uri.toString().indexOf("?") < 0) {
+ if (!path.endsWith(contextPath)) {
+ String serviceName = path.replaceAll(contextPath, "");
if (serviceName.indexOf("/") < 0) {
String res =
HTTPTransportReceiver.printServiceHTML(serviceName, configurationContext);
PrintWriter pw = new
PrintWriter(response.getOutputStream());
@@ -225,28 +227,26 @@
}
}
}
- if (uri.endsWith("?wsdl2")) {
- String serviceName = uri.substring(uri.lastIndexOf("/") +
1, uri.length() - 6);
+ if (uri.getQuery().startsWith("wsdl2")) {
+ String serviceName = path.substring(path.lastIndexOf("/") +
1, path.length() - 6);
HashMap services =
configurationContext.getAxisConfiguration().getServices();
final AxisService service = (AxisService)
services.get(serviceName);
if (service != null) {
- final String ip = HttpUtils.getIpAddress();
- service.printWSDL2(response.getOutputStream(), ip,
servicePath);
+ service.printWSDL2(response.getOutputStream(),
uri.getHost(), servicePath);
return;
}
}
- if (uri.endsWith("?wsdl")) {
- String serviceName = uri.substring(uri.lastIndexOf("/") +
1, uri.length() - 5);
+ if (uri.getQuery().startsWith("wsdl")) {
+ String serviceName = path.substring(path.lastIndexOf("/") +
1);
HashMap services =
configurationContext.getAxisConfiguration().getServices();
final AxisService service = (AxisService)
services.get(serviceName);
if (service != null) {
- final String ip = HttpUtils.getIpAddress();
- service.printWSDL(response.getOutputStream(), ip,
servicePath);
+ service.printWSDL(response.getOutputStream(),
uri.getHost(), servicePath);
return;
}
}
- if (uri.endsWith("?xsd")) {
- String serviceName = uri.substring(uri.lastIndexOf("/") +
1, uri.length() - 4);
+ if (uri.getQuery().startsWith("xsd=")) {
+ String serviceName = path.substring(path.lastIndexOf("/") +
1);
HashMap services =
configurationContext.getAxisConfiguration().getServices();
final AxisService service = (AxisService)
services.get(serviceName);
if (service != null) {
@@ -255,9 +255,9 @@
}
}
//cater for named xsds - check for the xsd name
- if (uri.indexOf("?xsd=") > 0) {
- String serviceName = uri.substring(uri.lastIndexOf("/") +
1, uri.lastIndexOf("?xsd="));
- String schemaName = uri.substring(uri.lastIndexOf("=") +
1);
+ if (uri.getQuery().startsWith("xsd")) {
+ String serviceName = path.substring(path.lastIndexOf("/") +
1);
+ String schemaName =
uri.getQuery().substring(uri.getQuery().lastIndexOf("=") + 1);
HashMap services =
configurationContext.getAxisConfiguration().getServices();
AxisService service = (AxisService)
services.get(serviceName);
@@ -287,9 +287,9 @@
msgContext,
response.getOutputStream(),
soapAction,
- uri,
+ path,
configurationContext,
- HTTPTransportReceiver.getGetRequestParameters(uri));
+ HTTPTransportReceiver.getGetRequestParameters(path));
if (!processed) {
response.setStatusCode(200);
@@ -303,7 +303,7 @@
// deal with POST request
msgContext.setProperty(MessageContext.TRANSPORT_OUT,
response.getOutputStream());
- msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
response.getOutputStream());
+ msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new
Axis2TransportInfo(response));
String contenttype =
request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
HTTPTransportUtils.processHTTPPostRequest(
@@ -312,7 +312,7 @@
response.getOutputStream(),
contenttype,
soapAction,
- uri);
+ path);
} else {
throw new UnsupportedOperationException("[" +
request.getMethod() + " ] method not supported");
--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)
Index: src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java
===================================================================
--- src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java (revision 496910)
+++ src/test/java/org/apache/geronimo/testsuite/testset/JaxWSTest.java (working copy)
@@ -51,7 +51,7 @@
*/
public class JaxWSTest extends TestSupport {
- private String baseURL = "http://localhost:8080/";
+ private String baseURL = "http://localhost:8081/";
@Test
public void testInvocation() throws Exception {
@@ -61,13 +61,14 @@
InputStream requestInput = JaxWSTest.class.getResourceAsStream("/request1.xml");
assertNotNull("SOAP request not specified", requestInput);
- URL url = new URL(baseURL + warName + "/servlet");
+ URL url = new URL(baseURL + warName + "/services/GreeterImpl");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
try {
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
+ conn.setRequestProperty("SOAPAction", "\"greetMe\"");
conn.setRequestProperty("Content-Type", "text/xml");
OutputStream out = conn.getOutputStream();
@@ -131,7 +132,7 @@
String warName = System.getProperty("webAppName");
assertNotNull("Web application name not specified", warName);
- URL url = new URL(baseURL + warName + "/servlet?wsdl");
+ URL url = new URL(baseURL + warName + "/services/GreeterImpl?wsdl");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
try {
conn.setUseCaches(false);
Index: src/main/webapp/WEB-INF/web.xml
===================================================================
--- src/main/webapp/WEB-INF/web.xml (revision 496910)
+++ src/main/webapp/WEB-INF/web.xml (working copy)
@@ -35,5 +35,9 @@
<servlet-name>cxfPojoServlet</servlet-name>
<url-pattern>/servlet</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>cxfPojoServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
</web-app>