T Gopalakrishnan wrote:
Hi
I am new to WSIF and i tried to create my own example
by modifying the existing complexsoap example.
I created a sample ejb with one method
isValidUser(String userName) which accepts the
username and if the user is valid it return
the employee details(a value object EmployeeDTO) else
it returns null.
I deployed both ejb and webservice and when i tried to
execute the client i struck with some errors.
While parsing the wsdl it throws the error.
http://localhost:8080/axis/services/SampleWSIFWebService
is the url for accessing webservice and
SampleWebService is my remote interface name
try to do this:
WSIFService service = factory.getService(args[0], null,null, "urn:SampleWSIFWebService", "SampleWebService");
instead of
WSIFService service = factory.getService(args[0], null,null, "http://localhost:8080/axis/services/SampleWSIFWebService", "SampleWebService");
because when selecting use namespace of WSDL and not its location.
HTH,
alek
Can any one tell what is the mistake i did.
deploy.wsdd ===========
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="SampleWSIFWebService"
provider="java:EJB">
<parameter name="className"
value="com.company.wsif.SampleWSIFWebService"/>
<parameter name="allowedMethods"
value="isValidUser"/>
<parameter name="jndiURL"
value="jnp://localhost:1099"/>
<parameter name="beanJndiName"
value="SampleWebServiceBean" />
<parameter name="homeInterfaceName"
value="com.company.wsif.ejb.SampleWebServiceHome" />
<parameter name="remoteInterfaceName"
value="com.company.wsif.ejb.SampleWebService" />
<parameter name="jndiContextClass"
value="org.jnp.interfaces.NamingContextFactory"/>
</service>
</deployment>
My Client Program =================
package com.company.wsif;
import com.company.wsif.ejb.EmployeeDTO;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import org.apache.wsif.WSIFException; import org.apache.wsif.WSIFService; import org.apache.wsif.WSIFServiceFactory;
/** * DOCUMENT ME! * * @author $author$ * @version $Revision$ */ public class SampleWebServiceWSIFClient { /** * DOCUMENT ME! * * @param args DOCUMENT ME! */ public static void main(String[] args) { try { if (args.length != 2) { System.out.println( "Usage: java com.company.wsif.SampleWebServiceWSIFClient <wsdl location> <employee name>"); System.exit(1); }
// create a service factory WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); System.out.println("HAAAI");
// parse WSDL
WSIFService service =
factory.getService(args[0], null,null,
"http://localhost:8080/axis/services/SampleWSIFWebService",
"SampleWebService");
System.out.println("WSIFService");
// map types
service.mapType(new
QName("http://localhost:8080/axis/services/SampleWSIFWebService",
"EmployeeDTO"),
Class.forName("com.company.wsif.EmployeeDTO"));
// create the stub System.out.println("mapType");
com.company.wsif.ejb.SampleWebService stub = (com.company.wsif.ejb.SampleWebService) service.getStub(com.company.wsif.ejb.SampleWebService.class); System.out.println("stub");
// do the invocation // args[1] is the zip code EmployeeDTO empInfo = (EmployeeDTO) stub.isValidUser("gopal"); System.out.println("empInfo"); System.out.println("This zip code is in " + empInfo.getEmployeeCode() + "," + empInfo.getEmployeeName() + " in " + empInfo.getDepartment() + " county\n"); } catch (WSIFException we) { System.out.println("Error while executing sample, received an exception from WSIF; details:"); we.printStackTrace(); } catch (RemoteException re) { System.out.println("Error while executing sample, received an exception due to remote invocation; details:"); re.printStackTrace(); } catch (ClassNotFoundException ce) { System.out.println( "Error while executing sample, could not find required class complexsoap.client.stub.com.cdyne.ws.LatLongReturn; please add it to your classpath; details:"); ce.printStackTrace(); } } }
This was the i got while executing the client =============================================
Error while executing sample, received an exception from WSIF; details: org.apache.wsif.WSIFException: PortType '{http://localhost:8080/axis/services/}SampleWSIFWebService' not found. Choices are: {{urn:SampleWSIFWebService}SampleWSIFWebService} at org.apache.wsif.util.WSIFUtils.getNamedItem(Unknown Source) at org.apache.wsif.util.WSIFUtils.selectPortType(Unknown Source) at org.apache.wsif.base.WSIFServiceImpl.<init>(Unknown Source) at org.apache.wsif.base.WSIFServiceFactoryImpl.getService(Unknown Source) at com.company.wsif.SampleWebServiceWSIFClient.main(SampleWebServiceWSIFClient.java:42)
===== Thanks and Regards T.Gopalakrishnan ================== SUCCESS IS A JOURNEY NOT A DESTINATION
Send instant messages to your online friends http://uk.messenger.yahoo.com
-- The best way to predict the future is to invent it - Alan Kay
