• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Top-Down approach: WSDL, JAX-WS and JAXB

 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

I am doing my first top down WS implementation using JAX-WS and have a question re: JAXB binding files.

If I generate the artifacts (stubs) from WSDL using a tool (in my case wsconsume under Jboss) do I need to provide JAXB binding files? (I am getting JAXB errors on deployment.) I think that is where the problem lies. The WSDL in question is complex (WSDL supporting OASIS Subscribe-Notify).

If that is the case, is there a basic binding file I can start with?

Thank you

Max
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I guess you have seen this document on JAXB binding files? http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html
I can show you an example of a JAXB binding file, but I doubt that you will be able to use it as a starting point for your own binding file.


The second example, which actually may be usable as-it-is for you, can be used to resolve name conflicts in a XML schema where one or more elements and attributes have the same name.
This JAXB binding file is to be supplied when creating client artifacts with wsimport, using the -b option.


Finally, you do not NEED to provide a JAXB binding file. The best is to be able to make do without one.
What kind of errors do you get when you deploy? Please provide log or stacktrace.
Best wishes!
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ivan

Thanks for the reply.
Here is what I get: I've posted the erro, my code and the wsdl
note: am using wsconsume (JBoss jax-ws too)l to import the wsdl.
This JAX-WS Java 1.5.
I am trying to implement Notify, an oasis standard for subscription notify.

If I could find a simple wsdl to ws impl sample, that might be a good place to start.

many thanks for looking at this
Max

Here is the error tring to deploy my service:


here is my webservice:


Here is the wsdl

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
There seemed to be a number of errors in your WSDL. I have corrected the ones I found and enclose the new version of the WSDL below.
I have not tried to create client artifacts and deploy - I'll leave it to you to give it a try.

Best wishes!
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ivan-

Many thanks for doing this. I was given this wsdl at the company I work at.
we are integrating two systems with two different WS stacks. Theirs is Xfire AXIS2, ours is JBoss JAX-WS Native.
I will run this and let you know how the generate turns out.

thanks again
Max
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ivan

Looks like your fixes worked! I haven't tested the service yet but I was able to gen artifacts using wsconcume under JBoss and I can now deploy my Notify WS.

FYI, there was one other fix required to the wsdl:

<soap:fault name="ResourceUnknownFault"> (as opposed to <wsdl:fault...)

I'll test the code next but this is looking good. There is so little documentation available on the JBoss Top Down tools that I wasn't sure if the Top Down process even worked.

thanks again. I had spent over a week on this.

Max

>
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aww, I missed that fault!
Anyway, very good to hear that things worked out!
For situations like this, for you and others, I can recommend two things:
- Validate the WSDL against its XML schema(s).
This can be done in any good IDE (like Eclipse, NetBeans etc) or in special XML editors, like XMLSpy, Oxygen etc.
- Run the WS-I Basic Profile compliance tool, for instance from within soapUI, on the WSDL.
The above two tools catches, if not all, then at least most errors in a WSDL.
Best wishes!
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As it turns out, this did not fix my problem.

I had a cached simpler version of the service which took a string.

When I got rid of that and tried to deploy my new one, which takes a complex object (a Notify based on the Oasis Spec), I get:

08:50:40,793 ERROR [MainDeployer] Could not start deployment: file:/opt/jboss/jboss-4.2.2.GA/server/default/deploy/cps.ear/cps.jar/
java.lang.IllegalStateException: Cannot build JAXB context
at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:925)
at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.buildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:146)
at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupProviderOrWebService(JAXWSServerMetaDataBuilder.java:50)
at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3.buildMetaData(JAXWSMetaDataBuilderEJB3.java:78)
at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect.create(UnifiedMetaDataDeploymentAspect.java:71)
at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:115)
at org.jboss.wsf.container.jboss42.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:97)
at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:90)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy34.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy9.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:508)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
javax.xml.namespace.QName does not have a no-arg default constructor.
this problem is related to the following location:
at javax.xml.namespace.QName
at protected java.util.List org.oasis_open.docs.wsn.b_2.InvalidFilterFaultType.unknownFilter
at org.oasis_open.docs.wsn.b_2.InvalidFilterFaultType
at public org.oasis_open.docs.wsn.b_2.InvalidFilterFaultType org.oasis_open.docs.wsn.b_2.ObjectFactory.createInvalidFilterFaultType()
at org.oasis_open.docs.wsn.b_2.ObjectFactory
at protected java.util.List org.oasis_open.docs.wsn.b_2.TopicExpressionType.content
at org.oasis_open.docs.wsn.b_2.TopicExpressionType
at protected org.oasis_open.docs.wsn.b_2.TopicExpressionType org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType.topic
at org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType
at protected java.util.List org.oasis_open.docs.wsn.b_2.Notify.notificationMessage
at org.oasis_open.docs.wsn.b_2.Notify
at private org.oasis_open.docs.wsn.b_2.Notify com.wwc.cps.webservices.jaxws.Notify.arg0
at com.wwc.cps.webservices.jaxws.Notify
@XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
this problem is related to the following location:
at protected java.util.List org.oasis_open.docs.wsn.t_1.TopicType.messageTypes
at org.oasis_open.docs.wsn.t_1.TopicType
at org.oasis_open.docs.wsn.t_1.TopicNamespaceType$Topic
at protected java.util.List org.oasis_open.docs.wsn.t_1.TopicNamespaceType.topic
at org.oasis_open.docs.wsn.t_1.TopicNamespaceType
at public org.oasis_open.docs.wsn.t_1.TopicNamespaceType org.oasis_open.docs.wsn.t_1.ObjectFactory.createTopicNamespaceType()
at org.oasis_open.docs.wsn.t_1.ObjectFactory
at protected java.util.List org.oasis_open.docs.wsn.t_1.TopicSetType.any
at org.oasis_open.docs.wsn.t_1.TopicSetType
at protected org.oasis_open.docs.wsn.t_1.TopicSetType org.oasis_open.docs.wsn.b_2.NotificationProducerRP.topicSet
at org.oasis_open.docs.wsn.b_2.NotificationProducerRP
at public org.oasis_open.docs.wsn.b_2.NotificationProducerRP org.oasis_open.docs.wsn.b_2.ObjectFactory.createNotificationProducerRP()
at org.oasis_open.docs.wsn.b_2.ObjectFactory
at protected java.util.List org.oasis_open.docs.wsn.b_2.TopicExpressionType.content
at org.oasis_open.docs.wsn.b_2.TopicExpressionType
at protected org.oasis_open.docs.wsn.b_2.TopicExpressionType org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType.topic
at org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType
at protected java.util.List org.oasis_open.docs.wsn.b_2.Notify.notificationMessage
at org.oasis_open.docs.wsn.b_2.Notify
at private org.oasis_open.docs.wsn.b_2.Notify com.wwc.cps.webservices.jaxws.Notify.arg0
at com.wwc.cps.webservices.jaxws.Notify

at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:116)
at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:921)
... 82 more
08:50:40,798 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

This is obviously related to mapping the object. I am stuck here. Is it due to JAXB bindings?

Max
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic