You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marc Schipperheyn <ma...@orangebits.nl> on 2010/07/27 13:06:53 UTC
Problems using EU CheckVatService
Hi,
I'm new to CXF and I'm having a lot of problems trying to consume the
checkVat webservice from the EU
(http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl)
After much experimentation I finally got past the can't find exception
by specifying the xmlns on jaxws bean.
Generated base code with wsdl2java.
This is my code now
package nl.mysite.service;
import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVat;
import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVatResponse;
@WebService(
targetNamespace="http://ec.europa.eu/taxation_customs/vies/services/checkVatService",
name="urn:ec.europa.eu:taxud:vies:services:checkVat")
public interface CheckVatService {
@WebMethod
public CheckVatResponse checkVat(@WebParam CheckVat params);
}
ApplicationContext.xml
<jaxws:client id="vatClient"
serviceClass="nl.msw.compraventa.service.CheckVatService"
address="http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
wsdlLocation="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
xmlns:ns="urn:ec.europa.eu:taxud:vies:services:checkVat"
name="ns:checkVatService"
endpointName="ns:checkVatPort"
serviceName="ns:checkVatService"
/>
I'm getting this error on the vatNumber field when Spring tries to set
the CheckVatService as a dependency on another bean. No clue why. The
error message is not particularly helpful either. Don't see any
difference between the countryCode field that passes correctly and the
vatNumber field that fails. But then, I'm a newbie at this. A frustrated
one.
java.lang.NullPointerException
at org.apache.cxf.common.util.ASMHelper.getClassCode(ASMHelper.java:91)
at
org.apache.cxf.jaxws.WrapperClassGenerator.generateMessagePart(WrapperClassGenerator.java:286)
at
org.apache.cxf.jaxws.WrapperClassGenerator.createWrapperClass(WrapperClassGenerator.java:235)
at
org.apache.cxf.jaxws.WrapperClassGenerator.generate(WrapperClassGenerator.java:138)
at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.generatedWrapperBeanClass(JaxWsServiceFactoryBean.java:608)
at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass(JaxWsServiceFactoryBean.java:579)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426)
Any ideas?
Kind regards,
Marc
Re: Problems using EU CheckVatService
Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 28 July 2010 5:32:28 am Marc Schipperheyn wrote:
> Hi Daniel,
>
> That did the trick. I did generate the code with wsdl2java, but the last
> part is the hookup through Spring with your local service class.
My point is why did you hand generate a service class and not use the one that
the wsdl2java created? That's what I'm confused about. If you would
have used the wsdl2java created service interface, all the annotations would
have been there correctly.
Dan
> That's
> where it went wrong.
>
> Thanks for helping me.
>
> Regarding CXF: just throwing a nullpointer when there is some config
> issue: it all could all be a lot more helpful. E.g. listing possible
> causes when this kind of thing happens.The same thing with the service
> not found because of namespace isssues. Not very well documented for the
> newbies.
>
> For posterity, this is my spring config that works.
> I generated the java stubclasses throguh
> wsdl2java
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xmlns:context="http://www.springframework.org/schema/context"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-3.0.xsd
> http://cxf.apache.org/jaxws
> http://cxf.apache.org/schemas/jaxws.xsd">
>
> <jaxws:client id="vatClient"
> serviceClass="nl.msw.compraventa.service.CheckVatService"
>
> address="http://ec.europa.eu/taxation_customs/vies/services/checkVatService
> "
>
> wsdlLocation="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsd
> l" xmlns:ns="urn:ec.europa.eu:taxud:vies:services:checkVat"
> name="ns:checkVatService"
> endpointName="ns:checkVatPort"
> serviceName="ns:checkVatService"
> />
> </beans>
>
> Service inteface:
>
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
>
> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVat;
> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVatResponse;
>
> @WebService(
>
> targetNamespace="http://ec.europa.eu/taxation_customs/vies/services/checkVa
> tService", name="urn:ec.europa.eu:taxud:vies:services:checkVat")
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface CheckVatService {
>
> @WebMethod(operationName="checkVat")
> public CheckVatResponse checkVat(@WebParam CheckVat params);
> }
>
> Cheers,
>
> Marc
>
> On 27-7-2010 20:47, Daniel Kulp wrote:
> > @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Re: Problems using EU CheckVatService
Posted by Marc Schipperheyn <ma...@orangebits.nl>.
Hi Daniel,
That did the trick. I did generate the code with wsdl2java, but the last
part is the hookup through Spring with your local service class. That's
where it went wrong.
Thanks for helping me.
Regarding CXF: just throwing a nullpointer when there is some config
issue: it all could all be a lot more helpful. E.g. listing possible
causes when this kind of thing happens.The same thing with the service
not found because of namespace isssues. Not very well documented for the
newbies.
For posterity, this is my spring config that works.
I generated the java stubclasses throguh
wsdl2java
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:client id="vatClient"
serviceClass="nl.msw.compraventa.service.CheckVatService"
address="http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
wsdlLocation="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
xmlns:ns="urn:ec.europa.eu:taxud:vies:services:checkVat"
name="ns:checkVatService"
endpointName="ns:checkVatPort"
serviceName="ns:checkVatService"
/>
</beans>
Service inteface:
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVat;
import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVatResponse;
@WebService(
targetNamespace="http://ec.europa.eu/taxation_customs/vies/services/checkVatService",
name="urn:ec.europa.eu:taxud:vies:services:checkVat")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface CheckVatService {
@WebMethod(operationName="checkVat")
public CheckVatResponse checkVat(@WebParam CheckVat params);
}
Cheers,
Marc
On 27-7-2010 20:47, Daniel Kulp wrote:
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>
--
M.Schipperheyn
/Principal Consultant/
Orange bits
www.orangebits.nl <http://www.orangebits.nl> t: +31 6 218 03 003
marc@orangebits.nl <ma...@orangebits.nl> skype: orangebits
Re: Problems using EU CheckVatService
Posted by Daniel Kulp <dk...@apache.org>.
I think you are missing an annotation on the SEI:
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
Again, when starting with a WSDL, it's MUCH better to use wsdl2java to
generate the interface and types to make sure everything maps correctly.
Dan
On Tuesday 27 July 2010 7:06:53 am Marc Schipperheyn wrote:
> Hi,
>
> I'm new to CXF and I'm having a lot of problems trying to consume the
> checkVat webservice from the EU
> (http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl)
>
> After much experimentation I finally got past the can't find exception
> by specifying the xmlns on jaxws bean.
>
> Generated base code with wsdl2java.
>
> This is my code now
> package nl.mysite.service;
>
> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVat;
> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVatResponse;
>
> @WebService(
>
> targetNamespace="http://ec.europa.eu/taxation_customs/vies/services/checkVa
> tService", name="urn:ec.europa.eu:taxud:vies:services:checkVat")
> public interface CheckVatService {
>
> @WebMethod
> public CheckVatResponse checkVat(@WebParam CheckVat params);
> }
>
> ApplicationContext.xml
> <jaxws:client id="vatClient"
> serviceClass="nl.msw.compraventa.service.CheckVatService"
>
> address="http://ec.europa.eu/taxation_customs/vies/services/checkVatService
> "
>
> wsdlLocation="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsd
> l" xmlns:ns="urn:ec.europa.eu:taxud:vies:services:checkVat"
> name="ns:checkVatService"
> endpointName="ns:checkVatPort"
> serviceName="ns:checkVatService"
> />
>
> I'm getting this error on the vatNumber field when Spring tries to set
> the CheckVatService as a dependency on another bean. No clue why. The
> error message is not particularly helpful either. Don't see any
> difference between the countryCode field that passes correctly and the
> vatNumber field that fails. But then, I'm a newbie at this. A frustrated
> one.
>
> java.lang.NullPointerException
> at
> org.apache.cxf.common.util.ASMHelper.getClassCode(ASMHelper.java:91) at
> org.apache.cxf.jaxws.WrapperClassGenerator.generateMessagePart(WrapperClass
> Generator.java:286) at
> org.apache.cxf.jaxws.WrapperClassGenerator.createWrapperClass(WrapperClassG
> enerator.java:235) at
> org.apache.cxf.jaxws.WrapperClassGenerator.generate(WrapperClassGenerator.j
> ava:138) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.generatedWrapperBeanCl
> ass(JaxWsServiceFactoryBean.java:608) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass(JaxWsSer
> viceFactoryBean.java:579) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFro
> mWSDL(ReflectionServiceFactoryBean.java:426)
>
> Any ideas?
>
> Kind regards,
>
> Marc
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Re: Problems using EU CheckVatService
Posted by Marc Schipperheyn <ma...@orangebits.nl>.
Hmm, yes, but it really should be dead simple this, shouldn't it and
according to the manual, this seems the way to go?
What would be the absolute dead simplest way to get this to work?
Thanks,
Marc
On 27-7-2010 14:47, Glen Mazza wrote:
> For a simple SOAP client you shouldn't need an AppContext.xml file--it might
> be better to get your SOAP client working first[1] and add your
> customization files later, and then only if necessary.
>
> HTH,
> Glen
>
> [1] http://www.jroller.com/gmazza/entry/soap_client_tutorial
>
>
> Marc Schipperheyn wrote:
>
>> Hi,
>>
>> I'm new to CXF and I'm having a lot of problems trying to consume the
>> checkVat webservice from the EU
>> (http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl)
>>
>> After much experimentation I finally got past the can't find exception
>> by specifying the xmlns on jaxws bean.
>>
>> Generated base code with wsdl2java.
>>
>> This is my code now
>> package nl.mysite.service;
>>
>> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVat;
>> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVatResponse;
>>
>> @WebService(
>>
>> targetNamespace="http://ec.europa.eu/taxation_customs/vies/services/checkVatService",
>> name="urn:ec.europa.eu:taxud:vies:services:checkVat")
>> public interface CheckVatService {
>>
>> @WebMethod
>> public CheckVatResponse checkVat(@WebParam CheckVat params);
>> }
>>
>> ApplicationContext.xml
>> <jaxws:client id="vatClient"
>> serviceClass="nl.msw.compraventa.service.CheckVatService"
>>
>> address="http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
>>
>> wsdlLocation="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
>> xmlns:ns="urn:ec.europa.eu:taxud:vies:services:checkVat"
>> name="ns:checkVatService"
>> endpointName="ns:checkVatPort"
>> serviceName="ns:checkVatService"
>> />
>>
>> I'm getting this error on the vatNumber field when Spring tries to set
>> the CheckVatService as a dependency on another bean. No clue why. The
>> error message is not particularly helpful either. Don't see any
>> difference between the countryCode field that passes correctly and the
>> vatNumber field that fails. But then, I'm a newbie at this. A frustrated
>> one.
>>
>> java.lang.NullPointerException
>> at
>> org.apache.cxf.common.util.ASMHelper.getClassCode(ASMHelper.java:91)
>> at
>> org.apache.cxf.jaxws.WrapperClassGenerator.generateMessagePart(WrapperClassGenerator.java:286)
>> at
>> org.apache.cxf.jaxws.WrapperClassGenerator.createWrapperClass(WrapperClassGenerator.java:235)
>> at
>> org.apache.cxf.jaxws.WrapperClassGenerator.generate(WrapperClassGenerator.java:138)
>> at
>> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.generatedWrapperBeanClass(JaxWsServiceFactoryBean.java:608)
>> at
>> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass(JaxWsServiceFactoryBean.java:579)
>> at
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426)
>>
>> Any ideas?
>>
>> Kind regards,
>>
>> Marc
>>
>>
>>
>
--
M.Schipperheyn
/Principal Consultant/
Orange bits
www.orangebits.nl <http://www.orangebits.nl> t: +31 6 218 03 003
marc@orangebits.nl <ma...@orangebits.nl> skype: orangebits
Re: Problems using EU CheckVatService
Posted by Glen Mazza <gl...@gmail.com>.
For a simple SOAP client you shouldn't need an AppContext.xml file--it might
be better to get your SOAP client working first[1] and add your
customization files later, and then only if necessary.
HTH,
Glen
[1] http://www.jroller.com/gmazza/entry/soap_client_tutorial
Marc Schipperheyn wrote:
>
> Hi,
>
> I'm new to CXF and I'm having a lot of problems trying to consume the
> checkVat webservice from the EU
> (http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl)
>
> After much experimentation I finally got past the can't find exception
> by specifying the xmlns on jaxws bean.
>
> Generated base code with wsdl2java.
>
> This is my code now
> package nl.mysite.service;
>
> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVat;
> import eu.europa.ec.taxud.vies.services.checkvat.types.CheckVatResponse;
>
> @WebService(
>
> targetNamespace="http://ec.europa.eu/taxation_customs/vies/services/checkVatService",
> name="urn:ec.europa.eu:taxud:vies:services:checkVat")
> public interface CheckVatService {
>
> @WebMethod
> public CheckVatResponse checkVat(@WebParam CheckVat params);
> }
>
> ApplicationContext.xml
> <jaxws:client id="vatClient"
> serviceClass="nl.msw.compraventa.service.CheckVatService"
>
> address="http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
>
> wsdlLocation="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"
> xmlns:ns="urn:ec.europa.eu:taxud:vies:services:checkVat"
> name="ns:checkVatService"
> endpointName="ns:checkVatPort"
> serviceName="ns:checkVatService"
> />
>
> I'm getting this error on the vatNumber field when Spring tries to set
> the CheckVatService as a dependency on another bean. No clue why. The
> error message is not particularly helpful either. Don't see any
> difference between the countryCode field that passes correctly and the
> vatNumber field that fails. But then, I'm a newbie at this. A frustrated
> one.
>
> java.lang.NullPointerException
> at
> org.apache.cxf.common.util.ASMHelper.getClassCode(ASMHelper.java:91)
> at
> org.apache.cxf.jaxws.WrapperClassGenerator.generateMessagePart(WrapperClassGenerator.java:286)
> at
> org.apache.cxf.jaxws.WrapperClassGenerator.createWrapperClass(WrapperClassGenerator.java:235)
> at
> org.apache.cxf.jaxws.WrapperClassGenerator.generate(WrapperClassGenerator.java:138)
> at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.generatedWrapperBeanClass(JaxWsServiceFactoryBean.java:608)
> at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass(JaxWsServiceFactoryBean.java:579)
> at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426)
>
> Any ideas?
>
> Kind regards,
>
> Marc
>
>
--
View this message in context: http://cxf.547215.n5.nabble.com/Problems-using-EU-CheckVatService-tp2255695p2255776.html
Sent from the cxf-user mailing list archive at Nabble.com.