Hello,

I'm new to SOAP and was trying to tackle setting up a SOAP service to a Stateless Session Bean.  I have a simple method to test this out that takes 2 strings and returns a Boolean.  When I run my test client I get the following error:

In TemplateProvider.locate()
URI: urn:CanDEDataMgr
DD.ServiceClass: org.apache.soap.providers.StatelessEJBProvider
DD.ProviderClass: null
Call.MethodName: isUserValid
Naming Exception caught during InitialContext creation @ iiop://localhost:900
Ouch, the call failed:
  Fault Code   = SOAP-ENV:Server
  Fault String = Unable to initialize context


First question: What does this mean.  The next is realted to the first, do I have to change the localhost:900 to match my servers port that the service will be running from?  If so where do I change it( a small example would be great).

Here is my deployment descriptor for the service:

<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:CanDEDataMgr">
  <isd:provider type="org.apache.soap.providers.StatelessEJBProvider" scope="Application" methods="create isUserValid">
    <isd:option key="JNDIName" value="java:comp/env/ejb/CanDEDataMgr" />
    <isd:option key="FullHomeInterfaceName" value="com.lilly.javaatg.catd.ejb.CanDEDataMgrHome"/>
    <isd:option key="ContextProviderURL" value="ormi://duke1.d51.lilly.com:8088/catd"/>
    <isd:option key="FullContextFactoryName" value="com.evermain.server.ApplicationInitialContextFactory"/>
  </isd:provider>
        <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
</isd:service>

On the methods...Do I have to call the create method?  I expose it as per some examples but do not call it as per the examples.

And my test code:

URL url = new URL("http://foo.bar.lilly.com:8088/soap/servlet/rpcrouter");
    // Build the call.
    Call call = new Call ();
    call.setTargetObjectURI ("urn:CanDEDataMgr");
    call.setMethodName ("isUserValid");
    Vector params = new Vector ();
    params.addElement (new Parameter("userID", String.class, userID, Constants.NS_URI_SOAP_ENC));
    params.addElement (new Parameter("password", String.class, password, Constants.NS_URI_SOAP_ENC));
    call.setParams (params);

    // make the call: note that the action URI is empty because the
    // XML-SOAP rpc router does not need this. This may change in the
    // future.
    Response resp = call.invoke (/* router URL */ url, /* actionURI */ "" );

    // Check the response.
    if (resp.generatedFault ()) {
      Fault fault = resp.getFault ();
      System.out.println ("Ouch, the call failed: ");
      System.out.println ("  Fault Code   = " + fault.getFaultCode ());  
      System.out.println ("  Fault String = " + fault.getFaultString ());
    } else {
      Parameter result = resp.getReturnValue ();
      System.out.println ( "result ="+result.toString() );
      System.out.println ( "Done" );

And the method call in the SSB:

public boolean isUserValid(String userID, String password) throws CanDEException {
         String encryptedPassword = null;
         String userPasswd = null;
        try {
            UserVO user = getUser(userID);
            encryptedPassword = pesEncrypt(null, password);
            userPasswd = user.getPassword();
        }catch( RemoteException rex) {
            if(Log.isOn()) {Log.log("ejb.CanDEDataMgrBean", ".isUserValid(): RemoteException on isUserValid", rex); }
                        throw new CanDEException("Error in lisUserValid",rex);
        }
        if(userPasswd.equals(encryptedPassword)){
            return true;
        } else {
            return false;
        }
    }



Jonathan Bricker
Lilly Research Labs
Java ATG

Reply via email to