Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 8972 invoked from network); 23 Mar 2007 06:57:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Mar 2007 06:57:30 -0000 Received: (qmail 34465 invoked by uid 500); 23 Mar 2007 06:57:38 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 34355 invoked by uid 500); 23 Mar 2007 06:57:37 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 34344 invoked by uid 99); 23 Mar 2007 06:57:37 -0000 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2007 23:57:36 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 866961A9838; Thu, 22 Mar 2007 23:56:38 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r521602 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/ testutils/src/main/resources/wsdl/ tools/validator/src/main/java/org/apache/cxf/tools/validator/ tools/validator/src/main/java/org/apache/cxf/to... Date: Fri, 23 Mar 2007 06:56:38 -0000 To: cxf-commits@incubator.apache.org From: mmao@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070323065638.866961A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mmao Date: Thu Mar 22 23:56:37 2007 New Revision: 521602 URL: http://svn.apache.org/viewvc?view=rev&rev=521602 Log: [CXF-474] soapheader.wsdl and soapheader2.wsdl is not valid wsdl * Tools validator add another WSI-BP V1.0 Rule 2210 * Remove the not valid part in soapheader.wsdl and soapheader2.wsdl in testutils * Comment the not valid part in unit test, MUST revisit later Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader2.wsdl incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java?view=diff&rev=521602&r1=521601&r2=521602 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java Thu Mar 22 23:56:37 2007 @@ -288,18 +288,19 @@ throw (Exception)ex.getCause(); } } - - @Test - public void testHolderNotTheFirstMessagePart() throws Exception { - URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl"); - assertNotNull(wsdl); - - SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName); - assertNotNull(service); - TestHeader proxy = service.getPort(portName, TestHeader.class); - Holder simpleAll = new Holder(); - simpleAll.value = new SimpleAll(); - proxy.sendReceiveAnyType(simpleAll, new SimpleChoice()); - - } + + // REVIST: This is not a valid WSDL according to WSI-BP V1.0 + // @Test + // public void testHolderNotTheFirstMessagePart() throws Exception { + // URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl"); + // assertNotNull(wsdl); + + // SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName); + // assertNotNull(service); + // TestHeader proxy = service.getPort(portName, TestHeader.class); + // Holder simpleAll = new Holder(); + // simpleAll.value = new SimpleAll(); + // proxy.sendReceiveAnyType(simpleAll, new SimpleChoice()); + + // } } Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl?view=diff&rev=521602&r1=521601&r2=521602 ============================================================================== --- incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl (original) +++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl Thu Mar 22 23:56:37 2007 @@ -224,10 +224,14 @@ + + @@ -296,6 +300,7 @@ part="inoutHeader" use="literal"/> + Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader2.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader2.wsdl?view=diff&rev=521602&r1=521601&r2=521602 ============================================================================== --- incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader2.wsdl (original) +++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader2.wsdl Thu Mar 22 23:56:37 2007 @@ -104,41 +104,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java?view=diff&rev=521602&r1=521601&r2=521602 ============================================================================== --- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java (original) +++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java Thu Mar 22 23:56:37 2007 @@ -67,18 +67,22 @@ } } } catch (ToolException ex) { - System.err.println("Error : " + ex.getMessage()); + System.err.println("WSDLValidator Error : " + ex.getMessage()); if (ex.getCause() instanceof BadUsageException) { printUsageException(TOOL_NAME, (BadUsageException)ex.getCause()); } System.err.println(); if (isVerboseOn()) { + System.err.println("[+] Verbose turned on"); + System.err.println(); ex.printStackTrace(); } } catch (Exception ex) { - System.err.println("Error : " + ex.getMessage()); + System.err.println("WSDLValidator Error : " + ex.getMessage()); System.err.println(); if (isVerboseOn()) { + System.err.println("[+] Verbose turned on"); + System.err.println(); ex.printStackTrace(); } } Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java?view=diff&rev=521602&r1=521601&r2=521602 ============================================================================== --- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java (original) +++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java Thu Mar 22 23:56:37 2007 @@ -67,6 +67,108 @@ } + private boolean checkR2201Input(final Operation operation, + final BindingOperation bop, + final Binding binding) { + List partsList = wsdlHelper.getInMessageParts(operation); + int inmessagePartsCount = partsList.size(); + SoapBody soapBody = SOAPBindingUtil.getBindingInputSOAPBody(bop); + if (soapBody != null) { + List parts = soapBody.getParts(); + int boundPartSize = parts == null ? inmessagePartsCount : parts.size(); + SoapHeader soapHeader = SOAPBindingUtil.getBindingInputSOAPHeader(bop); + boundPartSize = soapHeader != null + && soapHeader.getMessage().equals( + operation.getInput().getMessage() + .getQName()) + ? boundPartSize - 1 : boundPartSize; + + if (parts != null) { + Iterator partsIte = parts.iterator(); + while (partsIte.hasNext()) { + String partName = (String)partsIte.next(); + boolean isDefined = false; + for (Part part : partsList) { + if (partName.equalsIgnoreCase(part.getName())) { + isDefined = true; + break; + } + } + if (!isDefined) { + addErrorMessage("Violate WSI-BP-1.0 R2201 operation '" + + operation.getName() + "' soapBody parts : " + + partName + " not found in the message, wrong WSDL"); + return false; + } + } + } else { + if (partsList.size() > 1) { + addErrorMessage("Violate WSI-BP-1.0 R2210: operation '" + operation.getName() + + "' more than one part bound to body"); + return false; + } + } + + + if (boundPartSize > 1) { + addErrorMessage("Violate WSI-BP-1.0 R2201 operation '" + operation.getName() + + "' more than one part bound to body"); + return false; + } + } + return true; + } + + private boolean checkR2201Output(final Operation operation, + final BindingOperation bop, + final Binding binding) { + int outmessagePartsCount = wsdlHelper.getOutMessageParts(operation).size(); + SoapBody soapBody = SOAPBindingUtil.getBindingOutputSOAPBody(bop); + if (soapBody != null) { + List parts = soapBody.getParts(); + int boundPartSize = parts == null ? outmessagePartsCount : parts.size(); + SoapHeader soapHeader = SOAPBindingUtil.getBindingOutputSOAPHeader(bop); + boundPartSize = soapHeader != null + && soapHeader.getMessage().equals( + operation.getOutput().getMessage() + .getQName()) + ? boundPartSize - 1 : boundPartSize; + if (parts != null) { + Iterator partsIte = parts.iterator(); + while (partsIte.hasNext()) { + String partName = (String)partsIte.next(); + boolean isDefined = false; + for (Part part : wsdlHelper.getOutMessageParts(operation)) { + if (partName.equalsIgnoreCase(part.getName())) { + isDefined = true; + break; + } + } + if (!isDefined) { + addErrorMessage("Violate WSI-BP-1.0 R2201 operation '" + + operation.getName() + "' soapBody parts : " + + partName + " not found in the message, wrong WSDL"); + return false; + } + + } + } else { + if (wsdlHelper.getOutMessageParts(operation).size() > 1) { + addErrorMessage("Violate WSI-BP-1.0 R2210: operation '" + operation.getName() + + "' more than one part bound to body"); + return false; + } + } + + if (boundPartSize > 1) { + addErrorMessage("Violate WSI-BP-1.0 R2201 operation '" + operation.getName() + + "' more than one part bound to body"); + return false; + } + } + return true; + } + public boolean checkR2201() { for (PortType portType : wsdlHelper.getPortTypes(def)) { Iterator ite = portType.getOperations().iterator(); @@ -83,82 +185,11 @@ ? bindingStyle : SOAPBindingUtil.getSOAPOperationStyle(bop); if ("DOCUMENT".equalsIgnoreCase(style)) { - List partsList = wsdlHelper.getInMessageParts(operation); - int inmessagePartsCount = partsList.size(); - SoapBody soapBody = SOAPBindingUtil.getBindingInputSOAPBody(bop); - if (soapBody != null) { - List parts = soapBody.getParts(); - int boundPartSize = parts == null ? inmessagePartsCount : parts.size(); - SoapHeader soapHeader = SOAPBindingUtil.getBindingInputSOAPHeader(bop); - boundPartSize = soapHeader != null - && soapHeader.getMessage().equals( - operation.getInput().getMessage() - .getQName()) - ? boundPartSize - 1 : boundPartSize; - - if (parts != null) { - Iterator partsIte = parts.iterator(); - while (partsIte.hasNext()) { - String partName = (String)partsIte.next(); - boolean isDefined = false; - for (Part part : partsList) { - if (partName.equalsIgnoreCase(part.getName())) { - isDefined = true; - break; - } - } - if (!isDefined) { - addErrorMessage("operation: " + operation.getName() + " soapBody parts : " - + partName + " not found in the message, wrong WSDL"); - return false; - } - - } - } - - if (boundPartSize > 1) { - addErrorMessage("operation:" + operation.getName() - + " more than one part bound to body"); - return false; - } + if (!checkR2201Input(operation, bop, binding)) { + return false; } - - int outmessagePartsCount = wsdlHelper.getOutMessageParts(operation).size(); - soapBody = SOAPBindingUtil.getBindingOutputSOAPBody(bop); - if (soapBody != null) { - List parts = soapBody.getParts(); - int boundPartSize = parts == null ? outmessagePartsCount : parts.size(); - SoapHeader soapHeader = SOAPBindingUtil.getBindingOutputSOAPHeader(bop); - boundPartSize = soapHeader != null - && soapHeader.getMessage().equals( - operation.getOutput().getMessage() - .getQName()) - ? boundPartSize - 1 : boundPartSize; - if (parts != null) { - Iterator partsIte = parts.iterator(); - while (partsIte.hasNext()) { - String partName = (String)partsIte.next(); - boolean isDefined = false; - for (Part part : wsdlHelper.getOutMessageParts(operation)) { - if (partName.equalsIgnoreCase(part.getName())) { - isDefined = true; - break; - } - } - if (!isDefined) { - addErrorMessage("operation: " + operation.getName() + " soapBody parts : " - + partName + " not found in the message, wrong WSDL"); - return false; - } - - } - } - - if (boundPartSize > 1) { - addErrorMessage("operation:" + operation.getName() - + " more than one part bound to body"); - return false; - } + if (!checkR2201Output(operation, bop, binding)) { + return false; } } } Modified: incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java?view=diff&rev=521602&r1=521601&r2=521602 ============================================================================== --- incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java (original) +++ incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java Thu Mar 22 23:56:37 2007 @@ -140,6 +140,18 @@ } + public void testWSIBP2210() throws Exception { + try { + String[] args = new String[] {"-verbose", + getLocation("/validator_wsdl/soapheader.wsdl")}; + WSDLValidator.main(args); + assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2210") > -1); + } catch (Exception e) { + e.printStackTrace(); + } + + } + protected String getLocation(String wsdlFile) throws Exception { Enumeration e = WSDLValidationTest.class.getClassLoader().getResources(wsdlFile); while (e.hasMoreElements()) {