[JBossWS] - the client can't invoke the service
by Bouchwichman
Hi everybody!
I'm following the JBossWS quick start (http://jbws.dyndns.org/mediawiki/index.php?title=Quick_Start), and i'm facing some weird errors.
Here is what i have done :
Server side
My implementation class :
package org.domain.proj_essai.ws;
|
| import javax.ejb.Stateless;
| import javax.jws.WebParam;
| import javax.jws.WebService;
| import javax.jws.WebMethod;
| import javax.jws.soap.SOAPBinding;
|
| @Stateless
| @WebService(
| name="SommeWS",
| targetNamespace = "http://ws.proj_essai.domain.org",
| serviceName = "SommeWSService")
| @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) public class SommeWS {
|
| @WebMethod
| public int additionner( int a, int b){
| return a + b;
| }
|
| @WebMethod
| public int soustraire( int a, int b){
| return a - b;
| }
|
| @WebMethod
| public String afficherBonjour() {
| return "Bonjour";
| }
|
| }
|
my WSDL location (generated automatically when deploying):
http://127.0.0.1:8080/SommeWSService/SommeWS?wsdl
Client side:
First, I generated all client classes with wsconsume :
wsconsume -k -p bsa.ws http://127.0.0.1:8080/SommeWSService/SommeWS?wsdl
|
it gave me the following files:
bsa\ws\Additionner.java
| bsa\ws\AdditionnerResponse.java
| bsa\ws\AfficherBonjour.java
| bsa\ws\AfficherBonjourResponse.java
| bsa\ws\ObjectFactory.java
| bsa\ws\SommeWS.java
| bsa\ws\SommeWSService.java
| bsa\ws\Soustraire.java
| bsa\ws\SoustraireResponse.java
| bsa\ws\package-info.java
| bsa\ws\Additionner.java
| bsa\ws\AdditionnerResponse.java
| bsa\ws\AfficherBonjour.java
| bsa\ws\AfficherBonjourResponse.java
| bsa\ws\ObjectFactory.java
| bsa\ws\SommeWS.java
| bsa\ws\SommeWSService.java
| bsa\ws\Soustraire.java
| bsa\ws\SoustraireResponse.java
| bsa\ws\package-info.java
|
| Then i try to invoke the service from a method (that works without the web service invoking part) :
| URL url = null;
| | try {
| | url = new URL("http://127.0.0.1:8080/SommeWSService/SommeWS?wsdl");
| | } catch (MalformedURLException e) {
| | e.printStackTrace();
| | }
| |
| | Logger.getRootLogger().info("---------------- FLAG1 ----------------");
| | Service service = Service.create( url,new QName("SommeWSService") );
| | //Service service = Service.create(url,new QName( "http://ws.proj_essai.domain.org", "SommeWSService") );
| |
| | Logger.getRootLogger().info("---------------- FLAG2 ----------------");
| | SommeWS s = service.getPort( SommeWS.class);
| |
| |
| | Logger.getRootLogger().info("------------------------- "+ s.afficherBonjour() +" -----------------------");
| |
|
| PROBLEM:
| i have the following exception:
| ...
| | Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Cannot obtain wsdl service: SommeWSService
| | ...
| | Caused by: java.lang.IllegalArgumentException: Cannot obtain wsdl service: SommeWSService
| | ...
| |
|
| Then, i modified the instruction in the FLAG1 zone by the commented one ( Service service = Service.create(url,new QName( "http://ws.proj_essai.domain.org", "SommeWSService") ); ) . It succeeds, but the FLAG2 instruction ( SommeWS s = service.getPort( SommeWS.class); ) brings me un error :
| ...
| | Caused by: java.lang.LinkageError: Class javax/xml/rpc/ParameterMode violates loader constraints
| | ...
| |
|
| Could you help me please? If you need more informations ask me.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132434#4132434
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132434
16 years, 10 months
[JBossWS] - Re: out parameter
by oskar.carlstedt
Hi again!
Now I look at all these parts on a communication level. There might be a feature in JAXB to do all this state synchronization without your/my knowledge. I don't know. But the concept of web services does not support this kind of void feature where you change a value in your method "argument" - because there is no method or argument just an operation that accepts a message.
This is something you already know, but we take it from the beginning if there are other persons whoe are unsure about the concept of web services.
Web services, in this case SOAP, provide a stateless way to communicate with other components. You never know if these components are written in Java, .NET, Perl, C++ or whatever else. This is the whole point by using web services - You send a request message to a component and you get a response message in return.
Web services also use http as communication protocol. Http is a so called dead protocol, i.e. one request and then one response before the communication dies (we have something call keep alive to speed up things but that is just a way to keep the socket connection open).
To summarize, we have two stateless parts communicating with each other - or more correct one part (the client) asking the server for something by providing a message. The response is another message. The two parts don't know anything about each other more than what is exposed by the service contract (the WSDL file).
The question is, how can we provide the client with a new state on the server. Can it be exposed to the client in another way than by using a return statement? I don't think so.
Maybe JAXB can solve a void method by automatically map the contents of your request Java-object instance to the same instance as the response Java-object.
Cheers
/Oskar
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132389#4132389
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132389
16 years, 10 months
[JBossWS] - Changeing minOccurs possible?
by SunFire
I have a method like this:
@WebMethod(operationName="GetBillingAccountRequest")
| @WebResult(name="GetBillingAccountResponse")
| public GetBillingAccountResponse getBillingAccount (
| @WebParam(name="GetBillingAccountRequest") GetBillingAccountRequest getBillingAccountRequest
| );
When i deploy the SFSB the resulting WSDL for the GetBillingAccountRequest type looks like this:
| <xs:complexType name="GetBillingAccountRequest">
| <xs:sequence>
| <xs:element minOccurs="0" name="GetBillingAccountRequest" type="tns:getBillingAccountRequest"/>
| </xs:sequence>
| </xs:complexType>
|
Is there any way to annotate that the GetBillingAccountRequest is supposed to be mandatory when the WSDL is auto generated (e.g. minOccurs="1")?
Thanks, Thorsten
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132336#4132336
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132336
16 years, 10 months