[JBossWS] - Re: creating new targetnamespace for complex types
by khelenek
Thanks for writing back.
That's actually the first technique I tried which also did not seem to work. Here is an example of a my web service bean:
| @Stateless(name="VerificationWs")
| @WebService(
| name="VerificationWs",
| targetNamespace = VerificationWsBean.DEFAULT_NS)
| @SOAPBinding
| public class VerificationWsBean {
|
| @TransactionAttribute(value=TransactionAttributeType.REQUIRES_NEW)
| @WebMethod
| @WebResult(targetNamespace=VerificationWsBean.DEFAULT_NS)
| public VerificationResponse verify(
| @WebParam(targetNamespace=VerificationWsBean.DEFAULT_NS) VerificationRequest request
| ) throws Exception {
| return verifyDirect(request);
| }
| }
|
And then in my VerificationRequest.java class I have:
| @XmlType(namespace="http://verification.studentuniverse.com/ws/client")
| public class VerificationRequest implements Serializable {
|
But in my wsdl I still get VerificationRequest mapped as complex types under a schema with the package namespace:
| <schema elementFormDefault="qualified" targetNamespace="http://package.mycompany.com/jaws">
|
(The methods map as complex types under the correct namespace as defined by the @WebService annotation, though.
Any ideas what to try next?
Thanks in advance,
kris
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045596#4045596
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045596
19 years, 1 month
[JBossWS] - If I deploy more than one webservice I get "Multiple context
by rickcr
I can deploy a simple webservice and everything works fine. If II create another webservice in a similar manner and deploy it, I end up with a "Multiple context root not supported" error.
This is very frustrating since I see nothing about this issue in the users guide.
Here was an example of an initial web service I was trying to deploy (which works fine, until I try to deploy another webservice using the same approach):
@Local
@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public interface Echo {
@WebMethod String testEcho(String s);
}
@Stateless
@WebService(endpointInterface="com.foobar.edsf.example.ejb.webservices.Echo")
public class EchoBean {
public String testEcho(String s) {
return s;
}
}
If I deploy a similar webservice like the above, I'll get the Multiple context root not supported error. Am I doing something unorthodox or is this a bug? My EJB3 book and the examples that come with the jboss patch here: http://docs.jboss.org/ejb3/app-server/tutorial/installing.html show examples like I'm doing above.
There is something related to this in jira http://jira.jboss.com/jira/browse/JBWS-1622 but I can't seem to get the concept of @WebContext working correctly (I also don't see why I should even need to use a non-standard JBoss annotation to do something that should be standard.)
WITHOUT adding a @WebContext I'll end up with a wsdl location like:
http://machine-name:8080/EchoBeanService/EchoBean?wsdl
If I try to declare a @WebContext I won't get the multiple context root error, but it changes the wsdl path to a path that it can't find. For example if I give it a path:
@WebContext(contextRoot="/EDSF-tests", secureWSDLAccess=false)
I end up with a wsdl URL:
http://machine-name:8080/EDSF-tests/EchoBean?wsdl
Which doesn't point to the wsdl anymore.
Can someone give me some pointers about what I'm doing wrong? There must be a reason others have not run into this as well since I don't think I'm creating my webservices in a unique way.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045595#4045595
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045595
19 years, 1 month
[EJB 3.0] - jms lazy mdb Design pattern
by bdevis
Hi, to all
i have this scenario
1)I have my entity with many collection (Lazy association)
2)This is my mdb
| public class LoginRequest implements MessageListener {
|
| public LoginRequest() {
| }
|
| public void onMessage(Message message) {
|
|
| try {
|
|
| Clienti _msg = (Clienti) ((ObjectMessage)message).getObject();
| System.out.println("MessageBean onMessage" +_msg.getNome());
| ClientiFacadeLocal facade=(ClientiFacadeLocal)CachingServiceLocator.getInstance().getLocalHome(ClientiFacade.class);
| Clienti _cli=facade.findByName(_msg.getNome());
| System.out.println("onMessage toString "+_cli.toString());
|
|
| if(_cli!=null)
| Send(_cli);
|
| } catch (Exception e) {
| System.err.println("Exception in SimpleMessageBean");
| e.printStackTrace();
| }
| }
|
|
| public void Send(Clienti vo){
| try {
| System.out.println("-->>");
| TopicConnectionFactory connectionFactory;
| Topic queue;
| TopicSession session;
|
|
| Hashtable environment = new Hashtable();
| environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| environment.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099"); // remote machine IP
| InitialContext ctx = new InitialContext(environment);
| Object obj = ctx.lookup("topic/VdeResponseLoginQueue"); //ejb-name
| System.out.println("-->> lookup object successfully");
| queue = (Topic) obj;
| connectionFactory=(TopicConnectionFactory) ctx.lookup("/TopicConnectionFactory");
| TopicConnection connection = connectionFactory.createTopicConnection();
| session =
| connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
|
| connection.start();
| ObjectMessage message = session.createObjectMessage();
| System.out.println("Ho ricevuto l'ordine da te ora "+vo.getNome());
| message.setObject(vo);
| message.setJMSCorrelationID(vo.getNome());
| System.out.println("Preparato message per "+vo.getCognome()+" "+vo.getNome());
| MessageProducer messageProducer = session.createProducer(queue);
|
| messageProducer.send(message);
|
| session.close();
| connection.close();
| connection=null;
|
| } catch (Exception e) {
| System.out.println("Errroe in sendMessage "+e.getMessage());
| e.printStackTrace();
| }
| }
|
|
|
| }
|
|
| this is my Session Facade
|
| @Stateless
| //(a)TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public class ClientiFacade implements ClientiFacadeLocal,ClientiFacadeRemote {
|
| @PersistenceContext()
|
| private EntityManager em;
| //private EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("NuovVdeUN");
| //EntityManager em = entityManagerFactory.createEntityManager();
|
|
| /** Creates a new instance of ClientiFacade */
| public ClientiFacade() {
| }
|
| public void create(Clienti clienti) {
| em.persist(clienti);
| }
|
| public void edit(Clienti clienti) {
| em.merge(clienti);
| }
|
| public void destroy(Clienti clienti) {
| em.merge(clienti);
| em.remove(clienti);
| }
|
| public Clienti find(Object pk) {
| return (Clienti) em.find(Clienti.class, pk);
| }
|
| public List findAll() {
|
| return em.createQuery("select object(o) from Clienti as o").getResultList();
| }
|
| public Clienti findByName(String nome) {
|
| Clienti id=(Clienti) em.createNamedQuery("Clienti.findByNome").setParameter("nome",nome).getSingleResult();
| return em.getReference(Clienti.class, id.getIdcliente());
| }
|
|
|
|
|
| }
|
|
my client
| public class TestTopic {
|
|
|
| public TestTopic() {
|
| }
|
|
|
| public void Send(String cosa){
| try {
| System.out.println("-->>");
| TopicConnectionFactory connectionFactory;
| Topic queue;
| TopicSession session;
|
|
| Hashtable environment = new Hashtable();
| environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
| environment.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099"); // remote machine IP
| InitialContext ctx = new InitialContext(environment);
| Object obj = ctx.lookup("topic/VdeResponseLoginQueue"); //ejb-name
| System.out.println("-->> lookup object successfully");
| queue = (Topic) obj;
| connectionFactory=(TopicConnectionFactory) ctx.lookup("/TopicConnectionFactory");
| TopicConnection connection = connectionFactory.createTopicConnection();
| session =
| connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
|
| connection.start();
| ObjectMessage message = session.createObjectMessage();
| ClientiFacadeRemote facade=(ClientiFacadeRemote)CachingServiceLocator.getInstance().getRemoteHome(ClientiFacade.class);
| Clienti vo=facade.findByName(cosa);
|
|
|
| System.out.println("Ho ricevuto l'ordine da te ora "+vo.getNome());
| System.out.println("Tarifa "+vo.getIdtariffa().getIdtariffa());
| System.out.println("Lingue "+vo.getLingua().getStringa());
|
| System.out.println("DVD Collection 9 "+vo.getLingua().getDvdCollection9().size());
|
|
| message.setJMSCorrelationID(vo.getNome());
| message.setObject(vo);
| System.out.println("Preparato message per "+message.getJMSCorrelationID()+" "+vo.getCognome());
| MessageProducer messageProducer = session.createProducer(queue);
|
| messageProducer.send(message);
|
| session.close();
| connection.close();
| connection=null;
|
| } catch (Exception e) {
| System.out.println("Errroe in sendMessage "+e.getMessage());
| e.printStackTrace();
| }
| }
|
| public static void main(String args[]){
| TestTopic t = new TestTopic();
| t.Send("devis");
| }
|
|
| }
|
|
|
|
When my client call
vo.getLingua().getDvdCollection9().size()
throw this error
Errroe in sendMessage failed to lazily initialize a collection of role: vde.com.ejb.vo.Lingue.dvdCollection9, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: vde.com.ejb.vo.Lingue.dvdCollection9, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
at org.hibernate.collection.PersistentBag.size(PersistentBag.java:225)
I have read about "Open Session in View" and AOP solution ... but i'dont use web app i have some Flex/Apollo (Adobe) application.
I have used also, PersistenceContext Extended, Transaction NOT_SUPPORTED etc.
Can you help me how i can design this scenario? i'm disperate... how i can use my Lazy Collection....?
Thanks in advance
Devis
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045593#4045593
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045593
19 years, 1 month