[jboss-user] [JBossWS] - Problems in the comunication of a WebService and a client

Fantagir do-not-reply at jboss.com
Wed Sep 26 10:13:46 EDT 2007


Hi!

I'm implementing a webservice using Jbossws and jax-rpc.  I  develop the next one service:

package edu.campus.osid.authentication.client;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface IAuthenticationComponent extends Remote{
	
	public boolean isUserAuthenticated(org.osid.OsidContext ctx) throws RemoteException;
	
}

package edu.campus.osid.authentication.client;

import java.rmi.RemoteException;

import org.osid.OsidContext;
import org.osid.OsidException;

public class AuthenticationComponent implements IAuthenticationComponent {

	public boolean isUserAuthenticated(OsidContext ctx) throws RemoteException{
		String str;
		try {
			str = (String) ctx.getContext("iduser");
			int iId = Integer.parseInt(str);
			if (iId ==1) return true;
			else return false;
		} catch (OsidException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("Error AuthenticationComponentServer/Osid: "+e.getMessage());
			throw new RemoteException();
		} 
	
	}

}

I have the OsidContext class in a .jar that I add in the Java Buid Path of my project. When I build the project no errors appears. But when I want to publish the service (generate the .war of the webservice, generate file .wsdl, mapping.xml) the wstools said that cant find the ?OsidContext? class.
 If I unzip the .jar in the directory /bin of my project wstools can fing the classes.

There is another way of to solve this problem? What I have to do?

An other problem is in the client. I develop the client for this webservice and when I execute  the  next errors appears ?Cannot obtain java type mapping for: {urn:types}OsidContext?

My client code is the next one:

public class Main {
	public static void main( String[] args ) throws Exception {
	    if( args.length < 1 )
	    {
	      System.out.println( "Usage: Id name" );
	      System.exit( 0 );
	    }
	    
	    String argument = args[ 0 ];
		
	    OsidContext ctx = new OsidContext();
          ctx.assignContext("iduser", argument);	    

	    //CollectionProperties propietats = new CollectionProperties();
	    String urlstr = CollectionProperties.getPropiedad("service.url");
	    String nameServiceStr = CollectionProperties.getPropiedad("service.name");
	    String namespaceServiceStr = CollectionProperties.getPropiedad("service.namespace");

	    System.out.println( "Contacting webservice at " + urlstr );

	    URL url = new URL(urlstr);

	    //se indican el namespace en el que se encuentra el servicio y su nombre 
	    //(esto se puede ver en el WSDL)
	    QName qname = new QName(namespaceServiceStr,
	                nameServiceStr);

	    ServiceFactory factory = ServiceFactory.newInstance();
	    Service    service = factory.createService( url, qname );
	    
	        
	    I AuthenticationComponent  age  = ( I AuthenticationComponent  ) service.getPort( IAuthenticationComponent.class );

	    System.out.println( "age.age(" + id + ")" );
	    System.out.println( "output:" + age.isUserAuthenticated ( ctx ) );
	  }
}


What can I do? I have the .jar that contains the class OsidContext in this project as well in the project of the Webservice

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088870#4088870

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088870



More information about the jboss-user mailing list