You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Xiaohong Wang <xw...@esri.com> on 2003/09/07 20:51:37 UTC

DII invoke--server bean class compile problem

Hi,

I have a web service deployed in Axis and consumed it in Axis client by Call
object (by following the example5 in \samples\userguide). It works when I
tested in the same machine where the server exposed. However when I tried
the same client code(please see the client code at the bottom of email) in a
remote machine, which has axis installed but no server class at all, the
same code can't get compiled, simply because it has no clue about the server
side bean class (in this case, it is ToxicSite.class). My understanding of
Jax-Rpc DII binding pattern is that it invokes services dynamically, it
shouldn't require any of stub class or proxy class. Then how a client get
compiled when it's looking for a registered bean class? Do I miss anything
really simple here or should I just use static binding by wsdl2java in this
case? I'm using Axis 1.0 and Tomcat 4.0. Thanks for any help.


package toxiclocations;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.util.ArrayList;

import java.lang.Double;

public class TestClient {
      public static void main(String [] args) {
          try {
            String endpoint =
                       "http://localhost:8090/axis/services/ToxicLocations";
//if tcpmon listen port is 8090,
                   //otherwise, should be
"http://localhost:8080/axis/services/MyCalc"

            Service service = new Service();
            Call call = (Call) service.createCall();
            QName qn = new QName( "urn:ToxicSiteBeanService", "ToxicSite" );
            call.registerTypeMapping(ToxicSite.class, qn,
                      new
org.apache.axis.encoding.ser.BeanSerializerFactory(ToxicSite.class, qn),
                      new
org.apache.axis.encoding.ser.BeanDeserializerFactory(ToxicSite.class, qn));
            call.setTargetEndpointAddress( new java.net.URL(endpoint) );
            call.setOperationName(new QName("http://soapinterop.org/",
"FindToxicLocations"));
            call.setReturnClass( java.util.ArrayList.class );

            ArrayList sites =(ArrayList) call.invoke( new Object[] { new
String("2111 Division St"),new String("97202"),new Double(10000)});
            for(int i=0;i<sites.size();i++){
              ToxicSite site = (ToxicSite)sites.get(i);
              System.out.println(site.getName());
              System.out.println(site.getType());
            }

         } catch (Exception e) {
             e.printStackTrace();
         }
     }
}

Xiao