[JBossWS] - Urgent!! Web service return object - JBopss 4.2.2.GA
by peiguo
Hi,
We are doing some prototyping, JBoss for web service and C# for client. One of the key thing is to return an object from web service. But it did n't seem to work (some kind of limitation???). After some investigation, the problem seems reside on JBoss side, since the WSDL seems missing information.
Interface:
| package org.jboss.tutorial.webservice.bean;
|
| import javax.jws.WebService;
| import javax.jws.WebMethod;
| import java.rmi.Remote;
| import java.rmi.RemoteException;
| import javax.jws.soap.SOAPBinding;
| import javax.jws.soap.SOAPBinding.Style;
|
|
| @WebService
| @SOAPBinding(style=Style.DOCUMENT)
| public interface Calculator extends Remote
| {
| @WebMethod int add(int x, int y);
|
| @WebMethod int subtract(int x, int y);
| @WebMethod Something dump();
|
| }
|
Implementation:
| package org.jboss.tutorial.webservice.bean;
|
| import javax.ejb.*;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
| import javax.jws.soap.SOAPBinding.Style;
| import javax.naming.*;
| import javax.persistence.*;
|
| import java.sql.*;
| import javax.sql.*;
|
| import javax.annotation.Resource;
|
| @Stateless
| @WebService
| @SOAPBinding(style=Style.DOCUMENT)
| public class CalculatorBean
| {
|
| public int add(int x, int y) {
| return x + y;
| }
|
| public int subtract(int x, int y)
| {
| return x - y;
| }
|
| public Something dump() {
| System.out.println("called");
| return new Something();
| }
| }
|
|
Definition of Something:
| package org.jboss.tutorial.webservice.bean;
|
| import java.util.*;
|
| public class Something {
| private int a;
| private double b;
| private HashMap<String, ArrayList<String>> c;
|
| public Something() {
| a = 1;
| b = 2.0;
| c = new HashMap<String, ArrayList<String>>();
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("This is fun");
| arr.add("Interesting");
| arr.add("What is this?");
| c.put("first set", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("Kaveh");
| arr.add("David");
| arr.add("Costa");
| c.put("second set", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("green apple");
| arr.add("orange orange");
| arr.add("yellow mango");
| c.put("third set", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("they shoot horse");
| arr.add("sleppless in seattle");
| arr.add("thank you for smoking");
| c.put("bunch of movies", arr);
| }
| }
| }
|
|
WSDL generated (does not seem to define Something!!!):
| <definitions name='CalculatorBeanService' targetNamespace='http://bean.webservice.tutorial.jboss.org/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://bean.webservice.tutorial.jboss.org/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <xs:schema targetNamespace='http://bean.webservice.tutorial.jboss.org/' version='1.0' xmlns:tns='http://bean.webservice.tutorial.jboss.org/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
| <xs:element name='add' type='tns:add'/>
| <xs:element name='addResponse' type='tns:addResponse'/>
| <xs:element name='dump' type='tns:dump'/>
| <xs:element name='dumpResponse' type='tns:dumpResponse'/>
| <xs:element name='subtract' type='tns:subtract'/>
| <xs:element name='subtractResponse' type='tns:subtractResponse'/>
|
| <xs:complexType name='add'>
| <xs:sequence>
| <xs:element name='arg0' type='xs:int'/>
| <xs:element name='arg1' type='xs:int'/>
| </xs:sequence>
| </xs:complexType>
| <xs:complexType name='addResponse'>
| <xs:sequence>
| <xs:element name='return' type='xs:int'/>
|
| </xs:sequence>
| </xs:complexType>
| <xs:complexType name='dump'>
| <xs:sequence/>
| </xs:complexType>
| <xs:complexType name='dumpResponse'>
| <xs:sequence>
| <xs:element minOccurs='0' name='return' type='tns:something'/>
| </xs:sequence>
|
| </xs:complexType>
| <xs:complexType name='something'>
| <xs:sequence/>
| </xs:complexType>
| <xs:complexType name='subtract'>
| <xs:sequence>
| <xs:element name='arg0' type='xs:int'/>
| <xs:element name='arg1' type='xs:int'/>
| </xs:sequence>
|
| </xs:complexType>
| <xs:complexType name='subtractResponse'>
| <xs:sequence>
| <xs:element name='return' type='xs:int'/>
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| <message name='CalculatorBean_dumpResponse'>
|
| <part element='tns:dumpResponse' name='dumpResponse'></part>
| </message>
| <message name='CalculatorBean_subtractResponse'>
| <part element='tns:subtractResponse' name='subtractResponse'></part>
| </message>
| <message name='CalculatorBean_subtract'>
| <part element='tns:subtract' name='subtract'></part>
| </message>
| <message name='CalculatorBean_addResponse'>
|
| <part element='tns:addResponse' name='addResponse'></part>
| </message>
| <message name='CalculatorBean_add'>
| <part element='tns:add' name='add'></part>
| </message>
| <message name='CalculatorBean_dump'>
| <part element='tns:dump' name='dump'></part>
| </message>
| <portType name='CalculatorBean'>
|
| <operation name='add' parameterOrder='add'>
| <input message='tns:CalculatorBean_add'></input>
| <output message='tns:CalculatorBean_addResponse'></output>
| </operation>
| <operation name='dump' parameterOrder='dump'>
| <input message='tns:CalculatorBean_dump'></input>
| <output message='tns:CalculatorBean_dumpResponse'></output>
| </operation>
| <operation name='subtract' parameterOrder='subtract'>
|
| <input message='tns:CalculatorBean_subtract'></input>
| <output message='tns:CalculatorBean_subtractResponse'></output>
| </operation>
| </portType>
| <binding name='CalculatorBeanBinding' type='tns:CalculatorBean'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='add'>
| <soap:operation soapAction=''/>
| <input>
|
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| <operation name='dump'>
| <soap:operation soapAction=''/>
| <input>
|
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| <operation name='subtract'>
| <soap:operation soapAction=''/>
| <input>
|
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='CalculatorBeanService'>
| <port binding='tns:CalculatorBeanBinding' name='CalculatorBeanPort'>
|
| <soap:address location='http://127.0.0.1:8080/tutorial/CalculatorBean'/>
| </port>
| </service>
| </definitions>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148127#4148127
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148127
16 years, 4 months
[JBoss jBPM] - Re: How to display JBPM state information in JSF
by dilsent
I am sorry about that. Here is the xml code.
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition xmlns="" name="salesPageFlow">
|
|
| <start-state name="Sales Flow">
| <transition to="New Consumer"></transition>
| </start-state>
|
|
| <state name="Basic Information">
| <transition to="Opening Offer"></transition>
| </state>
|
| <state name="Opening Offer">
| <transition to="Qualification"></transition>
| </state>
|
| <state name="Qualification">
| <transition to="Order Flow"></transition>
|
| </state>
|
|
| <end-state name="Order Flow"></end-state>
|
|
| </process-definition>
|
|
| I wanted to capture the transition states and display on a jSF page by clicking a command button. I am not sure how to persist the state info,so that the next when i click the button from the JSF page the token should display the next transition state.
|
| Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148118#4148118
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148118
16 years, 4 months
[Persistence, JBoss/CMP, Hibernate, Database] - JPA OneToMany bidirectional -- Entity deletion
by justinmiller
I am having trouble deleting an entity part of a part-whole hierarchy and mapped as a OneToMany bidirectional relationship. For example:
...
| public class A {
| @OneToMany(mappedBy="parent", cascade={CascadeType.MERGE, CascadeType.PERSIST})
| private Collection<A> children;
|
| @ManyToOne(cascade={CascadeType.MERGE, CascadeType.PERSIST})
| @JoinColumn(name="PARENT_ID")
| private A parent;
| ...
| }
|
Instances of 'A' can, but do not HAVE to participate in this relationship. Therefore, a cascade on remove is not appropriate, because for any given instance of 'A', a parent and/or any of the children can exist independent of that instance.
So basically I want to remove an instance of 'A', and at the same time have it's child relationships updated -- basically pointing to a null parent.
What's the proper way to do this?
The first and most obvious way to me is:
| entityManager.remove(instanceOfA);
|
But that results in the cryptic error: "deleted entity passed to persist".
The only way I've gotten this to work so far is to use two transactions. In the first, I simply break the relationships and merge the objects:
Collection<A> children = instanceOfA.getChildren();
| instanceOfA.setChildren(null);
|
| for(A child : children) {
| child.setParent(null);
| entityManager.merge(child);
| }
|
| entityManager.merge(instanceOfA);
|
And in the second transaction:
instanceOfA = entityManager.find(A.class, instanceOfA.getId());
| entityManager.remove(instanceOfA);
|
This works, but feels very clunky.
What is the proper way to do this?
Thanks,
Justin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148113#4148113
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148113
16 years, 4 months