[jboss-user] [JBossWS] - the client can't invoke the service
Bouchwichman
do-not-reply at jboss.com
Wed Feb 27 05:21:51 EST 2008
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
More information about the jboss-user
mailing list