You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ba...@apache.org on 2007/07/03 19:16:34 UTC
svn commit: r552921 - in /webservices/axis2/trunk/java/modules:
jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/
metadata/src/org/apache/axis2/jaxws/description/
metadata/src/org/apache/axis2/jaxws/description/impl/
metadata/test-resources/wsdl/ m...
Author: barrettj
Date: Tue Jul 3 10:16:32 2007
New Revision: 552921
URL: http://svn.apache.org/viewvc?view=rev&rev=552921
Log:
AXIS2-2888
Contributed by Dustin Amrhein. When constructing the operation QName, the RPCLitMethodMarshaller should first consult the binding operation element to determine if there is a namespace specified
Added:
webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespace.wsdl
webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/OperationDescriptionTests.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java?view=diff&rev=552921&r1=552920&r2=552921
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java Tue Jul 3 10:16:32 2007
@@ -112,7 +112,7 @@
// Indicate the style and operation element name. This triggers the message to
// put the data blocks underneath the operation element
m.setStyle(Style.RPC);
- m.setOperationElement(getRPCOperationQName(operationDesc));
+ m.setOperationElement(getRPCOperationQName(operationDesc, true));
// The input object represent the signature arguments.
// Signature arguments are both holders and non-holders
@@ -276,7 +276,7 @@
m.setStyle(Style.RPC);
- QName rpcOpQName = getRPCOperationQName(operationDesc);
+ QName rpcOpQName = getRPCOperationQName(operationDesc, false);
String localPart = rpcOpQName.getLocalPart() + "Response";
QName responseOp =
new QName(rpcOpQName.getNamespaceURI(), localPart, rpcOpQName.getPrefix());
@@ -520,13 +520,18 @@
* @param opDesc
* @return qualified qname to use in the rpc message to represent the operation (per WSI BP)
*/
- private static QName getRPCOperationQName(OperationDescription opDesc) {
+ private static QName getRPCOperationQName(OperationDescription opDesc, boolean isRequest) {
QName qName = opDesc.getName();
String localPart = qName.getLocalPart();
- String uri = (qName.getNamespaceURI().length() == 0) ?
- opDesc.getEndpointInterfaceDescription().getTargetNamespace() :
- qName.getNamespaceURI();
+ String uri = null;
+
+ if (isRequest) {
+ uri = opDesc.getBindingInputNamespace();
+ } else {
+ uri = opDesc.getBindingOutputNamespace();
+ }
+
String prefix = "rpcOp"; // Prefer using an actual prefix
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java?view=diff&rev=552921&r1=552920&r2=552921
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java Tue Jul 3 10:16:32 2007
@@ -206,4 +206,15 @@
* @return OperationDescription corresponding to the sync operation, or null (see note above).
*/
public OperationDescription getSyncOperation();
+
+ /**
+ * Returns the namespace of binding input message for the operation
+ */
+ public String getBindingInputNamespace();
+
+ /**
+ * Returns the namespace of binding output message for the operation
+ */
+ public String getBindingOutputNamespace();
+
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?view=diff&rev=552921&r1=552920&r2=552921
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java Tue Jul 3 10:16:32 2007
@@ -18,9 +18,10 @@
*/
package org.apache.axis2.jaxws.description.impl;
+import static org.apache.axis2.jaxws.description.builder.MDQConstants.CONSTRUCTOR_METHOD;
+
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
-import static org.apache.axis2.jaxws.description.builder.MDQConstants.CONSTRUCTOR_METHOD;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.WebMethodAnnot;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
@@ -28,11 +29,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap12.SOAP12Body;
+import javax.wsdl.extensions.soap12.SOAP12Header;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
-import javax.xml.ws.Response;
+
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
@@ -42,8 +47,8 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.StringTokenizer;
-import java.util.concurrent.Future;
/** Utilities used throughout the Description package. */
public class DescriptionUtils {
@@ -361,4 +366,44 @@
"EndpointDescriptionImpl: loadHandlerList: thrown when attempting to unmarshall JAXB content");
}
}
+
+
+ /**
+ * This method will loop through a list of extensibility elements looking for one
+ * of four objects: SOAPBody, SOAP12Body, SOAPHeader, SOAP12Header. If any of these
+ * objects are found the namespace URI from this object will be returned.
+ */
+ public static String getNamespaceFromSOAPElement(List extElements) {
+ Iterator extIter = extElements.iterator();
+ while (extIter.hasNext()) {
+ Object extObj = extIter.next();
+ if (extObj instanceof SOAPBody) {
+ if (log.isDebugEnabled()) {
+ log.debug("Returning SOAPBody namespace: "
+ + ((SOAPBody) extObj).getNamespaceURI());
+ }
+ return ((SOAPBody) extObj).getNamespaceURI();
+ } else if (extObj instanceof SOAP12Body) {
+ if (log.isDebugEnabled()) {
+ log.debug("Returning SOAP12Body namespace: "
+ + ((SOAP12Body) extObj).getNamespaceURI());
+ }
+ return ((SOAP12Body) extObj).getNamespaceURI();
+ } else if (extObj instanceof SOAPHeader) {
+ if (log.isDebugEnabled()) {
+ log.debug("Returning SOAPHeader namespace: "
+ + ((SOAPHeader) extObj).getNamespaceURI());
+ }
+ return ((SOAPHeader) extObj).getNamespaceURI();
+ } else if (extObj instanceof SOAP12Header) {
+ if (log.isDebugEnabled()) {
+ log.debug("Returning SOAP12Header namespace: "
+ + ((SOAP12Header) extObj).getNamespaceURI());
+ }
+ return ((SOAP12Header) extObj).getNamespaceURI();
+ }
+ }
+ return null;
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?view=diff&rev=552921&r1=552920&r2=552921
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Tue Jul 3 10:16:32 2007
@@ -20,13 +20,11 @@
package org.apache.axis2.jaxws.description.impl;
-import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.wsdl.WSDL11ActionHelper;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisOperationFactory;
import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
@@ -42,7 +40,6 @@
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.OneWayAnnot;
import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
-import org.apache.axis2.jaxws.description.builder.WebParamAnnot;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -50,9 +47,14 @@
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
-import javax.jws.WebParam.Mode;
import javax.jws.WebResult;
+import javax.jws.WebParam.Mode;
import javax.jws.soap.SOAPBinding;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.extensions.AttributeExtensible;
import javax.xml.bind.annotation.XmlList;
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
@@ -60,6 +62,7 @@
import javax.xml.ws.Response;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.WebFault;
+
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
@@ -68,7 +71,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
@@ -1658,6 +1660,102 @@
public boolean isListType() {
return isListType;
+ }
+
+ /**
+ * This method will return the namespace for the BindingInput that this operation
+ * specifies. It will first look for a namespace on the WSDL Binding object and then
+ * default to the web service's target namespace.
+ */
+ public String getBindingInputNamespace() {
+ String tns = null;
+ Binding binding =
+ this.getEndpointInterfaceDescriptionImpl()
+ .getEndpointDescriptionImpl()
+ .getWSDLBinding();
+ if (binding != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found WSDL binding");
+ }
+ // this call does not support overloaded WSDL operations as it
+ // does not specify the name of the input and output messages
+ BindingOperation bindingOp =
+ binding.getBindingOperation(getOperationName(), null, null);
+ if (bindingOp != null && bindingOp.getBindingInput() != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found WSDL binding operation and input");
+ }
+ tns = getBindingNamespace(bindingOp.getBindingInput());
+ if (tns != null && log.isDebugEnabled()) {
+ log.debug("For operation: " + bindingOp.getName()
+ + " returning the following namespace for input message"
+ + " from WSDL: " + tns);
+ }
+ }
+ }
+ if (tns == null) {
+ tns = getEndpointInterfaceDescription().getTargetNamespace();
+ if (log.isDebugEnabled()) {
+ log.debug("For binding input returning @WebService.targetNamespace: " + tns);
+ }
+ }
+ return tns;
+ }
+
+ /**
+ * This method will return the namespace for the BindingOutput that this operation
+ * specifies. It will first look for a namespace on the WSDL Binding object and then
+ * default to the web service's target namespace.
+ */
+ public String getBindingOutputNamespace() {
+ String tns = null;
+ Binding binding =
+ this.getEndpointInterfaceDescriptionImpl()
+ .getEndpointDescriptionImpl()
+ .getWSDLBinding();
+ if (binding != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found WSDL binding");
+ }
+ // this call does not support overloaded WSDL operations as it
+ // does not specify the name of the input and output messages
+ BindingOperation bindingOp =
+ binding.getBindingOperation(getOperationName(), null, null);
+ if (bindingOp != null && bindingOp.getBindingOutput() != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found WSDL binding operation and output");
+ }
+ tns = getBindingNamespace(bindingOp.getBindingOutput());
+ if (tns != null && log.isDebugEnabled()) {
+ log.debug("For operation: " + bindingOp.getName()
+ + " returning the following namespace for output message"
+ + " from WSDL: " + tns);
+ }
+ }
+ }
+ if (tns == null) {
+ tns = getEndpointInterfaceDescription().getTargetNamespace();
+ if (log.isDebugEnabled()) {
+ log.debug("For binding output returning @WebService.targetNamespace: " + tns);
+ }
+ }
+ return tns;
+ }
+
+
+ /**
+ * This method will retrieve the namespace that is specified by the BindingInput or
+ * BindingOutput object.
+ */
+ private String getBindingNamespace(AttributeExtensible opInfo) {
+ if (opInfo instanceof BindingInput) {
+ BindingInput input = (BindingInput) opInfo;
+ return DescriptionUtils.getNamespaceFromSOAPElement(input.getExtensibilityElements());
+ } else if (opInfo instanceof BindingOutput) {
+ BindingOutput output = (BindingOutput) opInfo;
+ return DescriptionUtils.getNamespaceFromSOAPElement(output.getExtensibilityElements());
+ }
+ return null;
}
public String toString() {
Added: webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespace.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespace.wsdl?view=auto&rev=552921
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespace.wsdl (added)
+++ webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespace.wsdl Tue Jul 3 10:16:32 2007
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?> <definitions targetNamespace="http://nonanonymous.complextype.test.org" xmlns:tns="http://nonanonymous.complextype.test.org" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+<types>
+<xsd:schema targetNamespace="http://nonanonymous.complextype.test.org" xmlns:ts="http://nonanonymous.complextype.test.org/xsd" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <complexType name="echoMessage">
+ <sequence>
+ <element name="request" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="echoMessageResponse">
+ <sequence>
+ <element name="response" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <element name="echoMessage" type="tns:echoMessage"/>
+ <element name="echoMessageResponse" type="tns:echoMessageResponse"/>
+</xsd:schema>
+</types>
+
+<message name="echoMessage">
+<part name="message" element="tns:echoMessage"/>
+</message>
+
+<message name="echoMessageResponse">
+<part name="result" element="tns:echoMessageResponse"/>
+</message>
+
+<portType name="EchoMessagePortType">
+ <operation name="echoMessage">
+ <input message="tns:echoMessage" />
+ <output message="tns:echoMessageResponse" />
+ </operation>
+</portType>
+
+<binding name="EchoMessageBinding" type="tns:EchoMessagePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="echoMessage">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal" namespace="http://org.apache.binding.ns"/>
+ </input>
+ <output>
+ <soap:body use="literal" namespace="http://org.apache.binding.ns"/>
+ </output>
+ </operation>
+</binding>
+
+<service name="EchoMessageService">
+ <port binding="tns:EchoMessageBinding" name="EchoMessagePort">
+ <soap:address location="http://localhost:8080/EchoMessageService/EchoMessageService"/>
+ </port>
+</service>
+
+</definitions>
Added: webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl?view=auto&rev=552921
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl (added)
+++ webservices/axis2/trunk/java/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl Tue Jul 3 10:16:32 2007
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?> <definitions targetNamespace="http://nonanonymous.complextype.test.org" xmlns:tns="http://nonanonymous.complextype.test.org" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+<types>
+<xsd:schema targetNamespace="http://nonanonymous.complextype.test.org" xmlns:ts="http://nonanonymous.complextype.test.org/xsd" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <complexType name="echoMessage">
+ <sequence>
+ <element name="request" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="echoMessageResponse">
+ <sequence>
+ <element name="response" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <element name="echoMessage" type="tns:echoMessage"/>
+ <element name="echoMessageResponse" type="tns:echoMessageResponse"/>
+</xsd:schema>
+</types>
+
+<message name="echoMessage">
+<part name="message" element="tns:echoMessage"/>
+</message>
+
+<message name="echoMessageResponse">
+<part name="result" element="tns:echoMessageResponse"/>
+</message>
+
+<portType name="EchoMessagePortType">
+ <operation name="echoMessage">
+ <input message="tns:echoMessage" />
+ <output message="tns:echoMessageResponse" />
+ </operation>
+</portType>
+
+<binding name="EchoMessageBinding" type="tns:EchoMessagePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="echoMessage">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+</binding>
+
+<service name="EchoMessageService">
+ <port binding="tns:EchoMessageBinding" name="EchoMessagePort">
+ <soap:address location="http://localhost:8080/EchoMessageService/EchoMessageService"/>
+ </port>
+</service>
+
+</definitions>
Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/OperationDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/OperationDescriptionTests.java?view=auto&rev=552921
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/OperationDescriptionTests.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/OperationDescriptionTests.java Tue Jul 3 10:16:32 2007
@@ -0,0 +1,174 @@
+package org.apache.axis2.jaxws.description;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import javax.jws.WebService;
+import javax.wsdl.Definition;
+
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
+import org.apache.axis2.jaxws.description.builder.WebServiceAnnot;
+
+
+/**
+ * These tests are intended to test various aspects of the OperationDescription.
+ */
+
+public class OperationDescriptionTests extends TestCase {
+
+ /**
+ * This test will confirm that the getBindingInputNamespace and getBindingOutputNamespace
+ * methods of the OperationDescription function correctly.
+ *
+ */
+
+ public void testBindingNamespace() {
+ String wsdlRelativeLocation = "test-resources/wsdl/";
+ String wsdlFileName = "BindingNamespace.wsdl";
+ String targetNamespace = "http://nonanonymous.complextype.test.org";
+ String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
+
+ // Build up a DBC, including the WSDL Definition and the annotation information for
+ // the impl class.
+ DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
+
+ URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
+ Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
+ assertNotNull(wsdlDefn);
+
+ WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
+ assertNotNull(webServiceAnnot);
+ webServiceAnnot.setWsdlLocation(wsdlLocation);
+ webServiceAnnot.setTargetNamespace(targetNamespace);
+ webServiceAnnot.setServiceName("EchoMessageService");
+ webServiceAnnot.setPortName("EchoMessagePort");
+
+ MethodDescriptionComposite mdc = new MethodDescriptionComposite();
+ mdc.setMethodName("echoMessage");
+ mdc.setReturnType("java.lang.String");
+
+ ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
+ pdc1.setParameterType("java.lang.String");
+
+ mdc.addParameterDescriptionComposite(pdc1);
+
+ dbc.addMethodDescriptionComposite(mdc);
+ dbc.setWebServiceAnnot(webServiceAnnot);
+ dbc.setClassName(BindingNSImpl.class.getName());
+ dbc.setWsdlDefinition(wsdlDefn);
+ dbc.setwsdlURL(wsdlURL);
+
+ HashMap<String, DescriptionBuilderComposite> dbcMap =
+ new HashMap<String, DescriptionBuilderComposite>();
+ dbcMap.put(dbc.getClassName(), dbc);
+ List<ServiceDescription> serviceDescList =
+ DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
+ assertEquals(1, serviceDescList.size());
+ ServiceDescription sd = serviceDescList.get(0);
+ assertNotNull(sd);
+
+ EndpointDescription[] edArray = sd.getEndpointDescriptions();
+ assertNotNull(edArray);
+ assertEquals(1, edArray.length);
+ EndpointDescription ed = edArray[0];
+ assertNotNull(ed);
+
+ EndpointInterfaceDescription eid = ed.getEndpointInterfaceDescription();
+ assertNotNull(eid);
+
+ OperationDescription[] odArray = eid.getOperations();
+ assertNotNull(odArray);
+ assertEquals(1, odArray.length);
+ OperationDescription od = odArray[0];
+ assertNotNull(od);
+ assertEquals("http://org.apache.binding.ns", od.getBindingInputNamespace());
+ assertEquals("http://org.apache.binding.ns", od.getBindingOutputNamespace());
+
+ }
+
+
+ public void testBindingNamespaceDefaults() {
+ String wsdlRelativeLocation = "test-resources/wsdl/";
+ String wsdlFileName = "BindingNamespaceDefaults.wsdl";
+ String targetNamespace = "http://nonanonymous.complextype.test.org";
+ String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
+
+ // Build up a DBC, including the WSDL Definition and the annotation information for
+ // the impl class.
+ DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
+
+ URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
+ Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
+ assertNotNull(wsdlDefn);
+
+ WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
+ assertNotNull(webServiceAnnot);
+ webServiceAnnot.setWsdlLocation(wsdlLocation);
+ webServiceAnnot.setTargetNamespace(targetNamespace);
+ webServiceAnnot.setServiceName("EchoMessageService");
+ webServiceAnnot.setPortName("EchoMessagePort");
+
+ MethodDescriptionComposite mdc = new MethodDescriptionComposite();
+ mdc.setMethodName("echoMessage");
+ mdc.setReturnType("java.lang.String");
+
+ ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
+ pdc1.setParameterType("java.lang.String");
+
+ mdc.addParameterDescriptionComposite(pdc1);
+
+ dbc.addMethodDescriptionComposite(mdc);
+ dbc.setWebServiceAnnot(webServiceAnnot);
+ dbc.setClassName(BindingNSImpl.class.getName());
+ dbc.setWsdlDefinition(wsdlDefn);
+ dbc.setwsdlURL(wsdlURL);
+ HashMap<String, DescriptionBuilderComposite> dbcMap =
+ new HashMap<String, DescriptionBuilderComposite>();
+ dbcMap.put(dbc.getClassName(), dbc);
+ List<ServiceDescription> serviceDescList =
+ DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
+ assertEquals(1, serviceDescList.size());
+ ServiceDescription sd = serviceDescList.get(0);
+ assertNotNull(sd);
+
+ EndpointDescription[] edArray = sd.getEndpointDescriptions();
+ assertNotNull(edArray);
+ assertEquals(1, edArray.length);
+ EndpointDescription ed = edArray[0];
+ assertNotNull(ed);
+
+ EndpointInterfaceDescription eid = ed.getEndpointInterfaceDescription();
+ assertNotNull(eid);
+
+ OperationDescription[] odArray = eid.getOperations();
+ assertNotNull(odArray);
+ assertEquals(1, odArray.length);
+ OperationDescription od = odArray[0];
+ assertNotNull(od);
+ assertEquals("http://nonanonymous.complextype.test.org", od.getBindingInputNamespace());
+ assertEquals("http://nonanonymous.complextype.test.org", od.getBindingOutputNamespace());
+
+ }
+
+
+ @WebService(serviceName = "EchoMessageService", portName = "EchoMessagePort", targetNamespace = "http://nonanonymous.complextype.test.org", wsdlLocation = "test-resources/wsdl/BindingNamespace.wsdl")
+ public class BindingNSImpl {
+ public String echoMessage(String arg) {
+ return arg;
+ }
+ }
+
+
+ @WebService(serviceName = "EchoMessageService", portName = "EchoMessagePort", targetNamespace = "http://nonanonymous.complextype.test.org", wsdlLocation = "test-resources/wsdl/BindingNamespaceDefaults.wsdl")
+ public class BindingNSDefaultsImpl {
+ public String echoMessage(String arg) {
+ return arg;
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org