Fix TUSCANY-3269 (use host from ?wsdl request in returned WSDL)

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@814373 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nash 2009-09-13 18:06:29 +00:00
parent 59259674bd
commit 3ac402feab
5 changed files with 9 additions and 23 deletions

View file

@ -53,7 +53,6 @@ import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.PolicyInclude;
import org.apache.axis2.transport.http.ListingAgent;
import org.apache.axis2.transport.http.server.HttpUtils;
import org.apache.axis2.util.ExternalPolicySerializer;
import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.wsdl.WSDLConstants;
@ -225,7 +224,7 @@ public class TuscanyListingAgent extends ListingAgent {
int wsdlPort = wsdlURIObj.getPort();
String wsdlAddr = wsdlHost + (wsdlPort != -1 ? ":" + Integer.toString(wsdlPort) : "");
URI requestURIObj = new URI(requestURI);
String ipAddr = HttpUtils.getIpAddress();
String ipAddr = requestURIObj.getHost();
int requestPort = requestURIObj.getPort();
String newAddr = ipAddr + (requestPort != -1 ? ":" + Integer.toString(requestPort) : "");
return wsdlURI.replace(wsdlAddr, newAddr);

View file

@ -35,7 +35,6 @@ import javax.xml.namespace.QName;
import junit.framework.TestCase;
import org.apache.axis2.transport.http.server.HttpUtils;
import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
@ -69,8 +68,7 @@ public class QuestionMarkWSDLImportTestCase extends TestCase {
Port port = service.getPort("AccountSoapPort");
String endpoint = getEndpoint(port);
String ip = HttpUtils.getIpAddress();
assertEquals("http://" + ip + ":8086/AccountService", endpoint);
assertEquals("http://localhost:8086/AccountService", endpoint);
}
private String getEndpoint(Port port) {

View file

@ -35,17 +35,14 @@ import javax.xml.namespace.QName;
import junit.framework.TestCase;
import org.apache.axis2.transport.http.server.HttpUtils;
import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
* Test ?wsdl works and that the returned WSDL has the correct endpoint
*
* ********* Currently broken, see TUSCANY-2942
*
* @version $Rev: 660340 $ $Date: 2008-05-27 01:08:32 +0100 (Tue, 27 May 2008) $
*/
public class QuestionMarkWSDLIncludeTestCaseFIXME extends TestCase {
public class QuestionMarkWSDLIncludeTestCase extends TestCase {
private SCADomain domain;
@ -71,8 +68,7 @@ public class QuestionMarkWSDLIncludeTestCaseFIXME extends TestCase {
Port port = service.getPort("AccountSoapPort");
String endpoint = getEndpoint(port);
String ip = HttpUtils.getIpAddress();
assertEquals("http://" + ip + ":8085/AccountService", endpoint);
assertEquals("http://localhost:8085/AccountService", endpoint);
}
private String getEndpoint(Port port) {

View file

@ -35,7 +35,6 @@ import javax.xml.namespace.QName;
import junit.framework.TestCase;
import org.apache.axis2.transport.http.server.HttpUtils;
import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
@ -70,8 +69,7 @@ public class QuestionMarkWSDLTestCase extends TestCase {
Port port = service.getPort("HelloWorldSoapPort");
String endpoint = getEndpoint(port);
String ip = HttpUtils.getIpAddress();
assertEquals("http://" + ip + ":8085/services/HelloWorldWebService", endpoint);
assertEquals("http://localhost:8085/services/HelloWorldWebService", endpoint);
}
/**
@ -97,8 +95,7 @@ public class QuestionMarkWSDLTestCase extends TestCase {
Port port = service.getPort("HelloWorldPort");
String endpoint = getEndpoint(port);
String ip = HttpUtils.getIpAddress();
assertEquals("http://" + ip + ":8085/foo/bar", endpoint);
assertEquals("http://localhost:8085/foo/bar", endpoint);
}
protected String getEndpoint(Port port) {

View file

@ -32,7 +32,6 @@ import javax.xml.namespace.QName;
import junit.framework.TestCase;
import org.apache.axis2.transport.http.server.HttpUtils;
import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
@ -61,8 +60,7 @@ public class QuestionMarkWSDLTestCase extends TestCase {
Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
String endpoint = getSOAP11Endpoint(port);
String ip = HttpUtils.getIpAddress();
assertEquals("http://" + ip + ":8085/ep1", endpoint);
assertEquals("http://localhost:8085/ep1", endpoint);
}
/**
@ -81,8 +79,7 @@ public class QuestionMarkWSDLTestCase extends TestCase {
Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
String endpoint = getSOAP11Endpoint(port);
String ip = HttpUtils.getIpAddress();
assertEquals("http://" + ip + ":8085/ep2", endpoint);
assertEquals("http://localhost:8085/ep2", endpoint);
}
/**
@ -101,8 +98,7 @@ public class QuestionMarkWSDLTestCase extends TestCase {
Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP12port_http");
String endpoint = getSOAP12Endpoint(port);
String ip = HttpUtils.getIpAddress();
assertEquals("http://" + ip + ":8085/ep3", endpoint);
assertEquals("http://localhost:8085/ep3", endpoint);
}
protected String getSOAP11Endpoint(Port port) {