Author: pradine Date: Wed Feb 6 06:11:20 2008 New Revision: 618994 URL: http://svn.apache.org/viewvc?rev=618994&view=rev Log: Improve addressing support in JAX-WS.
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java?rev=618994&r1=618993&r2=618994&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java (original) +++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java Wed Feb 6 06:11:20 2008 @@ -22,7 +22,6 @@ import java.io.ByteArrayOutputStream; import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; @@ -30,7 +29,6 @@ import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; -import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.EndpointReferenceHelper; import org.apache.axis2.addressing.metadata.InterfaceName; @@ -59,10 +57,10 @@ * @param axis2EPR * @param addressingNamespace * @return - * @throws AxisFault + * @throws Exception */ public static javax.xml.ws.EndpointReference convertFromAxis2(EndpointReference axis2EPR, String addressingNamespace) - throws AxisFault, Exception { + throws Exception { QName qname = new QName(addressingNamespace, "EndpointReference", "wsa"); OMElement omElement = EndpointReferenceHelper.toOM(omFactory, axis2EPR, qname, addressingNamespace); @@ -80,10 +78,10 @@ * @param source * @param addressingNamespace * @return - * @throws AxisFault + * @throws Exception */ - public static javax.xml.ws.EndpointReference convertFromAxis2(Source source, String addressingNamespace) - throws AxisFault, Exception { + public static javax.xml.ws.EndpointReference convertFromSource(Source source, String addressingNamespace) + throws Exception { return jaxwsEPRFactory.createEndpointReference(source, addressingNamespace); } @@ -94,11 +92,10 @@ * @param axis2EPR * @param jaxwsEPR * @return - * @throws AxisFault - * @throws XMLStreamException + * @throws Exception */ public static String convertToAxis2(EndpointReference axis2EPR, javax.xml.ws.EndpointReference jaxwsEPR) - throws AxisFault, XMLStreamException { + throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); jaxwsEPR.writeTo(new StreamResult(baos)); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java?rev=618994&r1=618993&r2=618994&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java (original) +++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java Wed Feb 6 06:11:20 2008 @@ -24,7 +24,6 @@ import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.context.AbstractContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.description.AxisOperation; @@ -37,9 +36,7 @@ import org.apache.axis2.jaxws.client.async.PollingFuture; import org.apache.axis2.jaxws.core.InvocationContext; import org.apache.axis2.jaxws.core.MessageContext; -import org.apache.axis2.jaxws.core.controller.InvocationController; import org.apache.axis2.jaxws.description.OperationDescription; -import org.apache.axis2.jaxws.handler.MEPContext; import org.apache.axis2.jaxws.i18n.Messages; import org.apache.axis2.jaxws.message.Message; import org.apache.axis2.jaxws.message.factory.MessageFactory; @@ -61,8 +58,6 @@ import javax.xml.ws.WebServiceException; import java.net.MalformedURLException; import java.net.URL; -import java.util.Iterator; -import java.util.Map; import java.util.concurrent.Future; /** @@ -385,13 +380,21 @@ org.apache.axis2.context.MessageContext axisRequest = requestMsgCtx.getAxisMessageContext(); setupProperties(requestMsgCtx);//, axisRequest.getOptions()); - Options options = opClient.getOptions(); if (opClient != null) { + Options options = opClient.getOptions(); + EndpointReference toEPR = null; + // Get the target endpoint address and setup the TO endpoint // reference. This tells us where the request is going. - String targetUrl = (String)requestMsgCtx.getProperty( - BindingProvider.ENDPOINT_ADDRESS_PROPERTY); - EndpointReference toEPR = new EndpointReference(targetUrl); + if (axisRequest.getTo() == null) { + String targetUrl = (String)requestMsgCtx.getProperty( + BindingProvider.ENDPOINT_ADDRESS_PROPERTY); + toEPR = new EndpointReference(targetUrl); + } + else { + toEPR = axisRequest.getTo(); + } + options.setTo(toEPR); // Get the SOAP Action (if needed) Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java?rev=618994&r1=618993&r2=618994&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java (original) +++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java Wed Feb 6 06:11:20 2008 @@ -18,7 +18,6 @@ */ package org.apache.axis2.jaxws.spi; -import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.jaxws.description.EndpointDescription; @@ -30,7 +29,7 @@ public ServiceDelegate getServiceDelegate(); - public EndpointReference getAxis2EndpointReference(String addressingNamespace) throws AxisFault; + public EndpointReference getAxis2EndpointReference(String addressingNamespace); public String getAddressingNamespace(); } Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java?rev=618994&r1=618993&r2=618994&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java (original) +++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java Wed Feb 6 06:11:20 2008 @@ -155,11 +155,9 @@ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); OMElement eprElement = (OMElement) XMLUtils.toOM(bais); - org.apache.axis2.addressing.EndpointReference axis2EPR = - EndpointReferenceUtils.createAxis2EndpointReference(""); - String addressingNamespace = EndpointReferenceHelper.fromOM(axis2EPR, eprElement); + String addressingNamespace = EndpointReferenceHelper.fromOM(null, eprElement); - jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(eprInfoset, addressingNamespace); + jaxwsEPR = EndpointReferenceUtils.convertFromSource(eprInfoset, addressingNamespace); } catch (Exception e) { //TODO NLS enable. Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java?rev=618994&r1=618993&r2=618994&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java Wed Feb 6 06:11:20 2008 @@ -75,11 +75,12 @@ /** * Populates an endpoint reference based on the <code>OMElement</code>. Returns the - * WS-Addressing namespace that the endpoint reference is in compliance with. + * WS-Addressing namespace of the endpoint reference. * - * @param epr an endpoint reference instance to hold the info. + * @param epr an endpoint reference instance to hold the info. If the endpoint + * reference is null then just the WS-Addressing namespace is returned. * @param eprOMElement an element of endpoint reference type - * @return a string representing the namespace of the endpoint reference. + * @return a string representing the WS-Addressing namespace of the endpoint reference. * @throws AxisFault if unable to locate an address element. */ public static String fromOM(EndpointReference epr, OMElement eprOMElement) @@ -118,7 +119,8 @@ } //Second pass, identify the properties. - fromOM(epr, eprOMElement, map, isFinalAddressingNamespace); + if (epr != null) + fromOM(epr, eprOMElement, map, isFinalAddressingNamespace); return ((QName) map.get(AddressingConstants.EPR_ADDRESS)).getNamespaceURI(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]