Hi,
I'm doing java to wsdl using cxf 2.0.3 and jaxb 2.0 on Java 5, running on
Tomcat and I have turned on schema validation. I would like to use
document/literal/wrapped, but when I do I get the following error:

Unmarshalling Error: cvc-elt.1: Cannot find the declaration of element
'theInt'.

Here's my interface and class:

@WebService(targetNamespace="http://test.org/";)
public interface IalWebServiceTest {
    public void testInt(@WebParam(name="theInt")int myInt) throws
RuntimeException;
}

@WebService(targetNamespace="http://test.org/";)
public class WebServiceTestImpl implements IalWebServiceTest {
    public void testInt(int myInt){
        System.out.println("myInt = " + myInt);
    }
}

And my endpoint is configured using spring:

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:tx="http://www.springframework.org/schema/tx";
       xmlns:aop="http://www.springframework.org/schema/aop";
       xmlns:jaxws="http://cxf.apache.org/jaxws";
       xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>

    <import resource="classpath:META-INF/cxf/cxf.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>

    <tx:annotation-driven transaction-manager="transactionManager"/>

    <bean id="ialImpl"
          class="test.provider.WebServiceTestImpl">
    </bean>

    <jaxws:endpoint
        id="ial"
        address="/se"
        implementor="#ialImpl">
        <jaxws:properties>
            <entry key="schema-validation-enabled" value="true" />
        </jaxws:properties>
    </jaxws:endpoint>
</beans>


Here's the generated wsdl:

<?xml version="1.0" encoding="utf-8"?><wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:tns="http://test.org/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";
name="WebServiceTestImplService" targetNamespace="http://test.org/";>
  <wsdl:types>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified" targetNamespace="http://test.org/";
xmlns:tns="http://test.org/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<xsd:element name="testInt" type="tns:testInt"/>
<xsd:complexType name="testInt">
<xsd:sequence>
<xsd:element name="theInt" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="testIntResponse" type="tns:testIntResponse"/>
<xsd:complexType name="testIntResponse">
<xsd:sequence/>
</xsd:complexType>
</xsd:schema>
  </wsdl:types>

  <wsdl:message name="testIntResponse">
    <wsdl:part element="tns:testIntResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="testInt">
    <wsdl:part element="tns:testInt" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="IalWebServiceTest">

    <wsdl:operation name="testInt">
      <wsdl:input message="tns:testInt" name="testInt">
    </wsdl:input>
      <wsdl:output message="tns:testIntResponse" name="testIntResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="WebServiceTestImplServiceSoapBinding"
type="tns:IalWebServiceTest">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

    <wsdl:operation name="testInt">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="testInt">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="testIntResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>

  </wsdl:binding>
  <wsdl:service name="WebServiceTestImplService">
    <wsdl:port binding="tns:WebServiceTestImplServiceSoapBinding"
name="WebServiceTestImplPort">
      <soap:address location="http://localhost:8080/test/ws/se"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Here's a list of the cxf jar's in my project:
cxf-api-2.0.3-incubator.jar
cxf-common-schemas-2.0.3-incubator.jar
cxf-common-utilities-2.0.3-incubator.jar
cxf-rt-bindings-soap-2.0.3-incubator.jar
cxf-rt-bindings-xml-2.0.3-incubator.jar
cxf-rt-core-2.0.3-incubator.jar
cxf-rt-databinding-jaxb-2.0.3-incubator.jar
cxf-rt-frontend-jaxws-2.0.3-incubator.jar
cxf-rt-frontend-simple-2.0.3-incubator.jar
cxf-rt-transports-http-2.0.3-incubator.jar
cxf-rt-ws-security-2.0.3-incubator.jar
cxf-tools-common-2.0.3-incubator.jar

When I use just document/literal (i.e. I add "@SOAPBinding(parameterStyle =
SOAPBinding.ParameterStyle.BARE)" to my interface and class), I don't get
the error and the message prints to system.out.

Thanks for any help you can give.
-- 
View this message in context: 
http://www.nabble.com/Validation-error-using-document-literal-wrapped-tp14936324p14936324.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to