[JBossWS] - Unmarshalling and binding issues
by magnus.ahlander
I'm using JAXWS 1.2 and I am trying to generate a web service client from a wsdl, it works but I have a couple of minor issues:
1) Unmarshalling does not find a needed class
Inside of my wsdl I have the following type:
...
| <s:complexType name="ItemValue">
| <s:sequence>
| <s:element minOccurs="0" maxOccurs="1" name="DiagnosticInfo" type="s:string"/>
| <s:element minOccurs="0" maxOccurs="1" name="Value"/>
| </s:sequence>
| <s:attribute name="ItemName" type="s:string"/>
| </s:complexType>
| ...
wsconsume generates the following java class file
import javax.xml.bind.annotation.*;
|
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "ItemValue", propOrder = {
| "value"
| })
| public class ItemValue {
|
| @XmlElement(name = "Value")
| protected Object value;
| @XmlAttribute(name = "ItemName")
| protected String itemName;
|
| //... getters and setters
| }
Everything works fine if "value" is a java type, for instance float
<ItemValue xmlns='http://opcfoundation.org/webservices/XMLDA/1.0/' ItemName='Channel1.Device1.ComulativeElectric'>
| <Value xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xsd:float'>6428.76806640625</Value>
| </ItemValue>
However, if value is of some other generated type, in my case ArrayOfUnsignedInt, this class is not visible to the JAXBContent used at unmarshalling and the value is left unmarshalled (DOM element).
What is the proper way to provide JAXBContent with the extra class needed for unmarshalling?
I believe somewhere I would need to put something like:
JAXBContext jaxbContext = JAXBContext.newInstance(ItemValue.class, ArrayOfUnsignedInt.class);
Or is there some annotation that could be added to class ItemValue which would provide JAXB with the necessary information for unmarshalling? Or could I somehow modify the wsdl (created by a third party)?
2) Modifying binding
The received SOAP message contains a 64-bit value marked as 'xsd:float'
<ItemValue xmlns='http://opcfoundation.org/webservices/XMLDA/1.0/' ItemName='Channel1.Device1.ComulativeElectric'>
| <Value xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='xsd:float'>6428.76806640625</Value>
| </ItemValue>
JAXB (correctly) unmarshals this value to 6428.768 (java.lang.Float).
What is the easiest way to override this binding (to say java.lang.Double) in a web service client?
Regards,
Magnus
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027437#4027437
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027437
19Â years, 1Â month
[Remoting] - CSV data in socket connection.
by zubra.bubra
Hi guys!
I am newbie with JBoss Remoting.
The task is to create demarshaller for comma-separated values in socket.
Client (written in C++, and couldn't be patched) doesn't use JBoss Remoting, it just open raw socket connection and send data.
I ve tried to use xml descriptor:
server>
| <mbean code="org.jboss.remoting.transport.Connector"
| name="jboss.remoting:service=Connector,transport=socket"
| display-name="Socket transport Connector">
| <!--<attribute name="InvokerLocator">-->
| <!--<![CDATA[socket://${jboss.bind.address}:777]]>-->
| <!--</attribute>-->
| <attribute name="Configuration">
| <config>
| <invoker transport="socket">
| <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
| <attribute name="serverBindPort">7777</attribute>
| <attribute name="dataType" isParam="true">psp</attribute>
| <attribute name="unmarshaller" isParam="true">my.server.remoting.MyUnMarshaller</attribute>
| </invoker>
| <handlers>
| <handler subsystem="my">my.server.remoting.MyServerInvocationHandler</handler>
| </handlers>
| </config>
| </attribute>
| </mbean>
| </server>
But JBoss says header is invalid. How should i configure my connector?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027428#4027428
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027428
19Â years, 1Â month
[JBoss Portal] - Generating JNLP file in portlet
by louise_za
Hi everyone
I am trying to generate a JNLP file for Java Web Start inside a portlet. In the doView method I have the following:
| rResponse.setContentType("application/x-java-jnlp-file");
| javax.portlet.PortletRequestDispatcher pRD = this.getPortletContext().getRequestDispatcher(JSP_PATH + "/my_jnlp.jsp");
My jsp contains the following code:
| <%@ page contentType="application/x-java-jnlp-file" %>
| <%@ page session="false"%>
|
| <%
| //get some application variables here
| ...
| ...
| System.out.println("Executing the JSP");
| %>
|
| <jnlp spec="1.0+" codebase="<%=codebase %>">
|
| <information>
| <title>ABC</title>
| <vendor>XYZ</vendor>
| <description>Foo</description>
| </information>
|
| <resources>
| <j2se version="1.5+" />
| <jar href="ABC.jar" />
| </resources>
|
| <applet-desc documentBase="http://<%=web_host %>" name="RST" main-class="MyClass" width="527" height="428">
| <param name="a" value="<%=a_val %>"/>
| <param name="b" value="<%=b_val%>"/>
| </applet-desc>
|
| </jnlp>
I have added the following to portlet.xml under the appropriate portlet:
| <supports>
| <mime-type>application/x-java-jnlp-file</mime-type>
| <portlet-mode>VIEW</portlet-mode>
| </supports>
Also, in the web.xml file in jboss-portal-2.2.0-bundled\server\default\deploy\jbossweb-tomcat55.sar\conf, I have added:
| <mime-mapping>
| <extension>jnlp</extension>
| <mime-type>application/x-java-jnlp-file</mime-type>
| </mime-mapping>
| <mime-mapping>
| <extension>jar</extension>
| <mime-type>application/x-java-archive</mime-type>
| </mime-mapping>
| <mime-mapping>
| <extension>jardiff</extension>
| <mime-type>application/x-java-archive-diff</mime-type>
| </mime-mapping>
|
The problem is that when I open the page that the portlet is on, nothing happens. The portlet does not even get rendered. Please, can anyone help?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027426#4027426
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027426
19Â years, 1Â month
[JBoss Seam] - Re: Seam-managed persistence contexts and Glassfish
by giannidoe
Thanks
I'm modifying the jpa example to work with my app but I now get an exception at startup.
anonymous wrote : org.hibernate.dialect.PostgreSQLDialect cannot be cast to org.hibernate.dialect.Dialect
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
| <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
| http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
| <persistence-unit name="My-PU" transaction-type="JTA">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>jdbc/orpello</jta-data-source>
| <properties>
| <property name="hibernate.cache.use_second_level_cache" value="true" />
| <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
| <property name="net.sf.ehcache.configurationResourceName" value="/ehcache.xml" />
| <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
| <property name="hibernate.show_sql" value="true" />
| <property name="hibernate.transaction.manager_lookup_class"
| value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
| </properties>
| </persistence-unit>
| </persistence>
components.xml
<?xml version="1.0" encoding="UTF-8"?>
| <components xmlns="http://jboss.com/products/seam/components"
| xmlns:core="http://jboss.com/products/seam/core"
| xmlns:security="http://jboss.com/products/seam/security"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation=
| "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
| http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd
| http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
|
| <core:init jndi-pattern="java:comp/env/orpello-ejb/#{ejbName}/local" debug="true"/>
|
| <core:entity-manager-factory name="My-PU"/>
|
| <core:managed-persistence-context name="entityManager"
| auto-create="true"
| entity-manager-factory="#{My-PU}"/>
| </components>
anonymous wrote : [#|2007-03-13T06:45:53.771+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=11;_ThreadName=httpWorkerThread-4848-0;_RequestID=eccb6a64-1a7e-4cf6-a27f-155f4ccab5e7;|WebModule[/Orpello-war]Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
| javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not instantiate dialect class
| at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:217)
| at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
| at org.jboss.seam.core.EntityManagerFactory.startup(EntityManagerFactory.java:74)
| 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:589)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1842)
| at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
| at org.jboss.seam.Component.newInstance(Component.java:1746)
| at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
| at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
| at org.jboss.seam.init.Initialization.init(Initialization.java:506)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
| at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
| at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:659)
| at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1468)
| at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1133)
| at com.sun.enterprise.web.WebContainer.loadJ2EEApplicationWebModules(WebContainer.java:1058)
| at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:128)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:322)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:196)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:633)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:908)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:892)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:445)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
| at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296)
| at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
| at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
| at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
| at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
| at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
| at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541)
| at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585)
| at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719)
| 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:589)
| at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
| at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
| at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
| at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
| at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
| at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:589)
| at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
| at $Proxy1.invoke(Unknown Source)
| at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
| at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:56)
| at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:142)
| at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:109)
| at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
| at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
| at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
| at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
| at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
| at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
| at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
| at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
| at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
| at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
| at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
| at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
| at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
| at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
| at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
| at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
| at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
| at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
| at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
| at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
| at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
| Caused by: org.hibernate.HibernateException: Could not instantiate dialect class
| at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:84)
| at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
| at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:397)
| at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
| at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
| at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
| at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
| at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
| ... 87 more
| Caused by: java.lang.ClassCastException: org.hibernate.dialect.PostgreSQLDialect cannot be cast to org.hibernate.dialect.Dialect
| at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
| ... 96 more
Am I missing something to get this to work with PostgreSQL?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027422#4027422
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027422
19Â years, 1Â month