Author: veithen
Date: Sun Nov 18 17:28:33 2012
New Revision: 1410937
URL: http://svn.apache.org/viewvc?rev=1410937&view=rev
Log:
Some initial changes.
Modified:
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Call.java
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Service.java
Modified:
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Call.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Call.java?rev=1410937&r1=1410936&r2=1410937&view=diff
==============================================================================
---
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Call.java
(original)
+++
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Call.java
Sun Nov 18 17:28:33 2012
@@ -82,6 +82,8 @@ import javax.xml.soap.SOAPMessage;
import java.io.StringWriter;
import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
@@ -332,17 +334,17 @@ public class Call implements javax.xml.r
/**
* Build a call from a URL string.
*
- * This is handy so that you don't have to manually call Call.initialize()
- * in order to register custom transports. In other words, whereas doing
- * a new URL("local:...") would fail, new Call("local:...") works because
- * we do the initialization of our own and any configured custom
protocols.
- *
* @param url the target endpoint URL
* @exception MalformedURLException
*/
public Call(String url) throws MalformedURLException {
this(new Service());
- setTargetEndpointAddress(new URL(url));
+ try {
+ setTargetEndpointAddress(new URI(url));
+ } catch (URISyntaxException ex) {
+ // The method used to use new URL(...). Need this to ensure source
code compatibility:
+ throw new MalformedURLException(ex.getMessage());
+ }
}
/**
@@ -803,31 +805,47 @@ public class Call implements javax.xml.r
* as URI
*/
public void setTargetEndpointAddress(String address) {
- URL urlAddress;
+ // Special case: Since Axis 1.4 used java.net.URL, it accepted
"<scheme>:" (e.g. "local:")
+ // as a valid URL. However this is not a valid URI. If we encounter
this case, we add a
+ // slash to make it a valid URI: "<scheme>:/".
+ if (address.indexOf(':') == address.length() - 1) {
+ address += '/';
+ }
try {
- urlAddress = new URL(address);
+ setTargetEndpointAddress(new URI(address));
}
- catch (MalformedURLException mue) {
+ catch (URISyntaxException mue) {
throw new JAXRPCException(mue);
}
- setTargetEndpointAddress(urlAddress);
}
/**
* Sets the URL of the target Web Service.
+ * <p>
+ * Note: Not part of JAX-RPC specification.
*
+ * @param address URL of the target Web Service
+ */
+ public void setTargetEndpointAddress(URL address) {
+ // Note: the URL#toURI method is not available in Java 1.4
+ setTargetEndpointAddress(address == null ? null : address.toString());
+ }
+
+ /**
+ * Sets the URL of the target Web Service.
+ * <p>
* Note: Not part of JAX-RPC specification.
*
* @param address URL of the target Web Service
*/
- public void setTargetEndpointAddress(java.net.URL address) {
+ public void setTargetEndpointAddress(URI address) {
try {
if ( address == null ) {
setTransport(null);
return ;
}
- String protocol = address.getProtocol();
+ String protocol = address.getScheme();
// Handle the case where the protocol is the same but we
// just want to change the URL - if so just set the URL,
@@ -840,8 +858,8 @@ public class Call implements javax.xml.r
if ( this.transport != null ) {
String oldAddr = this.transport.getUrl();
if ( oldAddr != null && !oldAddr.equals("") ) {
- URL tmpURL = new URL( oldAddr );
- String oldProto = tmpURL.getProtocol();
+ URI tmpURL = new URI( oldAddr );
+ String oldProto = tmpURL.getScheme();
if ( protocol.equals(oldProto) ) {
this.transport.setUrl( address.toString() );
return ;
@@ -1623,7 +1641,7 @@ public class Call implements javax.xml.r
}
// we reinitialize target endpoint only if we have wsdl
- this.setTargetEndpointAddress( (URL) null );
+ this.setTargetEndpointAddress( (URI) null );
Port port = wsdlService.getPort( portName.getLocalPart() );
if ( port == null ) {
@@ -1639,8 +1657,7 @@ public class Call implements javax.xml.r
if ( obj instanceof SOAPAddress ) {
try {
SOAPAddress addr = (SOAPAddress) obj ;
- URL url = new URL(addr.getLocationURI());
- this.setTargetEndpointAddress(url);
+ this.setTargetEndpointAddress(new
URI(addr.getLocationURI()));
}
catch(Exception exp) {
throw new JAXRPCException(
Modified:
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Service.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Service.java?rev=1410937&r1=1410936&r2=1410937&view=diff
==============================================================================
---
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Service.java
(original)
+++
axis/axis1/java/branches/AXIS-2882/axis-rt-core/src/main/java/org/apache/axis/client/Service.java
Sun Nov 18 17:28:33 2012
@@ -47,6 +47,7 @@ import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URL;
import java.rmi.Remote;
import java.util.HashMap;
@@ -439,7 +440,7 @@ public class Service implements javax.xm
if (portName == null) {
call = (org.apache.axis.client.Call) createCall();
if (endpoint != null) {
- call.setTargetEndpointAddress(new URL(endpoint));
+ call.setTargetEndpointAddress(new URI(endpoint));
}
} else {
call = (org.apache.axis.client.Call) createCall(portName);
@@ -494,8 +495,7 @@ public class Service implements javax.xm
if (obj instanceof SOAPAddress) {
try {
SOAPAddress addr = (SOAPAddress) obj;
- URL url = new URL(addr.getLocationURI());
- call.setTargetEndpointAddress(url);
+ call.setTargetEndpointAddress(new
URI(addr.getLocationURI()));
} catch (Exception exp) {
throw new ServiceException(
Messages.getMessage("cantSetURI00", "" + exp));
@@ -871,14 +871,14 @@ public class Service implements javax.xm
/**
* Register a Transport for a particular URL.
*/
- void registerTransportForURL(URL url, Transport transport) {
+ void registerTransportForURL(URI url, Transport transport) {
transportImpls.put(url.toString(), transport);
}
/**
* Get any registered Transport object for a given URL.
*/
- Transport getTransportForURL(URL url) {
+ Transport getTransportForURL(URI url) {
return (Transport) transportImpls.get(url.toString());
}