You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2013/08/13 15:03:05 UTC
Re: svn commit: r1513427 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/
Why is this validation being done in the MessageModeOutInterceptor instead of the org.apache.cxf.databinding.source.XMLStreamDataWriter which is part of the Source databinding? The incoming validation is done in the Source databinding.
Dan
On Aug 13, 2013, at 6:37 AM, ffang@apache.org wrote:
> Author: ffang
> Date: Tue Aug 13 10:37:58 2013
> New Revision: 1513427
>
> URL: http://svn.apache.org/r1513427
> Log:
> [CXF-5169]DISPATCH/PROVIDER doesn't work for OUT message validation
>
> Added:
> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl
> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml
> Modified:
> cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml
>
> Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
> URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=1513427&r1=1513426&r2=1513427&view=diff
> ==============================================================================
> --- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java (original)
> +++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java Tue Aug 13 10:37:58 2013
> @@ -34,10 +34,15 @@ import javax.xml.soap.SOAPPart;
> import javax.xml.stream.XMLStreamException;
> import javax.xml.stream.XMLStreamWriter;
> import javax.xml.transform.Source;
> +import javax.xml.transform.dom.DOMSource;
> +import javax.xml.validation.Schema;
>
> import org.w3c.dom.DocumentFragment;
> import org.w3c.dom.Node;
>
> +import org.xml.sax.SAXException;
> +
> +import org.apache.cxf.annotations.SchemaValidation.SchemaValidationType;
> import org.apache.cxf.attachment.AttachmentDeserializer;
> import org.apache.cxf.binding.soap.Soap12;
> import org.apache.cxf.binding.soap.SoapFault;
> @@ -48,6 +53,7 @@ import org.apache.cxf.binding.soap.saaj.
> import org.apache.cxf.binding.soap.saaj.SAAJStreamWriter;
> import org.apache.cxf.binding.soap.saaj.SAAJUtils;
> import org.apache.cxf.helpers.IOUtils;
> +import org.apache.cxf.helpers.ServiceUtils;
> import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
> import org.apache.cxf.interceptor.Fault;
> import org.apache.cxf.interceptor.StaxOutInterceptor;
> @@ -58,10 +64,13 @@ import org.apache.cxf.message.MessageImp
> import org.apache.cxf.message.MessageUtils;
> import org.apache.cxf.phase.AbstractPhaseInterceptor;
> import org.apache.cxf.phase.Phase;
> +import org.apache.cxf.service.Service;
> import org.apache.cxf.service.model.BindingMessageInfo;
> import org.apache.cxf.service.model.BindingOperationInfo;
> +import org.apache.cxf.service.model.ServiceModelUtil;
> import org.apache.cxf.staxutils.StaxUtils;
> import org.apache.cxf.staxutils.W3CDOMStreamWriter;
> +import org.apache.cxf.ws.addressing.EndpointReferenceUtils;
>
> public class MessageModeOutInterceptor extends AbstractPhaseInterceptor<Message> {
> MessageModeOutInterceptorInternal internal;
> @@ -81,6 +90,7 @@ public class MessageModeOutInterceptor e
> this.bindingName = bname;
> }
> public void handleMessage(Message message) throws Fault {
> + checkSchemaValidation(message);
> BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
> if (bop != null && !bindingName.equals(bop.getBinding().getName())) {
> return;
> @@ -159,6 +169,7 @@ public class MessageModeOutInterceptor e
> Object o = list.get(0);
> if (o instanceof SOAPMessage) {
> SOAPMessage soapMessage = (SOAPMessage)o;
> +
> if (soapMessage.countAttachments() > 0) {
> message.put("write.attachments", Boolean.TRUE);
> }
> @@ -291,5 +302,51 @@ public class MessageModeOutInterceptor e
> message.getInterceptorChain().add(SAAJOutEndingInterceptor.INSTANCE);
> }
> }
> +
> + private void checkSchemaValidation(Message message) {
> +
> + if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) {
> + Service service = ServiceModelUtil.getService(message.getExchange());
> + if (service == null) {
> + return;
> + }
> + Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0),
> + message.getExchange().getBus());
> + if (schema == null) {
> + return;
> + }
> + MessageContentsList list = (MessageContentsList)message.getContent(List.class);
> + if (list == null || list.isEmpty()) {
> + return;
> + }
> + Object o = list.get(0);
> + SOAPMessage soapMessage = null;
> +
> + if (o instanceof SOAPMessage) {
> + soapMessage = (SOAPMessage)o;
> +
> + try {
> + DOMSource source = new DOMSource(soapMessage.getSOAPBody().getFirstChild());
> + schema.newValidator().validate(source);
> + } catch (SAXException e) {
> + throw new Fault(e);
> + } catch (IOException e) {
> + throw new Fault(e);
> + } catch (SOAPException e) {
> + throw new Fault(e);
> + }
> + } else if (o instanceof Source) {
> + Source source = (Source)o;
> + try {
> + schema.newValidator().validate(source);
> + } catch (SAXException e) {
> + throw new Fault(e);
> + } catch (IOException e) {
> + throw new Fault(e);
> + }
> + }
> + }
> +
> + }
>
> }
>
> Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java?rev=1513427&r1=1513426&r2=1513427&view=diff
> ==============================================================================
> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java (original)
> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java Tue Aug 13 10:37:58 2013
> @@ -50,7 +50,7 @@ import org.apache.cxf.helpers.DOMUtils;
> //wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl"
> @WebServiceProvider(portName = "SoapProviderPort", serviceName = "SOAPProviderService",
> targetNamespace = "http://apache.org/hello_world_soap_http",
> - wsdlLocation = "/wsdl/hello_world.wsdl")
> + wsdlLocation = "/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl")
> @ServiceMode(value = Service.Mode.MESSAGE)
> public class HWSoapMessageDocProvider implements Provider<SOAPMessage> {
>
> @@ -62,6 +62,7 @@ public class HWSoapMessageDocProvider im
>
> private SOAPMessage sayHiResponse;
> private SOAPMessage greetMeResponse;
> + private SOAPMessage greetMeResponseExceedMaxLengthRestriction;
>
> public HWSoapMessageDocProvider() {
>
> @@ -73,6 +74,9 @@ public class HWSoapMessageDocProvider im
> is = getClass().getResourceAsStream("resources/GreetMeDocLiteralResp.xml");
> greetMeResponse = factory.createMessage(null, is);
> is.close();
> + is = getClass().getResourceAsStream("resources/GreetMeDocLiteralRespExceedLength.xml");
> + greetMeResponseExceedMaxLengthRestriction = factory.createMessage(null, is);
> + is.close();
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> @@ -103,6 +107,8 @@ public class HWSoapMessageDocProvider im
> String v = DOMUtils.getContent(el);
> if (v.contains("Return sayHi")) {
> response = sayHiResponse;
> + } else if (v.contains("exceed maxLength")) {
> + response = greetMeResponseExceedMaxLengthRestriction;
> } else if (v.contains("throwFault")) {
> try {
> SOAPFactory f = SOAPFactory.newInstance();
>
> Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java?rev=1513427&r1=1513426&r2=1513427&view=diff
> ==============================================================================
> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java (original)
> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java Tue Aug 13 10:37:58 2013
> @@ -21,11 +21,17 @@ package org.apache.cxf.systest.provider;
>
> import java.lang.reflect.UndeclaredThrowableException;
> import java.net.URL;
> +import java.util.HashMap;
> +import java.util.Map;
>
> import javax.xml.namespace.QName;
> import javax.xml.ws.Endpoint;
> import javax.xml.ws.soap.SOAPFaultException;
>
> +import org.apache.cxf.interceptor.LoggingInInterceptor;
> +import org.apache.cxf.interceptor.LoggingOutInterceptor;
> +import org.apache.cxf.jaxws.EndpointImpl;
> +import org.apache.cxf.message.Message;
> import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
> import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
> import org.apache.cxf.testutil.common.TestUtil;
> @@ -43,7 +49,14 @@ public class ProviderClientServerTest ex
>
> protected void run() {
> Object implementor = new HWSoapMessageDocProvider();
> - Endpoint.publish(ADDRESS, implementor);
> + Endpoint ep = Endpoint.create(implementor);
> + Map<String, Object> map = new HashMap<String, Object>();
> + map.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
> + ep.setProperties(map);
> + ((EndpointImpl)ep).getInInterceptors().add(new LoggingInInterceptor());
> + ((EndpointImpl)ep).getOutInterceptors().add(new LoggingOutInterceptor());
> + ep.publish(ADDRESS);
> +
> }
>
> public static void main(String[] args) {
> @@ -112,4 +125,47 @@ public class ProviderClientServerTest ex
>
> }
>
> +
> + @Test
> + public void testSOAPMessageModeDocLitWithSchemaValidation() throws Exception {
> +
> + QName serviceName =
> + new QName("http://apache.org/hello_world_soap_http", "SOAPProviderService");
> + QName portName =
> + new QName("http://apache.org/hello_world_soap_http", "SoapProviderPort");
> +
> + URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
> + assertNotNull(wsdl);
> +
> + SOAPService service = new SOAPService(wsdl, serviceName);
> + assertNotNull(service);
> +
> +
> + try {
> + Greeter greeter = service.getPort(portName, Greeter.class);
> + setAddress(greeter, ADDRESS);
> + try {
> + greeter.greetMe("this is a greetMe message which length is more "
> + + "than 30 so that I wanna a schema validation error");
> + fail("Should have thrown an exception");
> + } catch (Exception ex) {
> + //expected
> + assertTrue(ex.getMessage().contains("cvc-maxLength-valid"));
> + }
> +
> + try {
> + String ret = greeter.greetMe("exceed maxLength");
> + System.out.println("the ret is " + ret);
> + fail("Should have thrown an exception");
> + } catch (Exception ex) {
> + //expected
> + assertTrue(ex.getMessage().contains("cvc-maxLength-valid"));
> + }
> +
> + } catch (UndeclaredThrowableException ex) {
> + throw (Exception)ex.getCause();
> + }
> +
> + }
> +
> }
>
> Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl
> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl?rev=1513427&view=auto
> ==============================================================================
> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl (added)
> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl Tue Aug 13 10:37:58 2013
> @@ -0,0 +1,419 @@
> +<?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 xmlns="http://schemas.xmlsoap.org/wsdl/"
> + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> + xmlns:tns="http://apache.org/hello_world_soap_http"
> + xmlns:x1="http://apache.org/hello_world_soap_http/types"
> + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> + xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> + targetNamespace="http://apache.org/hello_world_soap_http" name="HelloWorld">
> + <wsdl:types>
> + <schema targetNamespace="http://apache.org/hello_world_soap_http/types" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:x1="http://apache.org/hello_world_soap_http/types" elementFormDefault="qualified">
> + <element name="sayHi">
> + <complexType/>
> + </element>
> + <element name="sayHiResponse">
> + <complexType>
> + <sequence>
> + <element name="responseType" type="string"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="greetMe">
> + <complexType>
> + <sequence>
> + <element name="requestType">
> + <simpleType>
> + <restriction base="string">
> + <maxLength value="30"></maxLength>
> + </restriction>
> + </simpleType>
> + </element>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="greetMeResponse">
> + <complexType>
> + <sequence>
> + <element name="responseType">
> + <simpleType>
> + <restriction base="string">
> + <maxLength value="30"></maxLength>
> + </restriction>
> + </simpleType>
> + </element>
> + </sequence>
> + </complexType>
> + </element>
> +
> + <element name="testNillable">
> + <complexType>
> + <sequence>
> + <element name="NillElem" nillable="true" type="string"/>
> + <element name="intElem" type="int"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="testNillableResponse">
> + <complexType>
> + <sequence>
> + <element name="responseType" nillable="true" type="string"/>
> + </sequence>
> + </complexType>
> + </element>
> +
> + <element name="greetMeLater">
> + <complexType>
> + <sequence>
> + <element name="requestType" type="long"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="greetMeLaterResponse">
> + <complexType>
> + <sequence>
> + <element name="responseType" type="string"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="greetMeSometime">
> + <complexType>
> + <sequence>
> + <element name="requestType" type="string"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="greetMeSometimeResponse">
> + <complexType>
> + <sequence>
> + <element name="responseType" type="string"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="greetMeOneWay">
> + <complexType>
> + <sequence>
> + <element name="requestType" type="string"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="testDocLitFault">
> + <complexType>
> + <sequence>
> + <element name="faultType" type="string"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="testDocLitFaultResponse">
> + <complexType>
> + <sequence/>
> + </complexType>
> + </element>
> + <complexType name="ErrorCode">
> + <sequence>
> + <element name="minor" type="short"/>
> + <element name="major" type="short"/>
> + </sequence>
> + </complexType>
> + <element name="NoSuchCodeLit">
> + <complexType>
> + <sequence>
> + <element name="code" type="x1:ErrorCode"/>
> + </sequence>
> + </complexType>
> + </element>
> + <element name="BadRecordLit" type="string"/>
> + <complexType name="BadRecord">
> + <sequence>
> + <element name="reason" type="string"/>
> + <element name="code" type="short"/>
> + </sequence>
> + </complexType>
> + <complexType name="addNumbers">
> + <sequence>
> + <element name="arg0" type="int"/>
> + <element name="arg1" type="int"/>
> + </sequence>
> + </complexType>
> + <element name="addNumbers" type="x1:addNumbers"/>
> + <complexType name="addNumbersResponse">
> + <sequence>
> + <element name="return" type="int"/>
> + </sequence>
> + </complexType>
> + <element name="addNumbersResponse" type="x1:addNumbersResponse"/>
> + <complexType name="stringStruct">
> + <sequence>
> + <element name="arg0" type="string"/>
> + <element name="arg1" type="string"/>
> + </sequence>
> + </complexType>
> + <element name="BareDocument" type="string"/>
> + <element name="BareDocumentResponse">
> + <complexType>
> + <sequence>
> + <element name="company" type="string"/>
> + </sequence>
> + <attribute name="id" type="int"/>
> + </complexType>
> + </element>
> + </schema>
> + </wsdl:types>
> + <wsdl:message name="sayHiRequest">
> + <wsdl:part name="in" element="x1:sayHi"/>
> + </wsdl:message>
> + <wsdl:message name="sayHiResponse">
> + <wsdl:part name="out" element="x1:sayHiResponse"/>
> + </wsdl:message>
> + <wsdl:message name="greetMeRequest">
> + <wsdl:part name="in" element="x1:greetMe"/>
> + </wsdl:message>
> + <wsdl:message name="greetMeResponse">
> + <wsdl:part name="out" element="x1:greetMeResponse"/>
> + </wsdl:message>
> + <wsdl:message name="testNillableRequest">
> + <wsdl:part name="in" element="x1:testNillable"/>
> + </wsdl:message>
> + <wsdl:message name="testNillableResponse">
> + <wsdl:part name="out" element="x1:testNillableResponse"/>
> + </wsdl:message>
> + <wsdl:message name="greetMeLaterRequest">
> + <wsdl:part name="in" element="x1:greetMeLater"/>
> + </wsdl:message>
> + <wsdl:message name="greetMeLaterResponse">
> + <wsdl:part name="out" element="x1:greetMeLaterResponse"/>
> + </wsdl:message>
> + <wsdl:message name="greetMeSometimeRequest">
> + <wsdl:part name="in" element="x1:greetMeSometime"/>
> + </wsdl:message>
> + <wsdl:message name="greetMeSometimeResponse">
> + <wsdl:part name="out" element="x1:greetMeSometimeResponse"/>
> + </wsdl:message>
> + <wsdl:message name="greetMeOneWayRequest">
> + <wsdl:part name="in" element="x1:greetMeOneWay"/>
> + </wsdl:message>
> + <wsdl:message name="testDocLitFaultRequest">
> + <wsdl:part name="in" element="x1:testDocLitFault"/>
> + </wsdl:message>
> + <wsdl:message name="testDocLitFaultResponse">
> + <wsdl:part name="out" element="x1:testDocLitFaultResponse"/>
> + </wsdl:message>
> + <wsdl:message name="NoSuchCodeLitFault">
> + <wsdl:part name="NoSuchCodeLit" element="x1:NoSuchCodeLit"/>
> + </wsdl:message>
> + <wsdl:message name="BadRecordLitFault">
> + <wsdl:part name="BadRecordLit" element="x1:BadRecordLit"/>
> + </wsdl:message>
> + <wsdl:message name="testDocLitBareRequest">
> + <wsdl:part name="in" element="x1:BareDocument"/>
> + </wsdl:message>
> + <wsdl:message name="testDocLitBareResponse">
> + <wsdl:part name="out" element="x1:BareDocumentResponse"/>
> + </wsdl:message>
> + <wsdl:portType name="Greeter">
> + <wsdl:operation name="sayHi">
> + <wsdl:input message="tns:sayHiRequest"/>
> + <wsdl:output message="tns:sayHiResponse"/>
> + </wsdl:operation>
> + <wsdl:operation name="greetMe">
> + <wsdl:input message="tns:greetMeRequest"/>
> + <wsdl:output message="tns:greetMeResponse"/>
> + </wsdl:operation>
> + <wsdl:operation name="testNillable">
> + <wsdl:input message="tns:testNillableRequest"/>
> + <wsdl:output message="tns:testNillableResponse"/>
> + </wsdl:operation>
> + <wsdl:operation name="greetMeLater">
> + <wsdl:input message="tns:greetMeLaterRequest"/>
> + <wsdl:output message="tns:greetMeLaterResponse"/>
> + </wsdl:operation>
> + <wsdl:operation name="greetMeSometime">
> + <wsdl:input message="tns:greetMeSometimeRequest"/>
> + <wsdl:output message="tns:greetMeSometimeResponse"/>
> + </wsdl:operation>
> + <wsdl:operation name="greetMeOneWay">
> + <wsdl:input message="tns:greetMeOneWayRequest"/>
> + </wsdl:operation>
> + <wsdl:operation name="testDocLitFault">
> + <wsdl:input message="tns:testDocLitFaultRequest"/>
> + <wsdl:output message="tns:testDocLitFaultResponse"/>
> + <wsdl:fault name="NoSuchCodeLitFault" message="tns:NoSuchCodeLitFault"/>
> + <wsdl:fault name="BadRecordLitFault" message="tns:BadRecordLitFault"/>
> + </wsdl:operation>
> +
> + </wsdl:portType>
> +
> + <wsdl:portType name="DocLitBare">
> + <wsdl:operation name="testDocLitBare">
> + <wsdl:input name="testDocLitBareRequest" message="tns:testDocLitBareRequest"/>
> + <wsdl:output name="testDocLitBareResponse" message="tns:testDocLitBareResponse"/>
> + </wsdl:operation>
> + </wsdl:portType>
> + <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> + <wsdl:operation name="sayHi">
> + <soap:operation style="document"/>
> + <wsdl:input>
> + <soap:body use="literal"/>
> + </wsdl:input>
> + <wsdl:output>
> + <soap:body use="literal"/>
> + </wsdl:output>
> + </wsdl:operation>
> + <wsdl:operation name="greetMe">
> + <soap:operation style="document"/>
> + <wsdl:input>
> + <soap:body use="literal"/>
> + </wsdl:input>
> + <wsdl:output>
> + <soap:body use="literal"/>
> + </wsdl:output>
> + </wsdl:operation>
> + <wsdl:operation name="testNillable">
> + <soap:operation style="document"/>
> + <wsdl:input>
> + <soap:body use="literal"/>
> + </wsdl:input>
> + <wsdl:output>
> + <soap:body use="literal"/>
> + </wsdl:output>
> + </wsdl:operation>
> + <wsdl:operation name="greetMeLater">
> + <soap:operation style="document"/>
> + <wsdl:input>
> + <soap:body use="literal"/>
> + </wsdl:input>
> + <wsdl:output>
> + <soap:body use="literal"/>
> + </wsdl:output>
> + </wsdl:operation>
> + <wsdl:operation name="greetMeSometime">
> + <soap:operation style="document"/>
> + <wsdl:input>
> + <soap:body use="literal"/>
> + </wsdl:input>
> + <wsdl:output>
> + <soap:body use="literal"/>
> + </wsdl:output>
> + </wsdl:operation>
> + <wsdl:operation name="greetMeOneWay">
> + <soap:operation style="document"/>
> + <wsdl:input>
> + <soap:body use="literal"/>
> + </wsdl:input>
> + </wsdl:operation>
> + <wsdl:operation name="testDocLitFault">
> + <soap:operation style="document"/>
> + <wsdl:input>
> + <soap:body use="literal"/>
> + </wsdl:input>
> + <wsdl:output>
> + <soap:body use="literal"/>
> + </wsdl:output>
> + <wsdl:fault name="NoSuchCodeLitFault">
> + <soap:fault name="NoSuchCodeLitFault" use="literal"/>
> + </wsdl:fault>
> + <wsdl:fault name="BadRecordLitFault">
> + <soap:fault name="BadRecordLitFault" use="literal"/>
> + </wsdl:fault>
> + </wsdl:operation>
> +
> + </wsdl:binding>
> + <wsdl:binding name="Doc_Lit_Bare_SOAPBinding" type="tns:DocLitBare">
> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> + <wsdl:operation name="testDocLitBare">
> + <soap:operation style="document" soapAction="http://apache.org/hello_world_soap_http/testDocLitBare"/>
> + <wsdl:input name="testDocLitBareRequest">
> + <soap:body use="literal"/>
> + </wsdl:input>
> + <wsdl:output name="testDocLitBareResponse">
> + <soap:body use="literal"/>
> + </wsdl:output>
> + </wsdl:operation>
> + </wsdl:binding>
> +
> +
> + <wsdl:service name="SOAPService">
> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
> + </wsdl:port>
> +
> + <wsdl:port name="SoapPort1" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:7000/SoapContext/SoapPort"/>
> + </wsdl:port>
> + </wsdl:service>
> +
> + <wsdl:service name="SOAPProviderService">
> + <wsdl:port name="SoapProviderPort" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9003/SoapContext/SoapProviderPort"/>
> + </wsdl:port>
> + </wsdl:service>
> +
> + <wsdl:service name="SOAPDispatchService">
> + <wsdl:port name="SoapDispatchPort" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9006/SOAPDispatchService/SoapDispatchPort"/>
> + </wsdl:port>
> + </wsdl:service>
> +
> + <wsdl:service name="SOAPService_DocLitBare">
> + <wsdl:port name="SoapPort2" binding="tns:Doc_Lit_Bare_SOAPBinding">
> + <soap:address location="http://localhost:7600/SoapContext/SoapPort"/>
> + </wsdl:port>
> + </wsdl:service>
> + <wsdl:service name="SOAPServiceAddressingDocLitBare">
> + <wsdl:port name="SoapPort" binding="tns:Doc_Lit_Bare_SOAPBinding">
> + <soap:address location="http://localhost:7600/SoapContext/SoapPort"/>
> + <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
> + </wsdl:port>
> + </wsdl:service>
> + <wsdl:service name="SOAPService_Test1">
> + <wsdl:port name="SoapPort_Test1" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9100"/>
> + </wsdl:port>
> + <wsdl:port name="SoapPort_Test2" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9101"/>
> + </wsdl:port>
> + </wsdl:service>
> + <wsdl:service name="SOAPServiceAddressing">
> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9008/SoapContext/SoapPort"/>
> + <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
> + </wsdl:port>
> + </wsdl:service>
> + <wsdl:service name="SOAPServiceConcurrencyTest">
> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9009/SoapContext/SoapPort"/>
> + </wsdl:port>
> + </wsdl:service>
> + <wsdl:service name="SOAPServiceBogusAddressTest">
> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="FOO"/>
> + </wsdl:port>
> + </wsdl:service>
> + <wsdl:service name="SOAPServiceMultiPortTypeTest">
> + <wsdl:port name="GreeterPort" binding="tns:Greeter_SOAPBinding">
> + <soap:address location="http://localhost:9020/MultiPort/GreeterPort"/>
> + </wsdl:port>
> + <wsdl:port name="DocLitBarePort" binding="tns:Doc_Lit_Bare_SOAPBinding">
> + <soap:address location="http://localhost:9021/MultiPort/DocBarePort"/>
> + </wsdl:port>
> + </wsdl:service>
> +</wsdl:definitions>
> +
>
> Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml
> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml?rev=1513427&view=auto
> ==============================================================================
> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml (added)
> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml Tue Aug 13 10:37:58 2013
> @@ -0,0 +1,20 @@
> +<?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.
> +-->
> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><ns4:greetMeResponse xmlns:ns4="http://apache.org/hello_world_soap_http/types"><ns4:responseType>this is a greetMeResponse message which lenght exceed the maxLength restriction</ns4:responseType></ns4:greetMeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
>
> Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml
> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml?rev=1513427&r1=1513426&r2=1513427&view=diff
> ==============================================================================
> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml (original)
> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml Tue Aug 13 10:37:58 2013
> @@ -1,2 +1,2 @@
> <?xml version="1.0" encoding="utf-8" ?>
> -<ns4:greetMeResponse xmlns:ns4="http://apache.org/hello_world_soap_http/types"><ns4:responseType>TestXMLBindingProviderMessage</ns4:responseType></ns4:greetMeResponse>
> \ No newline at end of file
> +<ns4:greetMeResponse xmlns:ns4="http://apache.org/hello_world_xml_http/wrapped/types"><ns4:responseType>TestXMLBindingProviderMessage</ns4:responseType></ns4:greetMeResponse>
>
>
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com
Re: svn commit: r1513427 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/
Posted by Freeman Fang <fr...@gmail.com>.
revised accordingly.
Thanks Dan!
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋
On 2013-8-13, at 下午9:03, Daniel Kulp wrote:
>
> Why is this validation being done in the MessageModeOutInterceptor instead of the org.apache.cxf.databinding.source.XMLStreamDataWriter which is part of the Source databinding? The incoming validation is done in the Source databinding.
>
> Dan
>
>
>
> On Aug 13, 2013, at 6:37 AM, ffang@apache.org wrote:
>
>> Author: ffang
>> Date: Tue Aug 13 10:37:58 2013
>> New Revision: 1513427
>>
>> URL: http://svn.apache.org/r1513427
>> Log:
>> [CXF-5169]DISPATCH/PROVIDER doesn't work for OUT message validation
>>
>> Added:
>> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl
>> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml
>> Modified:
>> cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
>> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
>> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
>> cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml
>>
>> Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
>> URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=1513427&r1=1513426&r2=1513427&view=diff
>> ==============================================================================
>> --- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java (original)
>> +++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java Tue Aug 13 10:37:58 2013
>> @@ -34,10 +34,15 @@ import javax.xml.soap.SOAPPart;
>> import javax.xml.stream.XMLStreamException;
>> import javax.xml.stream.XMLStreamWriter;
>> import javax.xml.transform.Source;
>> +import javax.xml.transform.dom.DOMSource;
>> +import javax.xml.validation.Schema;
>>
>> import org.w3c.dom.DocumentFragment;
>> import org.w3c.dom.Node;
>>
>> +import org.xml.sax.SAXException;
>> +
>> +import org.apache.cxf.annotations.SchemaValidation.SchemaValidationType;
>> import org.apache.cxf.attachment.AttachmentDeserializer;
>> import org.apache.cxf.binding.soap.Soap12;
>> import org.apache.cxf.binding.soap.SoapFault;
>> @@ -48,6 +53,7 @@ import org.apache.cxf.binding.soap.saaj.
>> import org.apache.cxf.binding.soap.saaj.SAAJStreamWriter;
>> import org.apache.cxf.binding.soap.saaj.SAAJUtils;
>> import org.apache.cxf.helpers.IOUtils;
>> +import org.apache.cxf.helpers.ServiceUtils;
>> import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
>> import org.apache.cxf.interceptor.Fault;
>> import org.apache.cxf.interceptor.StaxOutInterceptor;
>> @@ -58,10 +64,13 @@ import org.apache.cxf.message.MessageImp
>> import org.apache.cxf.message.MessageUtils;
>> import org.apache.cxf.phase.AbstractPhaseInterceptor;
>> import org.apache.cxf.phase.Phase;
>> +import org.apache.cxf.service.Service;
>> import org.apache.cxf.service.model.BindingMessageInfo;
>> import org.apache.cxf.service.model.BindingOperationInfo;
>> +import org.apache.cxf.service.model.ServiceModelUtil;
>> import org.apache.cxf.staxutils.StaxUtils;
>> import org.apache.cxf.staxutils.W3CDOMStreamWriter;
>> +import org.apache.cxf.ws.addressing.EndpointReferenceUtils;
>>
>> public class MessageModeOutInterceptor extends AbstractPhaseInterceptor<Message> {
>> MessageModeOutInterceptorInternal internal;
>> @@ -81,6 +90,7 @@ public class MessageModeOutInterceptor e
>> this.bindingName = bname;
>> }
>> public void handleMessage(Message message) throws Fault {
>> + checkSchemaValidation(message);
>> BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
>> if (bop != null && !bindingName.equals(bop.getBinding().getName())) {
>> return;
>> @@ -159,6 +169,7 @@ public class MessageModeOutInterceptor e
>> Object o = list.get(0);
>> if (o instanceof SOAPMessage) {
>> SOAPMessage soapMessage = (SOAPMessage)o;
>> +
>> if (soapMessage.countAttachments() > 0) {
>> message.put("write.attachments", Boolean.TRUE);
>> }
>> @@ -291,5 +302,51 @@ public class MessageModeOutInterceptor e
>> message.getInterceptorChain().add(SAAJOutEndingInterceptor.INSTANCE);
>> }
>> }
>> +
>> + private void checkSchemaValidation(Message message) {
>> +
>> + if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) {
>> + Service service = ServiceModelUtil.getService(message.getExchange());
>> + if (service == null) {
>> + return;
>> + }
>> + Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0),
>> + message.getExchange().getBus());
>> + if (schema == null) {
>> + return;
>> + }
>> + MessageContentsList list = (MessageContentsList)message.getContent(List.class);
>> + if (list == null || list.isEmpty()) {
>> + return;
>> + }
>> + Object o = list.get(0);
>> + SOAPMessage soapMessage = null;
>> +
>> + if (o instanceof SOAPMessage) {
>> + soapMessage = (SOAPMessage)o;
>> +
>> + try {
>> + DOMSource source = new DOMSource(soapMessage.getSOAPBody().getFirstChild());
>> + schema.newValidator().validate(source);
>> + } catch (SAXException e) {
>> + throw new Fault(e);
>> + } catch (IOException e) {
>> + throw new Fault(e);
>> + } catch (SOAPException e) {
>> + throw new Fault(e);
>> + }
>> + } else if (o instanceof Source) {
>> + Source source = (Source)o;
>> + try {
>> + schema.newValidator().validate(source);
>> + } catch (SAXException e) {
>> + throw new Fault(e);
>> + } catch (IOException e) {
>> + throw new Fault(e);
>> + }
>> + }
>> + }
>> +
>> + }
>>
>> }
>>
>> Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
>> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java?rev=1513427&r1=1513426&r2=1513427&view=diff
>> ==============================================================================
>> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java (original)
>> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java Tue Aug 13 10:37:58 2013
>> @@ -50,7 +50,7 @@ import org.apache.cxf.helpers.DOMUtils;
>> //wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl"
>> @WebServiceProvider(portName = "SoapProviderPort", serviceName = "SOAPProviderService",
>> targetNamespace = "http://apache.org/hello_world_soap_http",
>> - wsdlLocation = "/wsdl/hello_world.wsdl")
>> + wsdlLocation = "/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl")
>> @ServiceMode(value = Service.Mode.MESSAGE)
>> public class HWSoapMessageDocProvider implements Provider<SOAPMessage> {
>>
>> @@ -62,6 +62,7 @@ public class HWSoapMessageDocProvider im
>>
>> private SOAPMessage sayHiResponse;
>> private SOAPMessage greetMeResponse;
>> + private SOAPMessage greetMeResponseExceedMaxLengthRestriction;
>>
>> public HWSoapMessageDocProvider() {
>>
>> @@ -73,6 +74,9 @@ public class HWSoapMessageDocProvider im
>> is = getClass().getResourceAsStream("resources/GreetMeDocLiteralResp.xml");
>> greetMeResponse = factory.createMessage(null, is);
>> is.close();
>> + is = getClass().getResourceAsStream("resources/GreetMeDocLiteralRespExceedLength.xml");
>> + greetMeResponseExceedMaxLengthRestriction = factory.createMessage(null, is);
>> + is.close();
>> } catch (Exception ex) {
>> ex.printStackTrace();
>> }
>> @@ -103,6 +107,8 @@ public class HWSoapMessageDocProvider im
>> String v = DOMUtils.getContent(el);
>> if (v.contains("Return sayHi")) {
>> response = sayHiResponse;
>> + } else if (v.contains("exceed maxLength")) {
>> + response = greetMeResponseExceedMaxLengthRestriction;
>> } else if (v.contains("throwFault")) {
>> try {
>> SOAPFactory f = SOAPFactory.newInstance();
>>
>> Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
>> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java?rev=1513427&r1=1513426&r2=1513427&view=diff
>> ==============================================================================
>> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java (original)
>> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java Tue Aug 13 10:37:58 2013
>> @@ -21,11 +21,17 @@ package org.apache.cxf.systest.provider;
>>
>> import java.lang.reflect.UndeclaredThrowableException;
>> import java.net.URL;
>> +import java.util.HashMap;
>> +import java.util.Map;
>>
>> import javax.xml.namespace.QName;
>> import javax.xml.ws.Endpoint;
>> import javax.xml.ws.soap.SOAPFaultException;
>>
>> +import org.apache.cxf.interceptor.LoggingInInterceptor;
>> +import org.apache.cxf.interceptor.LoggingOutInterceptor;
>> +import org.apache.cxf.jaxws.EndpointImpl;
>> +import org.apache.cxf.message.Message;
>> import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
>> import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
>> import org.apache.cxf.testutil.common.TestUtil;
>> @@ -43,7 +49,14 @@ public class ProviderClientServerTest ex
>>
>> protected void run() {
>> Object implementor = new HWSoapMessageDocProvider();
>> - Endpoint.publish(ADDRESS, implementor);
>> + Endpoint ep = Endpoint.create(implementor);
>> + Map<String, Object> map = new HashMap<String, Object>();
>> + map.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
>> + ep.setProperties(map);
>> + ((EndpointImpl)ep).getInInterceptors().add(new LoggingInInterceptor());
>> + ((EndpointImpl)ep).getOutInterceptors().add(new LoggingOutInterceptor());
>> + ep.publish(ADDRESS);
>> +
>> }
>>
>> public static void main(String[] args) {
>> @@ -112,4 +125,47 @@ public class ProviderClientServerTest ex
>>
>> }
>>
>> +
>> + @Test
>> + public void testSOAPMessageModeDocLitWithSchemaValidation() throws Exception {
>> +
>> + QName serviceName =
>> + new QName("http://apache.org/hello_world_soap_http", "SOAPProviderService");
>> + QName portName =
>> + new QName("http://apache.org/hello_world_soap_http", "SoapProviderPort");
>> +
>> + URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
>> + assertNotNull(wsdl);
>> +
>> + SOAPService service = new SOAPService(wsdl, serviceName);
>> + assertNotNull(service);
>> +
>> +
>> + try {
>> + Greeter greeter = service.getPort(portName, Greeter.class);
>> + setAddress(greeter, ADDRESS);
>> + try {
>> + greeter.greetMe("this is a greetMe message which length is more "
>> + + "than 30 so that I wanna a schema validation error");
>> + fail("Should have thrown an exception");
>> + } catch (Exception ex) {
>> + //expected
>> + assertTrue(ex.getMessage().contains("cvc-maxLength-valid"));
>> + }
>> +
>> + try {
>> + String ret = greeter.greetMe("exceed maxLength");
>> + System.out.println("the ret is " + ret);
>> + fail("Should have thrown an exception");
>> + } catch (Exception ex) {
>> + //expected
>> + assertTrue(ex.getMessage().contains("cvc-maxLength-valid"));
>> + }
>> +
>> + } catch (UndeclaredThrowableException ex) {
>> + throw (Exception)ex.getCause();
>> + }
>> +
>> + }
>> +
>> }
>>
>> Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl
>> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl?rev=1513427&view=auto
>> ==============================================================================
>> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl (added)
>> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/hello_world_with_restriction.wsdl Tue Aug 13 10:37:58 2013
>> @@ -0,0 +1,419 @@
>> +<?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 xmlns="http://schemas.xmlsoap.org/wsdl/"
>> + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> + xmlns:tns="http://apache.org/hello_world_soap_http"
>> + xmlns:x1="http://apache.org/hello_world_soap_http/types"
>> + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> + xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> + targetNamespace="http://apache.org/hello_world_soap_http" name="HelloWorld">
>> + <wsdl:types>
>> + <schema targetNamespace="http://apache.org/hello_world_soap_http/types" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:x1="http://apache.org/hello_world_soap_http/types" elementFormDefault="qualified">
>> + <element name="sayHi">
>> + <complexType/>
>> + </element>
>> + <element name="sayHiResponse">
>> + <complexType>
>> + <sequence>
>> + <element name="responseType" type="string"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="greetMe">
>> + <complexType>
>> + <sequence>
>> + <element name="requestType">
>> + <simpleType>
>> + <restriction base="string">
>> + <maxLength value="30"></maxLength>
>> + </restriction>
>> + </simpleType>
>> + </element>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="greetMeResponse">
>> + <complexType>
>> + <sequence>
>> + <element name="responseType">
>> + <simpleType>
>> + <restriction base="string">
>> + <maxLength value="30"></maxLength>
>> + </restriction>
>> + </simpleType>
>> + </element>
>> + </sequence>
>> + </complexType>
>> + </element>
>> +
>> + <element name="testNillable">
>> + <complexType>
>> + <sequence>
>> + <element name="NillElem" nillable="true" type="string"/>
>> + <element name="intElem" type="int"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="testNillableResponse">
>> + <complexType>
>> + <sequence>
>> + <element name="responseType" nillable="true" type="string"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> +
>> + <element name="greetMeLater">
>> + <complexType>
>> + <sequence>
>> + <element name="requestType" type="long"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="greetMeLaterResponse">
>> + <complexType>
>> + <sequence>
>> + <element name="responseType" type="string"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="greetMeSometime">
>> + <complexType>
>> + <sequence>
>> + <element name="requestType" type="string"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="greetMeSometimeResponse">
>> + <complexType>
>> + <sequence>
>> + <element name="responseType" type="string"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="greetMeOneWay">
>> + <complexType>
>> + <sequence>
>> + <element name="requestType" type="string"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="testDocLitFault">
>> + <complexType>
>> + <sequence>
>> + <element name="faultType" type="string"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="testDocLitFaultResponse">
>> + <complexType>
>> + <sequence/>
>> + </complexType>
>> + </element>
>> + <complexType name="ErrorCode">
>> + <sequence>
>> + <element name="minor" type="short"/>
>> + <element name="major" type="short"/>
>> + </sequence>
>> + </complexType>
>> + <element name="NoSuchCodeLit">
>> + <complexType>
>> + <sequence>
>> + <element name="code" type="x1:ErrorCode"/>
>> + </sequence>
>> + </complexType>
>> + </element>
>> + <element name="BadRecordLit" type="string"/>
>> + <complexType name="BadRecord">
>> + <sequence>
>> + <element name="reason" type="string"/>
>> + <element name="code" type="short"/>
>> + </sequence>
>> + </complexType>
>> + <complexType name="addNumbers">
>> + <sequence>
>> + <element name="arg0" type="int"/>
>> + <element name="arg1" type="int"/>
>> + </sequence>
>> + </complexType>
>> + <element name="addNumbers" type="x1:addNumbers"/>
>> + <complexType name="addNumbersResponse">
>> + <sequence>
>> + <element name="return" type="int"/>
>> + </sequence>
>> + </complexType>
>> + <element name="addNumbersResponse" type="x1:addNumbersResponse"/>
>> + <complexType name="stringStruct">
>> + <sequence>
>> + <element name="arg0" type="string"/>
>> + <element name="arg1" type="string"/>
>> + </sequence>
>> + </complexType>
>> + <element name="BareDocument" type="string"/>
>> + <element name="BareDocumentResponse">
>> + <complexType>
>> + <sequence>
>> + <element name="company" type="string"/>
>> + </sequence>
>> + <attribute name="id" type="int"/>
>> + </complexType>
>> + </element>
>> + </schema>
>> + </wsdl:types>
>> + <wsdl:message name="sayHiRequest">
>> + <wsdl:part name="in" element="x1:sayHi"/>
>> + </wsdl:message>
>> + <wsdl:message name="sayHiResponse">
>> + <wsdl:part name="out" element="x1:sayHiResponse"/>
>> + </wsdl:message>
>> + <wsdl:message name="greetMeRequest">
>> + <wsdl:part name="in" element="x1:greetMe"/>
>> + </wsdl:message>
>> + <wsdl:message name="greetMeResponse">
>> + <wsdl:part name="out" element="x1:greetMeResponse"/>
>> + </wsdl:message>
>> + <wsdl:message name="testNillableRequest">
>> + <wsdl:part name="in" element="x1:testNillable"/>
>> + </wsdl:message>
>> + <wsdl:message name="testNillableResponse">
>> + <wsdl:part name="out" element="x1:testNillableResponse"/>
>> + </wsdl:message>
>> + <wsdl:message name="greetMeLaterRequest">
>> + <wsdl:part name="in" element="x1:greetMeLater"/>
>> + </wsdl:message>
>> + <wsdl:message name="greetMeLaterResponse">
>> + <wsdl:part name="out" element="x1:greetMeLaterResponse"/>
>> + </wsdl:message>
>> + <wsdl:message name="greetMeSometimeRequest">
>> + <wsdl:part name="in" element="x1:greetMeSometime"/>
>> + </wsdl:message>
>> + <wsdl:message name="greetMeSometimeResponse">
>> + <wsdl:part name="out" element="x1:greetMeSometimeResponse"/>
>> + </wsdl:message>
>> + <wsdl:message name="greetMeOneWayRequest">
>> + <wsdl:part name="in" element="x1:greetMeOneWay"/>
>> + </wsdl:message>
>> + <wsdl:message name="testDocLitFaultRequest">
>> + <wsdl:part name="in" element="x1:testDocLitFault"/>
>> + </wsdl:message>
>> + <wsdl:message name="testDocLitFaultResponse">
>> + <wsdl:part name="out" element="x1:testDocLitFaultResponse"/>
>> + </wsdl:message>
>> + <wsdl:message name="NoSuchCodeLitFault">
>> + <wsdl:part name="NoSuchCodeLit" element="x1:NoSuchCodeLit"/>
>> + </wsdl:message>
>> + <wsdl:message name="BadRecordLitFault">
>> + <wsdl:part name="BadRecordLit" element="x1:BadRecordLit"/>
>> + </wsdl:message>
>> + <wsdl:message name="testDocLitBareRequest">
>> + <wsdl:part name="in" element="x1:BareDocument"/>
>> + </wsdl:message>
>> + <wsdl:message name="testDocLitBareResponse">
>> + <wsdl:part name="out" element="x1:BareDocumentResponse"/>
>> + </wsdl:message>
>> + <wsdl:portType name="Greeter">
>> + <wsdl:operation name="sayHi">
>> + <wsdl:input message="tns:sayHiRequest"/>
>> + <wsdl:output message="tns:sayHiResponse"/>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMe">
>> + <wsdl:input message="tns:greetMeRequest"/>
>> + <wsdl:output message="tns:greetMeResponse"/>
>> + </wsdl:operation>
>> + <wsdl:operation name="testNillable">
>> + <wsdl:input message="tns:testNillableRequest"/>
>> + <wsdl:output message="tns:testNillableResponse"/>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMeLater">
>> + <wsdl:input message="tns:greetMeLaterRequest"/>
>> + <wsdl:output message="tns:greetMeLaterResponse"/>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMeSometime">
>> + <wsdl:input message="tns:greetMeSometimeRequest"/>
>> + <wsdl:output message="tns:greetMeSometimeResponse"/>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMeOneWay">
>> + <wsdl:input message="tns:greetMeOneWayRequest"/>
>> + </wsdl:operation>
>> + <wsdl:operation name="testDocLitFault">
>> + <wsdl:input message="tns:testDocLitFaultRequest"/>
>> + <wsdl:output message="tns:testDocLitFaultResponse"/>
>> + <wsdl:fault name="NoSuchCodeLitFault" message="tns:NoSuchCodeLitFault"/>
>> + <wsdl:fault name="BadRecordLitFault" message="tns:BadRecordLitFault"/>
>> + </wsdl:operation>
>> +
>> + </wsdl:portType>
>> +
>> + <wsdl:portType name="DocLitBare">
>> + <wsdl:operation name="testDocLitBare">
>> + <wsdl:input name="testDocLitBareRequest" message="tns:testDocLitBareRequest"/>
>> + <wsdl:output name="testDocLitBareResponse" message="tns:testDocLitBareResponse"/>
>> + </wsdl:operation>
>> + </wsdl:portType>
>> + <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
>> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>> + <wsdl:operation name="sayHi">
>> + <soap:operation style="document"/>
>> + <wsdl:input>
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + <wsdl:output>
>> + <soap:body use="literal"/>
>> + </wsdl:output>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMe">
>> + <soap:operation style="document"/>
>> + <wsdl:input>
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + <wsdl:output>
>> + <soap:body use="literal"/>
>> + </wsdl:output>
>> + </wsdl:operation>
>> + <wsdl:operation name="testNillable">
>> + <soap:operation style="document"/>
>> + <wsdl:input>
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + <wsdl:output>
>> + <soap:body use="literal"/>
>> + </wsdl:output>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMeLater">
>> + <soap:operation style="document"/>
>> + <wsdl:input>
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + <wsdl:output>
>> + <soap:body use="literal"/>
>> + </wsdl:output>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMeSometime">
>> + <soap:operation style="document"/>
>> + <wsdl:input>
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + <wsdl:output>
>> + <soap:body use="literal"/>
>> + </wsdl:output>
>> + </wsdl:operation>
>> + <wsdl:operation name="greetMeOneWay">
>> + <soap:operation style="document"/>
>> + <wsdl:input>
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + </wsdl:operation>
>> + <wsdl:operation name="testDocLitFault">
>> + <soap:operation style="document"/>
>> + <wsdl:input>
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + <wsdl:output>
>> + <soap:body use="literal"/>
>> + </wsdl:output>
>> + <wsdl:fault name="NoSuchCodeLitFault">
>> + <soap:fault name="NoSuchCodeLitFault" use="literal"/>
>> + </wsdl:fault>
>> + <wsdl:fault name="BadRecordLitFault">
>> + <soap:fault name="BadRecordLitFault" use="literal"/>
>> + </wsdl:fault>
>> + </wsdl:operation>
>> +
>> + </wsdl:binding>
>> + <wsdl:binding name="Doc_Lit_Bare_SOAPBinding" type="tns:DocLitBare">
>> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>> + <wsdl:operation name="testDocLitBare">
>> + <soap:operation style="document" soapAction="http://apache.org/hello_world_soap_http/testDocLitBare"/>
>> + <wsdl:input name="testDocLitBareRequest">
>> + <soap:body use="literal"/>
>> + </wsdl:input>
>> + <wsdl:output name="testDocLitBareResponse">
>> + <soap:body use="literal"/>
>> + </wsdl:output>
>> + </wsdl:operation>
>> + </wsdl:binding>
>> +
>> +
>> + <wsdl:service name="SOAPService">
>> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
>> + </wsdl:port>
>> +
>> + <wsdl:port name="SoapPort1" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:7000/SoapContext/SoapPort"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> +
>> + <wsdl:service name="SOAPProviderService">
>> + <wsdl:port name="SoapProviderPort" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9003/SoapContext/SoapProviderPort"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> +
>> + <wsdl:service name="SOAPDispatchService">
>> + <wsdl:port name="SoapDispatchPort" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9006/SOAPDispatchService/SoapDispatchPort"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> +
>> + <wsdl:service name="SOAPService_DocLitBare">
>> + <wsdl:port name="SoapPort2" binding="tns:Doc_Lit_Bare_SOAPBinding">
>> + <soap:address location="http://localhost:7600/SoapContext/SoapPort"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> + <wsdl:service name="SOAPServiceAddressingDocLitBare">
>> + <wsdl:port name="SoapPort" binding="tns:Doc_Lit_Bare_SOAPBinding">
>> + <soap:address location="http://localhost:7600/SoapContext/SoapPort"/>
>> + <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> + <wsdl:service name="SOAPService_Test1">
>> + <wsdl:port name="SoapPort_Test1" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9100"/>
>> + </wsdl:port>
>> + <wsdl:port name="SoapPort_Test2" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9101"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> + <wsdl:service name="SOAPServiceAddressing">
>> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9008/SoapContext/SoapPort"/>
>> + <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> + <wsdl:service name="SOAPServiceConcurrencyTest">
>> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9009/SoapContext/SoapPort"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> + <wsdl:service name="SOAPServiceBogusAddressTest">
>> + <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="FOO"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> + <wsdl:service name="SOAPServiceMultiPortTypeTest">
>> + <wsdl:port name="GreeterPort" binding="tns:Greeter_SOAPBinding">
>> + <soap:address location="http://localhost:9020/MultiPort/GreeterPort"/>
>> + </wsdl:port>
>> + <wsdl:port name="DocLitBarePort" binding="tns:Doc_Lit_Bare_SOAPBinding">
>> + <soap:address location="http://localhost:9021/MultiPort/DocBarePort"/>
>> + </wsdl:port>
>> + </wsdl:service>
>> +</wsdl:definitions>
>> +
>>
>> Added: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml
>> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml?rev=1513427&view=auto
>> ==============================================================================
>> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml (added)
>> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralRespExceedLength.xml Tue Aug 13 10:37:58 2013
>> @@ -0,0 +1,20 @@
>> +<?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.
>> +-->
>> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><ns4:greetMeResponse xmlns:ns4="http://apache.org/hello_world_soap_http/types"><ns4:responseType>this is a greetMeResponse message which lenght exceed the maxLength restriction</ns4:responseType></ns4:greetMeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
>>
>> Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml
>> URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml?rev=1513427&r1=1513426&r2=1513427&view=diff
>> ==============================================================================
>> --- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml (original)
>> +++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/resources/XML_GreetMeDocLiteralResp.xml Tue Aug 13 10:37:58 2013
>> @@ -1,2 +1,2 @@
>> <?xml version="1.0" encoding="utf-8" ?>
>> -<ns4:greetMeResponse xmlns:ns4="http://apache.org/hello_world_soap_http/types"><ns4:responseType>TestXMLBindingProviderMessage</ns4:responseType></ns4:greetMeResponse>
>> \ No newline at end of file
>> +<ns4:greetMeResponse xmlns:ns4="http://apache.org/hello_world_xml_http/wrapped/types"><ns4:responseType>TestXMLBindingProviderMessage</ns4:responseType></ns4:greetMeResponse>
>>
>>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>