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 2006/11/06 21:27:20 UTC
svn commit: r471869 - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/description/
src/org/apache/axis2/jaxws/description/impl/ test-resources/wsdl/
test/org/apache/axis2/jaxws/description/
test/org/apache/axis2/jaxws/framework/
Author: barrettj
Date: Mon Nov 6 12:27:19 2006
New Revision: 471869
URL: http://svn.apache.org/viewvc?view=rev&rev=471869
Log:
Support for using annotations in the partial WSDL case.
Added:
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1.wsdl
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1_schema.xsd
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL2.wsdl
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/PartialWSDLTests.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescription.java Mon Nov 6 12:27:19 2006
@@ -72,6 +72,7 @@
public abstract String getBindingType();
public abstract List<String> getHandlerList();
public abstract QName getPortQName();
+ public abstract QName getServiceQName();
public abstract Service.Mode getServiceMode();
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointDescriptionWSDL.java Mon Nov 6 12:27:19 2006
@@ -22,5 +22,15 @@
*
*/
public interface EndpointDescriptionWSDL {
+
+ /**
+ * Is the WSDL definition fully specified for the endpoint (WSDL 1.1 port)
+ * represented by this EndpointDescription. If the WSDL is Partial, that means
+ * the Endpoint could not be created with the infomation contained in the WSDL file,
+ * and annotations were used.
+ *
+ * @return true if the WSDL was fully specified; false if it was partial WSDL
+ */
+ public boolean isWSDLFullySpecified();
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescriptionWSDL.java Mon Nov 6 12:27:19 2006
@@ -5,7 +5,6 @@
import org.apache.axis2.jaxws.util.WSDLWrapper;
public interface ServiceDescriptionWSDL {
-
// TODO: Remove these and replace with appropraite get* methods for WSDL information
public abstract WSDLWrapper getWSDLWrapper();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Mon Nov 6 12:27:19 2006
@@ -74,6 +74,9 @@
// Corresponds to a port that was added dynamically via addPort and is not declared (either in WSDL or annotations)
private boolean isDynamicPort;
+ // If the WSDL is fully specified, we could build the AxisService from the WSDL
+ private boolean isAxisServiceBuiltFromWSDL;
+
private String serviceImplName; //class name of the service impl or SEI
// Note that an EndpointInterfaceDescription will ONLY be set for an Endpoint-based implementation;
@@ -143,10 +146,10 @@
* @param theClass The SEI or Impl class. This will be NULL for Dispatch clients
* since they don't use an SEI
*/
- public EndpointDescriptionImpl(Class theClass, QName portName, ServiceDescriptionImpl parent) {
+ EndpointDescriptionImpl(Class theClass, QName portName, ServiceDescriptionImpl parent) {
this(theClass, portName, false, parent);
}
- public EndpointDescriptionImpl(Class theClass, QName portName, boolean dynamicPort, ServiceDescriptionImpl parent) {
+ EndpointDescriptionImpl(Class theClass, QName portName, boolean dynamicPort, ServiceDescriptionImpl parent) {
// TODO: This and the other constructor will (eventually) take the same args, so the logic needs to be combined
// TODO: If there is WSDL, could compare the namespace of the defn against the portQName.namespace
this.parentServiceDescription = parent;
@@ -193,7 +196,7 @@
* @param theClass The SEI or Impl class. This will be NULL for Dispatch clients
* since they don't use an SEI
*/
- public EndpointDescriptionImpl(ServiceDescriptionImpl parent, String serviceImplName) {
+ EndpointDescriptionImpl(ServiceDescriptionImpl parent, String serviceImplName) {
// TODO: This and the other constructor will (eventually) take the same args, so the logic needs to be combined
// TODO: If there is WSDL, could compare the namespace of the defn against the portQName.namespace
@@ -213,6 +216,8 @@
else
webServiceProviderAnnotation = composite.getWebServiceProviderAnnot();
+ // REVIEW: Maybe this should be an error if the name has already been set and it doesn't match
+ getServiceDescriptionImpl().setServiceQName(getServiceQName());
//Call the getter to insure the qualified port name is set.
getPortQName();
@@ -278,7 +283,7 @@
addToAxisService();
- buildEndpointDescriptionFromNoWSDL();
+ buildEndpointDescriptionFromAnnotations();
// The anonymous AxisOperations are currently NOT added here. The reason
// is that (for now) this is a SERVER-SIDE code path, and the anonymous operations
@@ -302,7 +307,7 @@
}
}
- private void buildEndpointDescriptionFromNoWSDL() {
+ private void buildEndpointDescriptionFromAnnotations() {
// TODO: The comments below are not quite correct; this method is used on BOTH the
// client and server. On the client the class is always an SEI. On the server it
// is always a service impl which may be a provider or endpoint based;
@@ -394,7 +399,8 @@
}
public QName getPortQName() {
- // TODO: (JLB) Implement WSDL/Annotation merge
+ // TODO: (JLB) Implement WSDL/Annotation merge? May be OK as is; not sure how would know WHICH port Qname to get out of the WSDL if
+ // we didn't use annotations.
if (portQName == null) {
// The name was not set by the constructors, so get it from the
// appropriate annotation.
@@ -407,6 +413,13 @@
return portQName;
}
+ public QName getServiceQName() {
+ // REVIEW: Does this need to be cached in an instance variable like the others?
+ String localPart = getAnnoWebServiceServiceName();
+ String tns = getAnnoWebServiceTargetNamespace();
+ return new QName(tns, localPart);
+ }
+
public ServiceDescription getServiceDescription() {
return parentServiceDescription;
}
@@ -459,10 +472,10 @@
// one that will be present in the WSDL. A null class passed in as the SEI indicates this
// is a dispatch client.
if (!isDynamicPort && getServiceDescriptionImpl().getWSDLWrapper() != null) {
- buildAxisServiceFromWSDL();
+ isAxisServiceBuiltFromWSDL = buildAxisServiceFromWSDL();
}
else {
- buildAxisServiceFromNoWSDL();
+ buildAxisServiceFromAnnotations();
}
if (axisService == null) {
@@ -502,11 +515,16 @@
// one that will be present in the WSDL. A null class passed in as the SEI indicates this
// is a dispatch client.
- if (getServiceDescriptionImpl().getWSDLWrapper() != null) {
- buildAxisServiceFromWSDL();
+ // If WSDL is present, it may be full or only partial. If we can create the AxisService from
+ // the WSDL, that WSDL is fully specified. Otherwise, it is "partial WSDL". In that case
+ // we use annotaions to build the AxisService
+ isAxisServiceBuiltFromWSDL = false;
+ if (getServiceDescriptionImpl().getWSDLWrapper() != null) {
+ isAxisServiceBuiltFromWSDL = buildAxisServiceFromWSDL();
}
- else {
- buildAxisServiceFromNoWSDL();
+
+ if (!isAxisServiceBuiltFromWSDL) {
+ buildAxisServiceFromAnnotations();
}
if (axisService == null) {
@@ -532,6 +550,7 @@
portParameter.setValue(getPortQName().getLocalPart());
//Save the WSDL Definition
+ // REVIEW: This could be a PARTIAL WSDL; not sure if that will cause trouble later on.
Parameter wsdlDefParameter = new Parameter();
wsdlDefParameter.setName(MDQConstants.WSDL_DEFINITION);
@@ -566,8 +585,8 @@
}
}
- private void buildAxisServiceFromWSDL() {
-
+ private boolean buildAxisServiceFromWSDL() {
+ boolean isBuiltFromWSDL = false;
try {
// TODO: Change this to use WSDLToAxisServiceBuilder superclass
@@ -588,13 +607,16 @@
axisService = serviceBuilder.populateService();
axisService.setName(createAxisServiceName());
+ isBuiltFromWSDL = true;
} catch (AxisFault e) {
// TODO We should not swallow a fault here.
log.warn(Messages.getMessage("warnAxisFault", e.toString()));
+ isBuiltFromWSDL = false;
}
+ return isBuiltFromWSDL;
}
- private void buildAxisServiceFromNoWSDL() {
+ private void buildAxisServiceFromAnnotations() {
// TODO: Refactor this to create from annotations.
String serviceName = null;
if (portQName != null) {
@@ -620,14 +642,14 @@
//TODO: When MDQ input is the only possible input, then we can remove the check for
// the DBC list, until that time the code in here may appear somewhat redundant
if (getServiceDescriptionImpl().isDBCMap()) {
- if (!isDynamicPort && getServiceDescriptionImpl().getWSDLWrapper() != null)
+ if (!isDynamicPort && isWSDLFullySpecified())
buildEndpointDescriptionFromWSDL();
else
- buildEndpointDescriptionFromNoWSDL();
+ buildEndpointDescriptionFromAnnotations();
} else {
//Still processing annotations from the class
-
- if (!isDynamicPort && getServiceDescriptionImpl().getWSDLWrapper() != null) {
+ // This path was not updated
+ if (!isDynamicPort && isWSDLFullySpecified()) {
buildEndpointDescriptionFromWSDL();
}
else if (implOrSEIClass != null){
@@ -635,7 +657,7 @@
// If there is no SEI class, then this is a Distpach case, and we currently
// don't create the rest of the description hierachy (since it is not an SEI and thus
// not operation-based client.
- buildEndpointDescriptionFromNoWSDL();
+ buildEndpointDescriptionFromAnnotations();
}
}
}
@@ -720,6 +742,10 @@
return getServiceDescription().getServiceQName().getLocalPart() + "." + portName;
}
+ public boolean isWSDLFullySpecified() {
+ return isAxisServiceBuiltFromWSDL;
+ }
+
public boolean isProviderBased() {
return webServiceProviderAnnotation != null;
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Mon Nov 6 12:27:19 2006
@@ -100,7 +100,6 @@
*/
EndpointInterfaceDescriptionImpl(EndpointDescriptionImpl parent) {
parentEndpointDescription = parent;
-
AxisService axisService = parentEndpointDescription.getAxisService();
if (axisService != null) {
ArrayList publishedOperations = axisService.getPublishedOperations();
@@ -561,7 +560,7 @@
//If this list is empty, then there are no false exclusions, so gather
//all composites that don't have exclude == true
- if (retrieveList == null) {
+ if (retrieveList == null || retrieveList.size() == 0) {
Iterator<MethodDescriptionComposite> iter = dbc.getMethodDescriptionsList().iterator();
while (iter.hasNext()) {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Mon Nov 6 12:27:19 2006
@@ -144,19 +144,10 @@
validateDBCLIntegrity();
// The ServiceQName instance variable is set based on annotation or default
+ // It will be set by the EndpointDescriptionImpl since it is the one that knows
+ // how to process the annotations and the defaults.
//TODO: When we get this, need to consider verifying service name between WSDL
// and annotations, so
- String targetNamespace;
- String serviceName;
- if(this.composite.getWebServiceAnnot() != null) {
- targetNamespace = this.composite.getWebServiceAnnot().targetNamespace();
- serviceName = this.composite.getWebServiceAnnot().serviceName();
- }
- else {
- targetNamespace = this.composite.getWebServiceProviderAnnot().targetNamespace();
- serviceName = this.composite.getWebServiceProviderAnnot().serviceName();
- }
- this.serviceQName = new QName(targetNamespace, serviceName);
// Create the EndpointDescription hierachy from the service impl annotations; Since the PortQName is null,
// it will be set to the annotation value.
@@ -462,6 +453,9 @@
//It is assumed that this will always be set in the constructor rather than
//built up from the class or DBC
return serviceQName;
+ }
+ void setServiceQName(QName theName) {
+ serviceQName = theName;
}
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1.wsdl?view=auto&rev=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1.wsdl Mon Nov 6 12:27:19 2006
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<definitions targetNamespace="http://serverPartial1.checkexception.webfault.annotations/" name="AddNumbersImplPartial1Service" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://serverPartial1.checkexception.webfault.annotations/" xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <xsd:schema>
+ <xsd:import namespace="http://serverPartial1.checkexception.webfault.annotations/" schemaLocation="PartialWSDL1_schema.xsd"/>
+ </xsd:schema>
+ </types>
+ <message name="addTwoNumbers">
+ <part name="parameters" element="tns:addTwoNumbers"/>
+ </message>
+ <message name="addTwoNumbersResponse">
+ <part name="parameters" element="tns:addTwoNumbersResponse"/>
+ </message>
+ <message name="AddNegativeNumbersException">
+ <part name="fault" element="tns:AddNegativeNumbersException"/>
+ </message>
+ <portType name="AddNumbersImplPartial1">
+ <operation name="addTwoNumbers">
+ <input message="tns:addTwoNumbers"/>
+ <output message="tns:addTwoNumbersResponse"/>
+ <fault name="AddNegativeNumbersException" message="tns:AddNegativeNumbersException"/>
+ </operation>
+ </portType>
+
+<!-- Partial WSDL 1: No binding, service, or port information
+ <binding name="AddNumbersImplPartial1PortBinding" type="tns:AddNumbersImplPartial1">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <operation name="addTwoNumbers">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ <fault name="AddNegativeNumbersException">
+ <soap:fault name="AddNegativeNumbersException" use="literal"/>
+ </fault>
+ </operation>
+ </binding>
+ <service name="AddNumbersImplPartial1Service">
+ <port name="AddNumbersImplPartial1Port" binding="tns:AddNumbersImplPartial1PortBinding">
+ <soap:address location="http://@REPLACE_WITH_HOST_NAME@:@REPLACE_WITH_PORT_NUM@/webfaultchkexc/webfaultchkexcp1"/>
+ </port>
+ </service>
+-->
+
+</definitions>
+
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1_schema.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1_schema.xsd?view=auto&rev=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1_schema.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL1_schema.xsd Mon Nov 6 12:27:19 2006
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema version="1.0" targetNamespace="http://serverPartial1.checkexception.webfault.annotations/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="AddNegativeNumbersException" nillable="true" type="xs:string"/>
+
+ <xs:element name="addTwoNumbers" type="ns1:addTwoNumbers" xmlns:ns1="http://serverPartial1.checkexception.webfault.annotations/"/>
+
+ <xs:complexType name="addTwoNumbers">
+ <xs:sequence>
+ <xs:element name="arg0" type="xs:int"/>
+ <xs:element name="arg1" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="addTwoNumbersResponse" type="ns2:addTwoNumbersResponse" xmlns:ns2="http://serverPartial1.checkexception.webfault.annotations/"/>
+
+ <xs:complexType name="addTwoNumbersResponse">
+ <xs:sequence>
+ <xs:element name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
+
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL2.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL2.wsdl?view=auto&rev=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL2.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/PartialWSDL2.wsdl Mon Nov 6 12:27:19 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<definitions targetNamespace="http://serverPartial1.checkexception.webfault.annotations/" name="AddNumbersImplPartial1Service" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://serverPartial1.checkexception.webfault.annotations/" xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <xsd:schema>
+ <xsd:import namespace="http://serverPartial1.checkexception.webfault.annotations/" schemaLocation="PartialWSDL1_schema.xsd"/>
+ </xsd:schema>
+ </types>
+
+<!-- Partial WSDL 2: Only types specified
+ <message name="addTwoNumbers">
+ <part name="parameters" element="tns:addTwoNumbers"/>
+ </message>
+ <message name="addTwoNumbersResponse">
+ <part name="parameters" element="tns:addTwoNumbersResponse"/>
+ </message>
+ <message name="AddNegativeNumbersException">
+ <part name="fault" element="tns:AddNegativeNumbersException"/>
+ </message>
+ <portType name="AddNumbersImplPartial1">
+ <operation name="addTwoNumbers">
+ <input message="tns:addTwoNumbers"/>
+ <output message="tns:addTwoNumbersResponse"/>
+ <fault name="AddNegativeNumbersException" message="tns:AddNegativeNumbersException"/>
+ </operation>
+ </portType>
+
+ <binding name="AddNumbersImplPartial1PortBinding" type="tns:AddNumbersImplPartial1">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <operation name="addTwoNumbers">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ <fault name="AddNegativeNumbersException">
+ <soap:fault name="AddNegativeNumbersException" use="literal"/>
+ </fault>
+ </operation>
+ </binding>
+ <service name="AddNumbersImplPartial1Service">
+ <port name="AddNumbersImplPartial1Port" binding="tns:AddNumbersImplPartial1PortBinding">
+ <soap:address location="http://@REPLACE_WITH_HOST_NAME@:@REPLACE_WITH_PORT_NUM@/webfaultchkexc/webfaultchkexcp1"/>
+ </port>
+ </service>
+-->
+
+</definitions>
+
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java Mon Nov 6 12:27:19 2006
@@ -22,6 +22,9 @@
import java.net.URL;
import javax.jws.WebParam.Mode;
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
import javax.xml.ws.Service;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
@@ -44,16 +47,35 @@
*/
static public URL getWSDLURL() {
+ return getWSDLURL("WSDLTests.wsdl");
+
+ }
+ static public URL getWSDLURL(String wsdlFileName) {
URL wsdlURL = null;
// Get the URL to the WSDL file. Note that 'basedir' is setup by Maven
String basedir = System.getProperty("basedir");
- String urlString = "file://localhost/" + basedir + "/test-resources/wsdl/WSDLTests.wsdl";
+ String urlString = "file://localhost/" + basedir + "/test-resources/wsdl/" + wsdlFileName;
try {
wsdlURL = new URL(urlString);
} catch (Exception e) {
System.out.println("Caught exception creating WSDL URL :" + urlString + "; exception: " + e.toString());
}
return wsdlURL;
+ }
+
+ static Definition createWSDLDefinition(URL wsdlURL) {
+ Definition wsdlDefinition = null;
+ try {
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ wsdlDefinition = reader.readWSDL(wsdlURL.toString());
+ }
+ catch (Exception e) {
+ System.out.println("*** ERROR ***: Caught exception trying to create WSDL Definition: " + e);
+ e.printStackTrace();
+ }
+
+ return wsdlDefinition;
}
static public ServiceDelegate getServiceDelegate(Service service) {
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/PartialWSDLTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/PartialWSDLTests.java?view=auto&rev=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/PartialWSDLTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/PartialWSDLTests.java Mon Nov 6 12:27:19 2006
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.description;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+
+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;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ */
+public class PartialWSDLTests extends TestCase {
+
+ /**
+ * Tests the binding, service, and port not specified in the WSDL.
+ *
+ * This test is based on the FVT test AddNumbersImplPartial1
+ *
+ */
+ public void testPartialWSDL1() {
+ String wsdlRelativeLocation = "test-resources/wsdl/";
+ String wsdlFileName = "PartialWSDL1.wsdl";
+
+ String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
+ 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);
+
+ MethodDescriptionComposite mdc = new MethodDescriptionComposite();
+ mdc.setMethodName("addTwoNumbers");
+ mdc.setReturnType("int");
+
+ ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
+ pdc1.setParameterType("int");
+ ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
+ pdc1.setParameterType("int");
+
+ mdc.addParameterDescriptionComposite(pdc1);
+ mdc.addParameterDescriptionComposite(pdc2);
+
+ dbc.addMethodDescriptionComposite(mdc);
+ dbc.setWebServiceAnnot(webServiceAnnot);
+ dbc.setClassName(AddNumbersImplPartial1.class.getName());
+ dbc.setWsdlDefinition(wsdlDefn);
+ dbc.setwsdlURL(wsdlURL);
+
+ HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
+ dbcMap.put(AddNumbersImplPartial1.class.getName(), 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];
+ }
+ /**
+ * Tests the binding, service, and port not specified in the WSDL.
+ *
+ * This test is based on the FVT test AddNumbersImplPartial2
+ *
+ */
+ public void testPartialWSDL2() {
+ String wsdlRelativeLocation = "test-resources/wsdl/";
+ String wsdlFileName = "PartialWSDL2.wsdl";
+
+ String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
+ 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);
+
+ MethodDescriptionComposite mdc = new MethodDescriptionComposite();
+ mdc.setMethodName("addTwoNumbers");
+ mdc.setReturnType("int");
+
+ ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
+ pdc1.setParameterType("int");
+ ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
+ pdc1.setParameterType("int");
+
+ mdc.addParameterDescriptionComposite(pdc1);
+ mdc.addParameterDescriptionComposite(pdc2);
+
+ dbc.addMethodDescriptionComposite(mdc);
+ dbc.setWebServiceAnnot(webServiceAnnot);
+ dbc.setClassName(AddNumbersImplPartial1.class.getName());
+ dbc.setWsdlDefinition(wsdlDefn);
+ dbc.setwsdlURL(wsdlURL);
+
+ HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
+ dbcMap.put(AddNumbersImplPartial1.class.getName(), 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];
+ }
+}
+
+@WebService(wsdlLocation = "test-resources/wsdl/PartialWSDL2.wsdl",
+ targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/")
+class AddNumbersImplPartial1 {
+ public int addTwoNumbers(int number1, int number2) {
+ return number1 + number2;
+ }
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=471869&r1=471868&r2=471869
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Mon Nov 6 12:27:19 2006
@@ -26,6 +26,7 @@
import org.apache.axis2.jaxws.description.AnnotationProviderImplDescriptionTests;
import org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests;
import org.apache.axis2.jaxws.description.AnnotationServiceImplWithDBCTests;
+import org.apache.axis2.jaxws.description.PartialWSDLTests;
import org.apache.axis2.jaxws.description.ServiceAnnotationTests;
import org.apache.axis2.jaxws.description.WSDLDescriptionTests;
import org.apache.axis2.jaxws.description.WSDLTests;
@@ -97,6 +98,7 @@
suite.addTestSuite(AnnotationServiceImplDescriptionTests.class);
suite.addTestSuite(AnnotationProviderImplDescriptionTests.class);
suite.addTestSuite(AnnotationServiceImplWithDBCTests.class);
+ suite.addTestSuite(PartialWSDLTests.class);
suite.addTestSuite(HandlerChainProcessorTests.class);
suite.addTestSuite(JaxwsMessageBundleTests.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org