[JBossWS] - Cannot obtain wsdl service (problem in JBoss 4.2 used to wor
by burakbayramli
I have the following code that used to work in JBoss 4.0.4GA. After port to 4.2, server complained about "context roots being different, so I added @WebContext to all web services. Now server is fine, I can see the WSDL, but I cannot connect to the server using a Java client.
| @WebService
| @SOAPBinding(style=Style.RPC)
| public interface Calculator extends Remote
| {
| @WebMethod int add(int x, int y);
|
| @WebMethod int subtract(int x, int y);
| }
|
| @Stateless
| @WebService(name="CalculatorService",serviceName="CalculatorService",endpointInterface="org.bilgidata.kitapdemo.service.Calculator")
| @WebContext(contextRoot="/ggServices")
| public class CalculatorBean implements Calculator
| {
| public int add(int x, int y)
| {
| System.out.println("inside add");
| return x + y;
| }
|
| public int subtract(int x, int y)
| {
| System.out.println("inside subtract");
| return x - y;
| }
| }
|
| public class Client
| {
| public static void main(String[] args) throws Exception
| {
| URL url = new URL("http://localhost:8080/ggServices/CalculatorBean?wsdl");
| QName qname = new QName("http://localhost:8080/ggServices/CalculatorBean",
| "CalculatorService");
|
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(url, qname);
|
| Calculator calculator = (Calculator) service.getPort(Calculator.class);
|
| System.out.println("1 + 1 = " + calculator.add(1, 1));
| System.out.println("1 - 1 = " + calculator.subtract(1, 1));
| }
| }
|
The WSDL looks like
| <definitions name='CalculatorService' targetNamespace='http://service.kitapdemo.bilgidata.org/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://service.kitapdemo.bilgidata.org/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types></types>
| <message name='Calculator_subtract'>
| <part name='arg0' type='xsd:int'></part>
| <part name='arg1' type='xsd:int'></part>
| </message>
| <message name='Calculator_add'>
| <part name='arg0' type='xsd:int'></part>
| <part name='arg1' type='xsd:int'></part>
| </message>
| <message name='Calculator_addResponse'>
| <part name='return' type='xsd:int'></part>
| </message>
| <message name='Calculator_subtractResponse'>
| <part name='return' type='xsd:int'></part>
| </message>
| <portType name='Calculator'>
| <operation name='add' parameterOrder='arg0 arg1'>
| <input message='tns:Calculator_add'></input>
| <output message='tns:Calculator_addResponse'></output>
| </operation>
| <operation name='subtract' parameterOrder='arg0 arg1'>
| <input message='tns:Calculator_subtract'></input>
| <output message='tns:Calculator_subtractResponse'></output>
| </operation>
| </portType>
| <binding name='CalculatorBinding' type='tns:Calculator'>
| <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='add'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body namespace='http://service.kitapdemo.bilgidata.org/' use='literal'/>
| </input>
| <output>
| <soap:body namespace='http://service.kitapdemo.bilgidata.org/' use='literal'/>
| </output>
| </operation>
| <operation name='subtract'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body namespace='http://service.kitapdemo.bilgidata.org/' use='literal'/>
| </input>
| <output>
| <soap:body namespace='http://service.kitapdemo.bilgidata.org/' use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='CalculatorService'>
| <port binding='tns:CalculatorBinding' name='CalculatorServicePort'>
| <soap:address location='http://127.0.0.1:8080/ggServices/CalculatorBean'/>
| </port>
| </service>
| </definitions>
|
| Exception in thread "main" java.lang.IllegalArgumentException: Cannot obtain wsdl service: {http://localhost:8080/ggServices/CalculatorBean}CalculatorService
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaDataInternal(JAXRPCClientMetaDataBuilder.java:171)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:133)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:85)
| at org.jboss.ws.core.jaxrpc.client.ServiceImpl.<init>(ServiceImpl.java:111)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
| at org.bilgidata.kitapdemo.service.Client.main(Client.java:18)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095525#4095525
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095525
18Â years, 9Â months
[JBossCache] - Re: Data gravitation synchronization issue
by fungrim
The UnitTest models our real application. It goes like this: It is an application processing events for units (areas) where the area is an object stored in the cache and session affinity is enforced by a message bus. Sometimes during the lifetime of the application new areas will be added by a coordinator (which is restricted to one of the nodes, ie. new areas are only ever added at one node).
The message bus acts as a load balancer and will distribute events for areas, using a sticky algorithm so that session affinity is honored. So:
| * The coordinator adds an area object to the cache.
| * The message bus is notified (by jboss cache listener methods) of the new area. It then selects a node in the cluster for processing.
| * The working (event sending) threads are notified of the new area and starts sending events.
|
The problem appears, as I originally wrote, when the events arrive at their deignated node and a data gravitation occurs. And as far as I have seen only on the backup node. For example:
| * Node A is coordinator and adds an area (X).
| * Node B becomes buddy backup for X.
| * The message bus assigns X to node C.
| * When messages arrive at node C a data gravitation occurs.
| * Node B receives two consecutive data gravitation cleanup commands, one of which doesn't seem to let go of its identity lock.
| * After "buddyCommunicationTimeout" (logged as debug) node C get null from the cache and fails.
|
This is loosely modeled in the UnitTest. In the test worker threads are assigned areas statically, areas are added in one cache after which the workers are notified of their new area and attempts to access it. If any of the worker threads gets a null from the cache the test fails as we know the area should exist (ie. the worker is not notified of its new area until it has already been added).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095516#4095516
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095516
18Â years, 9Â months
[JBoss Seam] - Re: DataModel and DataModelSelection question
by w17chm4n
I found the sollution.
| @Stateful
| @Scope(ScopeType.SESSION)
| @Name("QuestionCategoryController")
| public class QuestionCategoryControllerBean implements QuestionCategoryController {
|
| @Logger
| private Log log;
|
| @In(create = true)
| private QuestionCategoryManager questionCategoryManager;
|
| @DataModel
| private List<QuestionCategory> questionCategoryList;
|
| @DataModelSelection
| @In(required = false)
| private QuestionCategory questionCategory;
|
| public void addCategory() {
| questionCategoryManager.addCategory(questionCategory);
| getAllQuestionsCategories();
| }
|
| public void removeCategory() {
| questionCategoryList.remove(questionCategory);
| questionCategoryManager.removeCategory(questionCategory);
| questionCategory = null;
| getAllQuestionsCategories();
| }
|
| @Factory(value="questionCategoryList")
| public void getAllQuestionsCategories() {
| questionCategoryList = questionCategoryManager.getAllQuestionCategories();
| }
|
| @Remove @Destroy
| public void destroy() {}
|
| }
|
| @Stateful
| @Scope(ScopeType.APPLICATION)
| @Name("questionCategoryManager")
| public class QuestionCategoryManagerBean implements QuestionCategoryManager {
|
| @Logger
| Log log;
|
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| private EntityManager entityManager;
|
| public void addCategory(QuestionCategory category) {
| category.setCreated(new Date());
| entityManager.persist(category);
| }
|
| public void removeCategory(QuestionCategory category) {
| entityManager.remove(category);
| }
|
| public List<QuestionCategory> getAllQuestionCategories() {
| return entityManager.createQuery("from QuestionCategory qc").getResultList();
| }
|
| @Destroy @Remove
| public void destroy() {
| }
| }
|
| @Entity
| @Scope(ScopeType.EVENT)
| @Name("questionCategory")
| @Table(name="QuestionCategories")
| public class QuestionCategory implements Serializable {
|
| @Id @GeneratedValue
| private Long id;
|
| @NotNull @Length(min=3, max=100)
| private String categoryName;
|
| @OneToMany
| private List<Question> questionList;
|
| @Temporal(value = TemporalType.TIMESTAMP)
| private Date created;
|
| /** Creates a new instance of QuestionCategory */
| public QuestionCategory() {
| this.questionList = new ArrayList<Question>();
| }
|
| public QuestionCategory(String categoryName) {
| this.categoryName = categoryName;
| this.questionList = new ArrayList<Question>();
| }
|
| public Long getId() {
| return id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| public String getCategoryName() {
| return categoryName;
| }
|
| public void setCategoryName(String categoryName) {
| this.categoryName = categoryName;
| }
|
| public List<Question> getQuestionList() {
| return questionList;
| }
|
| public void setQuestionList(List<Question> questionList) {
| this.questionList = questionList;
| }
|
| public Date getCreated() {
| return created;
| }
|
| public void setCreated(Date created) {
| this.created = created;
| }
| }
|
It was all about setting correct scopes ! Notice that entity bean has to have set Scope to event, without it, it won`t work.
Thx dhinojosa for all your support !
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095508#4095508
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095508
18Â years, 9Â months