Hi Jasmina,

You don't show the start of your schema definition. Is it using elementFormDefault="qualified" on the schema element? That's a common option, and it would mean that your XML message is wrong (since the Address element and subelements are not namespaced).

  - Dennis

Dennis M. Sosnoski
Java SOA and Web Services Consulting <http://www.sosnoski.com/consult.html>
CXF and Web Services Security Training <http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>

On 05/10/2013 08:56 AM, jasminadesai wrote:
I am using cxf 2.2.1 for my soap ws.
I have a java first approach.

*Here is the endpoint declaration:*
  <jaxws:endpoint id="transactionWebService"
implementor="#transactionServiceEndpoint"
                     address="/TransactionService">
         <jaxws:inInterceptors>
             <ref bean="logInbound"/>
             <bean
class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
             <bean
class="com.soap.webservice.security.TimeStampedWSS4JInterceptor">
                 <constructor-arg>
                     <map>
                         <entry key="action" value="UsernameToken
Timestamp"/>
                         <entry key="passwordType" value="PasswordText"/>
                         <entry key="passwordCallbackRef">
                             <ref bean="authHandler"/>
                         </entry>
                     </map>
                 </constructor-arg>
             </bean>
         </jaxws:inInterceptors>
         <jaxws:outInterceptors>
             <ref bean="logOutbound"/>
         </jaxws:outInterceptors>
         <jaxws:properties>
             <entry key="schema-validation-enabled" value="true"/>
         </jaxws:properties>
         <jaxws:schemaLocations>
<jaxws:schemaLocation>/WEB-INF/Schema.xsd</jaxws:schemaLocation>
         </jaxws:schemaLocations>
     </jaxws:endpoint>


*Here are snippets from my xsd:*
<xs:element name="ResolveAddressResult" type="tns:resolveAddressResult"/>
<xs:element name="resolveAddress" type="tns:resolveAddress"/>
<xs:element name="resolveAddressResponse"
type="tns:resolveAddressResponse"/>
<xs:complexType name="address">
         <xs:sequence>
             <xs:element minOccurs="0" name="address1" nillable="true"
type="xs:string"/>
             <xs:element name="address2" type="xs:string"/>
             <xs:element minOccurs="0" name="country" nillable="true"
type="xs:string"/>
             <xs:element minOccurs="0" name="fullCode" nillable="true"
type="xs:string"/>
             <xs:element maxOccurs="unbounded" minOccurs="0" name="locations"
nillable="true" type="xs:string"/>
             <xs:element name="latitude" nillable="true" type="xs:double"/>
             <xs:element name="longitude" nillable="true" type="xs:double"/>
             <xs:element minOccurs="0" name="resolvedDate" nillable="true"
type="xs:dateTime"/>
         </xs:sequence>
     </xs:complexType>
<xs:complexType name="resolveAddress">
         <xs:sequence>
             <xs:element minOccurs="0" name="Address" type="tns:address"/>
         </xs:sequence>
     </xs:complexType>
     <xs:complexType name="resolveAddressResponse">
         <xs:sequence>
             <xs:element minOccurs="0" name="ResolveAddressResult"
type="tns:resolveAddressResult"/>
         </xs:sequence>
     </xs:complexType>
     <xs:complexType name="resolveAddressResult">
         <xs:sequence>
             <xs:element maxOccurs="unbounded" minOccurs="0" name="locations"
nillable="true" type="tns:location"/>
             <xs:element minOccurs="0" name="resolvedAddress"
type="tns:fullAddress"/>
             <xs:element minOccurs="0" name="resultType"
type="tns:resolveAddressResultType"/>
         </xs:sequence>
     </xs:complexType>


*Here are some snippets from my wsdl:*

<wsdl:message name="resolveAddressResponse">
     <wsdl:part name="parameters" element="tns:resolveAddressResponse">
     </wsdl:part>
   </wsdl:message>


<wsdl:message name="resolveAddress">
     <wsdl:part name="parameters" element="tns:resolveAddress">
     </wsdl:part>
   </wsdl:message>

  <wsdl:operation name="resolveAddress">
       <wsdl:input name="resolveAddress" message="tns:resolveAddress">
     </wsdl:input>
       <wsdl:output name="resolveAddressResponse"
message="tns:resolveAddressResponse">
     </wsdl:output>
       <wsdl:fault name="TransactionException"
message="tns:TransactionException">
     </wsdl:fault>
     </wsdl:operation>

<wsdl:operation name="resolveAddress">
       <soap:operation soapAction="" style="document"/>
       <wsdl:input name="resolveAddress">
         <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="resolveAddressResponse">
         <soap:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="TransactionException">
         <soap:fault name="TransactionException" use="literal"/>
       </wsdl:fault>
     </wsdl:operation>


*When I try to call the resolveAddress method from soapui, here is what I
pass (username and password are passed in the headers)*

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:tran="http://test.webservice.com/transaction";>
    <soapenv:Header/>
    <soapenv:Body>
       <tran:resolveAddress>
          <Address>
             <address1>4 West Park</address1>
             <address2>Irvine, CA 92612</address2>
           </Address>
       </tran:resolveAddress>
    </soapenv:Body>
</soapenv:Envelope>


*I get the following error:*

<faultstring>wrong number of arguments while invoking public
com.soap.webservice.api.ResolveAddressResult com. soap.webservice.api.
TransactionServiceEndpoint.resolveAddress(com. soap.webservice.api.Address)
throws com. soap.webservice.api.TransactionException with params
null.</faultstring>

Am I missing anything? My wsdl is generated by cxf on the fly.


Regards,
Jasmina





--
View this message in 
context:http://cxf.547215.n5.nabble.com/cxf-2-2-1-schema-validation-throws-error-tp5727471.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to