You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jasminadesai <ja...@yahoo.com> on 2013/05/09 22:56:28 UTC

cxf 2.2.1 schema validation throws error

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.

Re: cxf 2.2.1 schema validation throws error

Posted by jasminadesai <ja...@yahoo.com>.
Thanks Dan.
I upgraded to 2.3.11 without making any code changes in my project and that
is where I can upgrade upto because of some of the code I have.

But I still get the same error.

Here is the stack trace:
12:57:21,565  WARN PhaseInterceptorChain:400 - Application
{http://webservice.api.tx.service.com/}TransactionService#{http://test.webservice.com/transaction"}resolveAddress
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: 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 [].
	at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:159)
	at
org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:86)
	at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:133)
	at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:61)
	at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
	at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:102)
	at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:464)
	at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:188)
	at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
	at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
	at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
	at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
	... 30 more


This is my web service endpoint:

 <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.tx.api.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/ISTxTransactionService_schema1.xsd</jaxws:schemaLocation>
        </jaxws:schemaLocations>
    </jaxws:endpoint>


After removing schema-validation-enabled and the xsd location, everything
works just fine.
Not sure if I am missing anything.

Regards,
Jasmina



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

Re: cxf 2.2.1 schema validation throws error

Posted by Daniel Kulp <dk...@apache.org>.
We'd like need to see a test case using a more recent version of CXF.   2.2.1 is not supported anymore.

Dan


On May 15, 2013, at 2:44 PM, jasminadesai <ja...@yahoo.com> wrote:

> Thanks Dennis.
> 
> I changed the class to have Double properties instead of primitive double.
> Now the wsdl shows minOccurs="0" for those double properties.
> 
> But I still get the same fault. I debugged too and the control does not even
> come to the first line of my web service method. I think, the flow is
> intercepted in between by cxf and that is where it fails.
> 
> 
> Here is the exception:
> 
> May 15, 2013 11:25:27 AM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Application has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: 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.
>             at
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:152)
> 	at
> org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:83)
> 	at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:126)
> 	at
> org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55)
> 	at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
> 	at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at
> org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
> 	at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
> 	at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 	at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
> 	at
> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99)
> 	at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:357)
> 	at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:183)
> 	at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:163)
> 	at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:141)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
> 	at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.IllegalArgumentException: wrong number of arguments
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166)
> 	at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
> 	... 29 more
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-1-schema-validation-throws-error-tp5727471p5727741.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: cxf 2.2.1 schema validation throws error

Posted by jasminadesai <ja...@yahoo.com>.
Thanks Dennis.

I changed the class to have Double properties instead of primitive double.
Now the wsdl shows minOccurs="0" for those double properties.

But I still get the same fault. I debugged too and the control does not even
come to the first line of my web service method. I think, the flow is
intercepted in between by cxf and that is where it fails.


Here is the exception:

May 15, 2013 11:25:27 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: 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.
             at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:152)
	at
org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:83)
	at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:126)
	at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55)
	at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
	at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99)
	at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:357)
	at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:183)
	at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:163)
	at
org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:141)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166)
	at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
	... 29 more



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

Re: cxf 2.2.1 schema validation throws error

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
I believe that's because these are primitive values rather than objects. 
More JAXB user friendliness. If you change them to be of type Double 
rather than double it should make the elements optional in the schema.

I don't understand how a schema validation problem causes your fault, 
though. Here's what you showed us:

<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>

That looks like it's coming from your service code. Can you add some 
logging to where you generate the fault to see what's happening to cause it?

   - Dennis

On 05/10/2013 05:39 PM, jasminadesai wrote:
> Hmm...that is strange.
> All others that have the same XmlElement definition do have minOccurs="0".
> But the latitude and longitude properties do not have minOccurs="0". I am
> now confused.
>
> This xsd is generated by cxf. Any diea why did it not add minOccurs="0".
>
> Regards,
> Jasmina
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-1-schema-validation-throws-error-tp5727471p5727484.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: cxf 2.2.1 schema validation throws error

Posted by jasminadesai <ja...@yahoo.com>.
Hmm...that is strange.
All others that have the same XmlElement definition do have minOccurs="0".
But the latitude and longitude properties do not have minOccurs="0". I am
now confused.

This xsd is generated by cxf. Any diea why did it not add minOccurs="0".

Regards,
Jasmina



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

Re: cxf 2.2.1 schema validation throws error

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Your schema has
           <xs:element name="latitude" nillable="true" type="xs:double"/>
           <xs:element name="longitude" nillable="true" type="xs:double"/>

Those elements don't have minOccurs="0", so I think you need those elements in your request if you enabled schema validation.
-------------
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-5-10, at 下午1:08, jasminadesai wrote:

> Also, the flow does not even reach my web service method. The error is thrown
> even before that because of the schema validation. If I disable the schema
> validation, everything works fine.
> 
> 
> Regards,
> Jasmina
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-1-schema-validation-throws-error-tp5727471p5727482.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: cxf 2.2.1 schema validation throws error

Posted by jasminadesai <ja...@yahoo.com>.
Also, the flow does not even reach my web service method. The error is thrown
even before that because of the schema validation. If I disable the schema
validation, everything works fine.


Regards,
Jasmina



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

Re: cxf 2.2.1 schema validation throws error

Posted by jasminadesai <ja...@yahoo.com>.
Thanks Dennis.

Please find below the address class. The web service method actually just
takes address as a parameter and unfortunately that itself is passed as
null. The xsd was auto generated from the java code by the cxf maven plugin.

---------------------------------------------------------------------------


package com.soap.webservice.api;

import javax.xml.bind.annotation.XmlElement;
import java.util.Date;
import java.util.List;


public class Address {

    private String address1;

    private String address2;

    private String fullCode;

    private double latitude;

    private double longitude;

    private String country = "US";

    private List<String> locations;

    private Date resolvedDate;


    public Address() {
        setAddress1("");
        setAddress2("");
    }


    public Address(String address1, String address2) {
        this.address1 = address1 == null ? "" : address1.trim();
        this.address2 = address2 == null ? "" : address2.trim();
    }


    public Address(String address, String city, String state, String zip) {
        if (zip == null)
            zip = "";
        this.address1 = address.trim();
        this.address2 = city.trim() + ", " + state.trim() + " " +
zip.trim();
    }


    @XmlElement(required = false, nillable = true)
    public List<String> getLocations() {
        return locations;
    }


    public void setLocations(List<String> locations) {
        this.locations = locations;
    }


    @XmlElement(required = false, nillable = true)
    public Date getResolvedDate() {
        return resolvedDate;
    }

    public void setResolvedDate(Date resolvedDate) {
        this.resolvedDate = resolvedDate;
    }


    @XmlElement(required = false, nillable = true)
    public String getAddress1() {
        return address1;
    }


    public void setAddress1(String address1) {
        this.address1 = (address1 == null) ? "" : address1;
    }


    @XmlElement(required = true, nillable = false)
    public String getAddress2() {
        return address2;
    }


    public void setAddress2(String address2) {
        this.address2 = (address2 == null) ? "" : address2;
    }


    public void setFullCode(String fullCode) {
        this.fullCode = fullCode;
    }


    @XmlElement(required = false, nillable = true)
    public String getFullCode() {
        return fullCode;
    }


    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }


    @XmlElement(required = false, nillable = true)
    public double getLatitude() {
        return latitude;
    }


    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }


    @XmlElement(required = false, nillable = true)
    public double getLongitude() {
        return longitude;
    }


    public int hashCode() {
        return (address1.hashCode() + address2.hashCode()) / 2;
    }


    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        try {
            Address castObj = (Address) obj;
            if (!castObj.getAddress1().equals(getAddress1()))
                return false;
            if (!castObj.getAddress2().equals(getAddress2()))
                return false;
            return true;
        } catch (ClassCastException e) {
            return false;
        }
    }


    public String toString() {
        return address1 + ", " + address2 + ", " + country;
    }

    public void setCountry(String country) {
        if (country == null || country.length() == 0) {
            this.country = "US";
        } else {
            this.country = country.toUpperCase();
        }
    }

    @XmlElement(required = false, nillable = true)
    public String getCountry() {
        return country;
    }
}




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

Re: cxf 2.2.1 schema validation throws error

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
Looks right for your message.

You can perhaps put some debugging in your code that generates the 
TransactionException fault to tell you exactly what causes the fault. 
 From the message I'm guessing it's that the expected Address parameter 
is not found, which is why I thought the elementFormDefault might be a 
problem. Unfortunately JAXB unmarshalling just ignores anything it 
doesn't know how to handle, and also ignores when required elements are 
missing, so if there's anything at all off in your XML you end up with 
null values passed to your code without any warning.

Aside from that, if you can show us the JAXB annotations on the Address 
class that would confirm that the schema matches with the JAXB 
annotations are saying.

   - Dennis

On 05/10/2013 04:17 PM, jasminadesai wrote:
> Here is the start of my schema definition:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http://test.webservice.com/transaction"
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> targetNamespace="http://speedtax.com/transaction">
>
>
> My schema and wsdl is auto generated from the java code and the soapui
> request was created by importing the wsdl.
>
> Is anything missing from what I am doing?
>
> Regards,
> Jasmina
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-1-schema-validation-throws-error-tp5727471p5727479.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: cxf 2.2.1 schema validation throws error

Posted by jasminadesai <ja...@yahoo.com>.
Here is the start of my schema definition:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://test.webservice.com/transaction"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://speedtax.com/transaction">


My schema and wsdl is auto generated from the java code and the soapui
request was created by importing the wsdl.

Is anything missing from what I am doing?

Regards,
Jasmina



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

Re: cxf 2.2.1 schema validation throws error

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
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.
>


Re: cxf 2.2.1 schema validation throws error

Posted by jasminadesai <ja...@yahoo.com>.
I had tried with 2.6.6 and 2.7 also. But I get the same error message.
Not sure what is wrong. I have wasted 3 good days on this issue with no
luck.

Regards,
Jasmina



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

Re: cxf 2.2.1 schema validation throws error

Posted by Jason Pell <ja...@pellcorp.com>.
any chance you can try a more recent version of cxf?


On Fri, May 10, 2013 at 6:56 AM, jasminadesai <ja...@yahoo.com>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.
>

Re: cxf 2.2.1 schema validation throws error

Posted by Daniel Kulp <dk...@apache.org>.
Please create a test case for this.   I have no idea what would be causing this.

Dan


On Jun 4, 2013, at 3:54 PM, lukast <l....@gmail.com> wrote:

> Hi,
> 
> I have exactly the same problem as described above. Using newest 2.7.5
> version. Without schema validation enabled everything works without
> problems. But with schema-validation-enabled:
> 
> <jaxws:properties>
> 	<entry key="schema-validation-enabled" value="true" />
> </jaxws:properties>
> 
> and manually provided xsd:
> 
> <jaxws:schemaLocations>
> 	<jaxws:schemaLocation>my.xsd</jaxws:schemaLocation>
> </jaxws:schemaLocations>
> 
> the same error occurs:
> 
> "Wrong number of arguments..."
> 
> I have spent couple of hours trying to debug through cxf source code but
> without success. I must admit that schema is manually provided and I am
> cetrain that it's correct, because it's exactly the same as the one
> automatically generated by cxf. WSDL generated is also (1:1) the same as the
> one cxf generates without manually provided schema.   
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-1-schema-validation-throws-error-tp5727471p5728749.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: cxf 2.2.1 schema validation throws error

Posted by lukast <l....@gmail.com>.
Hi,

I have exactly the same problem as described above. Using newest 2.7.5
version. Without schema validation enabled everything works without
problems. But with schema-validation-enabled:

<jaxws:properties>
	<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>

and manually provided xsd:

<jaxws:schemaLocations>
	<jaxws:schemaLocation>my.xsd</jaxws:schemaLocation>
</jaxws:schemaLocations>

the same error occurs:

"Wrong number of arguments..."

I have spent couple of hours trying to debug through cxf source code but
without success. I must admit that schema is manually provided and I am
cetrain that it's correct, because it's exactly the same as the one
automatically generated by cxf. WSDL generated is also (1:1) the same as the
one cxf generates without manually provided schema.   



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