You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by LeftoverLinguine <le...@gmail.com> on 2009/07/21 19:13:48 UTC

Problem running generated java files from wsdl2java

So I generated java classes from a WSDL file using WSDL2Java.  I set up the
main method to log in with a username and password(
http://arsenalist.com/2007/07/31/cxf-ws-security-using-jsr-181-interceptor-annotations-xfire-migration/#comment-794
like this ).  I also added a WebService annotation to the Service class. 
Without giving the annotation any arguments I get the following error: 
Exception in thread "main" javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
portType named {http://unknown.namespace/}PaymentService
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:297)
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:290)
	at javax.xml.ws.Service.getPort(Unknown Source)
	at
PaymentServiceContract_CustomBindingPaymentServiceContract_Client.main(PaymentServiceContract_CustomBindingPaymentServiceContract_Client.java:50)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Could not find portType named {http://unknown.namespace/}PaymentService
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getInterfaceInfo(ReflectionServiceFactoryBean.java:549)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:557)
	at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:238)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:333)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:437)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:195)
	at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:163)
	at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:411)
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:295)
	... 3 more

When I provide the arguments(name->wsdl:portType name,
serviceName->wsdl:service name, portName->wsdl:port name,
enpointInterface->location of the generated endpoint interface java file,
and wsdlLocation pointing to the location of the file) I get this error: 
Exception in thread "main" javax.xml.ws.WebServiceException: Unable to load
the class PaymentService.
	at org.apache.cxf.jaxws.ServiceImpl.getPortTypeName(ServiceImpl.java:542)
	at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:405)
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:295)
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:290)
	at javax.xml.ws.Service.getPort(Unknown Source)
	at
PaymentServiceContract_CustomBindingPaymentServiceContract_Client.main(PaymentServiceContract_CustomBindingPaymentServiceContract_Client.java:50)

Can anybody provide any insight into fixing these errors?

Thanks
-- 
View this message in context: http://www.nabble.com/Problem-running-generated-java-files-from-wsdl2java-tp24591869p24591869.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problem running generated java files from wsdl2java

Posted by Daniel Kulp <dk...@apache.org>.
Out of curiosity, why are you adding a WebService annotation onto the stuff 
used on the client side?   The generated code should just work "as is".

Dan

On Tue July 21 2009 1:13:48 pm LeftoverLinguine wrote:
> So I generated java classes from a WSDL file using WSDL2Java.  I set up the
> main method to log in with a username and password(
> http://arsenalist.com/2007/07/31/cxf-ws-security-using-jsr-181-interceptor-
>annotations-xfire-migration/#comment-794 like this ).  I also added a
> WebService annotation to the Service class. Without giving the annotation
> any arguments I get the following error: Exception in thread "main"
> javax.xml.ws.WebServiceException:
> org.apache.cxf.service.factory.ServiceConstructionException: Could not find
> portType named {http://unknown.namespace/}PaymentService
> 	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:297)
> 	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:290)
> 	at javax.xml.ws.Service.getPort(Unknown Source)
> 	at
> PaymentServiceContract_CustomBindingPaymentServiceContract_Client.main(Paym
>entServiceContract_CustomBindingPaymentServiceContract_Client.java:50)
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
> Could not find portType named {http://unknown.namespace/}PaymentService at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getInterfaceInf
>o(ReflectionServiceFactoryBean.java:549) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLO
>perations(ReflectionServiceFactoryBean.java:557) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperatio
>ns(JaxWsServiceFactoryBean.java:238) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFro
>mWSDL(ReflectionServiceFactoryBean.java:333) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServi
>ceModel(ReflectionServiceFactoryBean.java:437) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Reflecti
>onServiceFactoryBean.java:195) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFac
>toryBean.java:163) at
> org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:411) at
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:295) ... 3 more
>
> When I provide the arguments(name->wsdl:portType name,
> serviceName->wsdl:service name, portName->wsdl:port name,
> enpointInterface->location of the generated endpoint interface java file,
> and wsdlLocation pointing to the location of the file) I get this error:
> Exception in thread "main" javax.xml.ws.WebServiceException: Unable to load
> the class PaymentService.
> 	at org.apache.cxf.jaxws.ServiceImpl.getPortTypeName(ServiceImpl.java:542)
> 	at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:405)
> 	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:295)
> 	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:290)
> 	at javax.xml.ws.Service.getPort(Unknown Source)
> 	at
> PaymentServiceContract_CustomBindingPaymentServiceContract_Client.main(Paym
>entServiceContract_CustomBindingPaymentServiceContract_Client.java:50)
>
> Can anybody provide any insight into fixing these errors?
>
> Thanks

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog