Dear all,
Please help me on this.
I am getting following error when I try to connect to PayPal web service
with my wsdl2java generated client codes.
*=================================================*
*INFO: Creating Service {urn:ebay:api:PayPalAPI}PayPalAPIInterfaceService
from WSDL: https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl
Exception in thread "main" javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:333)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)
at javax.xml.ws.Service.getPort(Unknown Source)
at
com.webservice.paypal.PayPalAPIInterfaceService.getPayPalAPIAA(PayPalAPIInterfaceService.java:106)
at test.main(test.java:97)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:341)
at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:404)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:503)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242)
at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:144)
at
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:133)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)
... 4 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
javax.xml.bind.JAXBElement does not have a no-arg default constructor.
this problem is related to the following location:
at javax.xml.bind.JAXBElement
at protected javax.xml.bind.JAXBElement
com.webservice.paypal.ReverseTransactionResponseDetailsType.reverseTransactionID
at com.webservice.paypal.ReverseTransactionResponseDetailsType
at public
com.webservice.paypal.ReverseTransactionResponseDetailsType
com.webservice.paypal.ObjectFactory.createReverseTransactionResponseDetailsType()
at com.webservice.paypal.ObjectFactory
at protected java.lang.Object
com.webservice.paypal.AbstractRequestType.any
at com.webservice.paypal.AbstractRequestType
at
com.webservice.paypal.GetBillingAgreementCustomerDetailsRequestType
at protected
com.webservice.paypal.GetBillingAgreementCustomerDetailsRequestType
com.webservice.paypal.GetBillingAgreementCustomerDetailsReq.getBillingAgreementCustomerDetailsRequest
at com.webservice.paypal.GetBillingAgreementCustomerDetailsReq
*
==========================================
I got the wsdl file for Pay Pal form the following location,
https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl
<https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl>
And I used this url to generate my client as follows.
*Wsdl2java –p com.test https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl*
<https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl>
In my generated service stub also using the WSDL location for the service as
following. but the real endpoint should be ,
https://api-aa.sandbox.paypal.com/2.0/,
<https://api-aa.sandbox.paypal.com/2.0/>
*@WebServiceClient(name = "PayPalAPIInterfaceService",
wsdlLocation = "
https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl",
targetNamespace = "urn:ebay:api:PayPalAPI")
public class PayPalAPIInterfaceService extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("urn:ebay:api:PayPalAPI",
"PayPalAPIInterfaceService");
public final static QName PayPalAPI = new
QName("urn:ebay:api:PayPalAPI", "PayPalAPI");
public final static QName PayPalAPIAA = new
QName("urn:ebay:api:PayPalAPI", "PayPalAPIAA");
static {
URL url = null;
try {
url = new URL("https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl
");
} catch (MalformedURLException e) {
System.err.println("Can not initialize the default wsdl from
https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl");
// e.printStackTrace();
}
WSDL_LOCATION = url;
}*
*
*
This is may be why I get this error, please someone help me how to configure
this endpoint. Even if I changed in the code it didn’t work. How to
configure this endpoint other than the WSDL location?
Thank you so much.
Emil