You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Peter Ondrus <pe...@humantec.sk> on 2002/05/20 16:48:36 UTC

SOAP & entity EJBs

Hello,
we have an entity EJB on the server, and we neet to do SOAP RPC calls to 
it. It seems that everithing works fine on server side, but when I call 
findByPrimaryKey method, it seems, that I have some problems with 
serialization/deserialization of returned interface from 
findByPrimaryKey method. Is it necessary to write my own 
serializer/deserializer, or 
org.apache.soap.encoding.soapenc.BeanSerializer should be enough? I do 
not know where else could be a problem.
Here is my DD and code of client:

Deployment descriptor:
<?xml version="1.0"?>

<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
             id="urn:ejbsoaptest">
  <isd:provider type="org.apache.soap.providers.EntityEJBProvider"
                scope="Application"
                methods="getValue setValue">
    <isd:java class="humantec.SoapTestEntity"/>
    <isd:option key="FullHomeInterfaceName" 
value="sk.humantec.hcs.ma.server.soap.TestEntityHome" />
    <isd:option key="ContextProviderURL" value="jnp://localhost:1099" />
    <isd:option key="FullContextFactoryName" 
value="org.jnp.interfaces.NamingContextFactory" />
  </isd:provider>
        
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
  <isd:mappings>
    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:x="urn:xml-soap-soaptest" qname="x:TestEntityRemote"
             javaType="sk.humantec.hcs.ma.server.soap.TestEntityRemote"
             
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
             
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
  </isd:mappings>
</isd:service>

Client code:
            String service = "urn:ejbsoaptest";
            Call call = new Call ();

            call.setTargetObjectURI (service);
            String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
            call.setEncodingStyleURI(encodingStyleURI);

           
            call.setMethodName ("findByPrimaryKey");
            Vector params = new Vector ();
            params.addElement (new Parameter("id", Integer.class, new 
Integer(2), null));
            call.setParams(params);
            Response resp = call.invoke (/* router URL */ url, /* 
actionURI */ "" );
        // this works OK - without fail or exception
          
            String ejbKeyURI = resp.getFullTargetObjectURI();

            Call callM = new Call();
           System.out.println("ejbKeyURI:"+ejbKeyURI);
          
           callM.setFullTargetObjectURI( resp.getFullTargetObjectURI());
          
           callM.setEncodingStyleURI(encodingStyleURI);
          
           callM.setMethodName ("getValue");
           resp = callM.invoke (/* router URL */ url, /* actionURI */ "" );
// this fails with \SOAP exception - no such Method  findByPrimaryKey

thanks for any help.

Peter