axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r359540 - in /webservices/axis2/trunk/java/modules/core: src/org/apache/axis2/deployment/ src/org/apache/axis2/description/ test-resources/wsdl/ test/org/apache/axis2/deployment/
Date Wed, 28 Dec 2005 15:02:16 GMT
Author: sanka
Date: Wed Dec 28 07:02:03 2005
New Revision: 359540

URL: http://svn.apache.org/viewcvs?rev=359540&view=rev
Log:
Fixed: Schema Element is not set properly in the AxisMessage.
Added: test1.wsdl, more comprehensvie wsdl document for testing.
Modified: AxisService not to use PolicyUtil until a testcase is added to test
its functionality

Added:
    webservices/axis2/trunk/java/modules/core/test-resources/wsdl/
    webservices/axis2/trunk/java/modules/core/test-resources/wsdl/test1.wsdl
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java?rev=359540&r1=359539&r2=359540&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
Wed Dec 28 07:02:03 2005
@@ -160,9 +160,11 @@
                 AxisOperation axisOperation = AxisOperationFactory
                         .getAxisOperation(getMessageExchangePattern(bindingOperation));
 
+                // setting parent
+                axisOperation.setParent(axisService);
                 // setting operation name
                 axisOperation.setName(new QName(operation.getName()));
-
+                
                 // Input
                 Input input = operation.getInput();
                 AxisMessage inAxisMsg = axisOperation
@@ -179,7 +181,11 @@
                     // axisService.addSchema(getXmlSchema(wrapper));
 
                 } else {
-                    inAxisMsg.setElementQName(inMsg.getQName());
+                    Iterator parts = inMsg.getParts().values().iterator();
+                    Part part = (Part) parts.next();
+                    QName qname = part.getElementName();
+                    inAxisMsg.setElementQName(qname);
+                    
                 }
 
                 // Output
@@ -200,7 +206,10 @@
                         // axisService.addSchema(getXmlSchema(wrapper));
 
                     } else {
-                        outAxisMsg.setElementQName(outMsg.getQName());
+                        Iterator parts = outMsg.getParts().values().iterator();
+                        Part part = (Part) parts.next();
+                        QName qname = part.getElementName();
+                        outAxisMsg.setElementQName(qname);
                     }
                 }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=359540&r1=359539&r2=359540&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
Wed Dec 28 07:02:03 2005
@@ -350,7 +350,7 @@
             WSDLDescription desc = axisService2WOM.generateWOM();
             
             // populate it with policy information ..
-            PolicyUtil.populatePolicy(desc, this);
+            //PolicyUtil.populatePolicy(desc, this);
             
             WOMWriter womWriter = WOMWriterFactory.createWriter(org.apache.wsdl.WSDLConstants.WSDL_1_1);
             womWriter.setdefaultWSDLPrefix("wsdl");

Added: webservices/axis2/trunk/java/modules/core/test-resources/wsdl/test1.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test-resources/wsdl/test1.wsdl?rev=359540&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test-resources/wsdl/test1.wsdl (added)
+++ webservices/axis2/trunk/java/modules/core/test-resources/wsdl/test1.wsdl Wed Dec 28 07:02:03
2005
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- 
+
+The original wsdl document was taken from: "http://wsi.alphaworks.ibm.com:8080/wspolicy/interop2.jsp"
+
+-->
+<wsdl:definitions 
+    targetNamespace="http://ws-policy.tests" 
+    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"

+    xmlns:intf="http://ws-policy.tests" 
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:apachesoap="http://xml.apache.org/xml-soap" 
+    xmlns="http://schemas.xmlsoap.org/wsdl" 
+    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+	<wsp:UsingPolicy wsdl:Required="true" />
+	<!--
+		Dummy Assertion scattered throughout as a "spoiler", i.e. the marker value of 9 
+		should NEVER appear in any of the Effective Policies calculated.
+	-->
+	<wsp:Policy wsu:Id="Dummy1-9">
+		<intf:PolicyTestAssertion1 marker="9" />
+	</wsp:Policy>
+
+	<!--
+		Message level assertions.  
+	-->
+	<wsp:Policy wsu:Id="Message1-6">
+		<intf:MessagePolicyTestAssertion1 marker="6" />
+	</wsp:Policy>
+	<wsp:Policy wsu:Id="Message2-7">
+		<intf:MessagePolicyTestAssertion2 marker="7" />
+	</wsp:Policy>
+	<wsp:Policy wsu:Id="Message2-Aggregate">
+		<intf:MessagePolicyTestAssertion2 marker="8" />
+		<wsp:PolicyReference URI="#Message2-7" />
+	</wsp:Policy>
+
+	<!--
+		Operation level assertions.  
+	-->
+	<wsp:Policy wsu:Id="Operation1-6">
+		<intf:OperationPolicyTestAssertion1 marker="6" />
+	</wsp:Policy>
+
+	<wsp:Policy wsu:Id="Operation2-7">
+		<intf:OperationPolicyTestAssertion2 marker="7" />
+	</wsp:Policy>
+	<wsp:Policy wsu:Id="Operation2-Aggregate">
+		<intf:OperationPolicyTestAssertion2 marker="8" />
+		<wsp:PolicyReference URI="#Operation2-7" />
+	</wsp:Policy>
+
+	<!--
+		Endpoint level assertions.  
+	-->
+	<wsp:Policy wsu:Id="Endpoint2-7">
+		<intf:EndpointPolicyTestAssertion2 marker="7" />
+	</wsp:Policy>
+
+	<wsp:Policy wsu:Id="Endpoint2-Aggregate">
+		<intf:EndpointPolicyTestAssertion2 marker="8" />
+		<wsp:PolicyReference URI="#Endpoint2-7" />
+	</wsp:Policy>
+
+	<!--
+		Service level assertions.  
+	-->
+	<wsp:Policy wsu:Id="Service1-6">
+		<intf:ServicePolicyTestAssertion1 marker="6" />
+	</wsp:Policy>
+	<wsp:Policy wsu:Id="Service2-7">
+		<intf:ServicePolicyTestAssertion2 marker="7" />
+	</wsp:Policy>
+	<wsp:Policy wsu:Id="Service2-Aggregate">
+		<intf:ServicePolicyTestAssertion2 marker="8" />
+		<wsp:PolicyReference URI="#Service2-7" />
+	</wsp:Policy>
+
+	<wsdl:types>
+		<schema elementFormDefault="qualified" targetNamespace="http://ws-policy.tests" xmlns="http://www.w3.org/2001/XMLSchema">
+			<element name="SimpleRequest">
+				<complexType>
+					<sequence>
+						<element name="request" nillable="true" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+			<element name="SimpleResponse">
+				<complexType>
+					<sequence>
+						<element name="response" nillable="true" type="xsd:string" />
+					</sequence>
+				</complexType>
+			</element>
+		</schema>
+	</wsdl:types>
+	
+	<wsdl:message name="MyRequestMessage">	
+		<wsp:PolicyReference URI="#Message2-Aggregate" />				
+		<wsdl:part name="parameters" element="intf:SimpleRequest" />
+	</wsdl:message>
+	
+	<wsdl:message name="MyResponseMessage">
+		<wsp:PolicyReference URI="#Message2-Aggregate" />				
+		<wsdl:part name="parameters" element="intf:SimpleResponse" />
+	</wsdl:message>
+	
+	<wsdl:message name="MyFaultMessage">
+		<wsp:PolicyReference URI="#Message2-Aggregate"/>				
+		<wsdl:part name="parameters" element="intf:SimpleFault" />
+	</wsdl:message>
+	<wsdl:portType name="MyPortType" wsp:PolicyURIs="#Endpoint2-Aggregate">
+		<wsdl:operation name="MyOperation">
+			<wsp:Policy>
+                                <wsp:PolicyReference URI="Operation2-Aggregate"/>
+				<wsp:PolicyReference URI="#Operation1-6"/>	
+			</wsp:Policy>
+			<wsdl:input name="MyInput" message="intf:MyRequestMessage" wsp:PolicyURIs="#Message1-6"
/>
+			<wsdl:output name="MyOutput" message="intf:MyResponseMessage" wsp:PolicyURIs="#Message1-6"
/>
+			<wsdl:fault name="MyFault" message="intf:MyFaultMessage" wsp:PolicyURIs="#Message1-6"
/>
+		</wsdl:operation>
+	</wsdl:portType>
+
+	<wsdl:binding name="MyBinding" type="intf:MyPortType">
+		<wsp:Policy wsu:Id="Endpoint1-6">
+			<intf:EndpointPolicyTestAssertion1 marker="6" />
+		</wsp:Policy>
+		<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"
/>
+		<wsdl:operation name="MyOperation">
+			<wsp:Policy>
+				<wsp:ExactlyOne>
+					<intf:OperationPolicyTestAssertion1 marker="3" />
+					<intf:OperationPolicyTestAssertion2 marker="3" />
+				</wsp:ExactlyOne>
+			</wsp:Policy>
+
+			<wsdlsoap:operation soapAction="" />
+			<wsdl:input name="MyInput">
+				<wsp:Policy>
+					<wsp:ExactlyOne>
+						<intf:MessagePolicyTestAssertion1 marker="2" />
+						<intf:MessagePolicyTestAssertion2 marker="2" />
+					</wsp:ExactlyOne>
+				</wsp:Policy>
+				<wsdlsoap:body use="literal" />
+			</wsdl:input>
+			<wsdl:output name="MyOutput">
+				<wsp:Policy>
+					<wsp:ExactlyOne>
+						<intf:MessagePolicyTestAssertion1 marker="1" />
+						<intf:MessagePolicyTestAssertion2 marker="1" />
+					</wsp:ExactlyOne>
+				</wsp:Policy>
+				<wsdlsoap:body use="literal" />
+			</wsdl:output>
+			<wsdl:fault name="MyFault">
+				<wsp:Policy>
+					<wsp:ExactlyOne>
+						<intf:MessagePolicyTestAssertion1 marker="0" />
+						<intf:MessagePolicyTestAssertion2 marker="0" />
+					</wsp:ExactlyOne>
+				</wsp:Policy>
+				<wsdlsoap:body use="literal" />
+			</wsdl:fault>
+		</wsdl:operation>
+	</wsdl:binding>
+
+	<wsdl:service name="MyService">
+		<wsp:Policy>
+			<wsp:ExactlyOne>
+				<intf:ServicePolicyTestAssertion1 marker="5" />
+				<intf:ServicePolicyTestAssertion2 marker="5" />
+			</wsp:ExactlyOne>
+			<wsp:PolicyReference URI="#Service1-6" />
+			<wsp:PolicyReference URI="#Service2-Aggregate" />
+		</wsp:Policy>
+
+		<wsdl:port name="MyPort" binding="intf:MyBinding">
+			<wsp:Policy>
+				<wsp:ExactlyOne>
+					<intf:EndpointPolicyTestAssertion1 marker="4" />
+					<intf:EndpointPolicyTestAssertion2 marker="4" />
+				</wsp:ExactlyOne>
+			</wsp:Policy>
+			<wsdlsoap:address location="http://localhost:9080/services/MyServiceMyPort" />
+		</wsdl:port>
+
+	</wsdl:service>		
+
+</wsdl:definitions>

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java?rev=359540&r1=359539&r2=359540&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java
(original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java
Wed Dec 28 07:02:03 2005
@@ -4,63 +4,70 @@
 
 import javax.xml.namespace.QName;
 
+import junit.framework.TestCase;
+
 import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.wsdl.WSDLConstants;
 
-import junit.framework.TestCase;
-
 /*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.
-*/
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
 
 /**
  * TestCase for AxisServiceBuilder.
  */
 public class AxisServiceBuilderTest extends TestCase {
-	private AxisServiceBuilder builder;
+    private AxisServiceBuilder builder;
 
-	public AxisServiceBuilderTest() {
-		super("AxisServiceBuilderTest");
-	}
-
-	protected void setUp() throws Exception {
-		builder = new AxisServiceBuilder();
-		super.setUp();
-	}
-
-	public void testAxisServiceBuilder() throws Exception {
-
-		assertNotNull(builder);
-
-		AxisService service = builder.getAxisService(new FileInputStream(
-				"./test-resources/PingService.wsdl"));
-
-		assertNotNull(service);
-		assertEquals(service.getName(), "PingService");
-		AxisOperation operation = service.getOperation(new QName("Ping"));
-		assertNotNull(operation);
-		AxisMessage inMessage = operation
-				.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-		assertNotNull(inMessage);
-		assertEquals("PingRequest", inMessage.getElementQName().getLocalPart());
-		AxisMessage outMessage = operation
-				.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
-		assertNotNull(outMessage);
-		assertEquals("PingResponse", outMessage.getElementQName()
-				.getLocalPart());
-	}
-}
\ No newline at end of file
+    public AxisServiceBuilderTest() {
+        super("AxisServiceBuilderTest");
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        builder = new AxisServiceBuilder();
+    }
+
+    public void test1() throws Exception {
+
+        AxisService service = builder.getAxisService(new FileInputStream(
+                "./test-resources/wsdl/test1.wsdl"));
+
+        assertNotNull(service);
+        assertEquals("MyService", service.getName());
+        
+
+        AxisOperation axisOperation = service.getOperation(new QName(
+                "MyOperation"));
+        assertNotNull(axisOperation);
+
+        assertEquals(WSDLConstants.MEP_URI_IN_OUT, axisOperation
+                .getMessageExchangePattern());
+
+        AxisMessage input = axisOperation
+                .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+        assertNotNull(input);
+        assertEquals(input.getElementQName(), new QName(
+                "http://ws-policy.tests", "SimpleRequest"));
+
+        AxisMessage output = axisOperation
+                .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+        assertNotNull(output);
+        assertEquals(output.getElementQName(), new QName("http://ws-policy.tests",
+                "SimpleResponse"));
+    }
+}



Mime
View raw message