You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2006/09/28 08:33:24 UTC
svn commit: r450718 - in /incubator/cxf/trunk/rt/core/src:
main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl
Author: ningjiang
Date: Wed Sep 27 23:33:23 2006
New Revision: 450718
URL: http://svn.apache.org/viewvc?view=rev&rev=450718
Log:
[CXF-118] applied the Balaji's patch, and add a unit test
Added:
incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl (with props)
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=450718&r1=450717&r2=450718
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Wed Sep 27 23:33:23 2006
@@ -318,13 +318,18 @@
private void checkForWrapped(OperationInfo opInfo) {
MessageInfo inputMessage = opInfo.getInput();
MessageInfo outputMessage = opInfo.getOutput();
-
+
+ boolean passedRule = true;
// RULE No.1:
// The operation's input and output message (if present) each contain
// only a single part
// input message must exist
if (inputMessage == null || inputMessage.size() != 1
|| (outputMessage != null && outputMessage.size() > 1)) {
+ passedRule = false;
+ }
+
+ if (!passedRule) {
return;
}
@@ -339,14 +344,18 @@
// is equal to the operation name
MessagePartInfo inputPart = inputMessage.getMessagePartByIndex(0);
if (!inputPart.isElement()) {
- return;
+ passedRule = false;
} else {
QName inputElementName = inputPart.getElementQName();
inputEl = schemas.getElementByQName(inputElementName);
if (inputEl == null || !opInfo.getName().getLocalPart().equals(inputElementName.getLocalPart())) {
- return;
+ passedRule = false;
}
}
+
+ if (!passedRule) {
+ return;
+ }
// RULE No.3:
// The output message part refers to a global element declaration
@@ -356,11 +365,16 @@
if (outputPart != null) {
if (!outputPart.isElement()
|| schemas.getElementByQName(outputPart.getElementQName()) == null) {
- return;
+ passedRule = false;
+ } else {
+ outputEl = schemas.getElementByQName(outputPart.getElementQName());
}
- outputEl = schemas.getElementByQName(outputPart.getElementQName());
}
}
+
+ if (!passedRule) {
+ return;
+ }
// RULE No.4 and No5:
// wrapper element should be pure complex type
@@ -374,18 +388,31 @@
if (inputEl.getSchemaType() instanceof XmlSchemaComplexType) {
xsct = (XmlSchemaComplexType)inputEl.getSchemaType();
if (hasAttributes(xsct) || !isWrappableSequence(xsct, unwrappedInput)) {
- return;
+ passedRule = false;
}
+ } else {
+ passedRule = false;
+ }
+
+ if (!passedRule) {
+ return;
}
+
if (outputMessage != null) {
unwrappedOutput = new MessageInfo(opInfo, outputMessage.getName());
if (outputEl != null && outputEl.getSchemaType() instanceof XmlSchemaComplexType) {
xsct = (XmlSchemaComplexType)outputEl.getSchemaType();
if (hasAttributes(xsct) || !isWrappableSequence(xsct, unwrappedOutput)) {
- return;
+ passedRule = false;
}
+ } else {
+ passedRule = false;
}
+ }
+
+ if (!passedRule) {
+ return;
}
// we are wrappable!!
Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java?view=diff&rev=450718&r1=450717&r2=450718
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java Wed Sep 27 23:33:23 2006
@@ -50,6 +50,7 @@
private static final Logger LOG = Logger.getLogger(WSDLServiceBuilderTest.class.getName());
private static final String WSDL_PATH = "hello_world.wsdl";
+ private static final String BARE_WSDL_PATH = "hello_world_bare.wsdl";
private Definition def;
private Service service;
private ServiceInfo serviceInfo;
@@ -59,8 +60,15 @@
private BindingFactoryManager bindingFactoryManager;
public void setUp() throws Exception {
+ setUpWSDL(WSDL_PATH);
+ }
- String wsdlUrl = getClass().getResource(WSDL_PATH).toString();
+ public void tearDown() throws Exception {
+
+ }
+
+ private void setUpWSDL(String wsdl) throws Exception {
+ String wsdlUrl = getClass().getResource(wsdl).toString();
LOG.info("the path of wsdl file is " + wsdlUrl);
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
@@ -84,10 +92,6 @@
control.replay();
serviceInfo = wsdlServiceBuilder.buildService(def, service);
-
- }
-
- public void tearDown() throws Exception {
control.verify();
}
@@ -201,7 +205,7 @@
name = new QName(serviceInfo.getName().getNamespaceURI(), "greetMe");
BindingOperationInfo greetMe = bindingInfo.getOperation(name);
assertNotNull(greetMe);
- assertEquals(greetMe.getName(), name);
+ assertEquals(greetMe.getName(), name);
name = new QName(serviceInfo.getName().getNamespaceURI(), "greetMeOneWay");
BindingOperationInfo greetMeOneWay = bindingInfo.getOperation(name);
@@ -285,6 +289,20 @@
"http://apache.org/hello_world_soap_http/types");
}
+ public void testBare() throws Exception {
+ setUpWSDL(BARE_WSDL_PATH);
+ BindingInfo bindingInfo = null;
+ bindingInfo = serviceInfo.getBindings().iterator().next();
+ Collection<BindingOperationInfo> bindingOperationInfos = bindingInfo.getOperations();
+ assertNotNull(bindingOperationInfos);
+ assertEquals(bindingOperationInfos.size(), 1);
+ LOG.info("the binding operation is " + bindingOperationInfos.iterator().next().getName());
+ QName name = new QName(serviceInfo.getName().getNamespaceURI(), "greetMe");
+ BindingOperationInfo greetMe = bindingInfo.getOperation(name);
+ assertNotNull(greetMe);
+ assertEquals("greetMe OperationInfo name error", greetMe.getName(), name);
+ assertFalse("greetMe should be a Unwrapped operation ", greetMe.isUnwrappedCapable());
+ }
}
Added: incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl?view=auto&rev=450718
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl (added)
+++ incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl Wed Sep 27 23:33:23 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<wsdl:definitions targetNamespace="http://schemas.apache.org/yoko/idl/HelloWorld"
+ xmlns:tns="http://schemas.apache.org/yoko/idl/HelloWorld"
+ xmlns:corba="http://schemas.apache.org/yoko/bindings/corba"
+ xmlns:ns1="http://schemas.apache.org/yoko/idl/HelloWorld/corba/typemap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://schemas.apache.org/yoko/idl/HelloWorld"
+ xmlns="http://schemas.apache.org/yoko/idl/HelloWorld"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="greetMeResponse" type="xs:string"/>
+ <xs:element name="greetMe" type="xs:string"/>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part name="outparameter" element="tns:greetMeResponse"/>
+ </wsdl:message>
+ <wsdl:message name="greetMe">
+ <wsdl:part name="inparameter" element="tns:greetMe"/>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="greetMe">
+ <wsdl:input name="greetMeRequest" message="tns:greetMe"/>
+ <wsdl:output name="greetMeResponse" message="tns:greetMeResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:HelloWorld">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+ <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Propchange: incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/wsdl11/hello_world_bare.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml