Loading ...
Sorry, an error occurred while loading the content.

axis-client, soap::lite server interop question

Expand Messages
  • Designlab Support
    hi *, i ve been playing around with soap::lite for quite a while now having great fun. however: someone forced me to write a soap client library with java and
    Message 1 of 1 , Jun 23, 2003
    • 0 Attachment
      hi *,
      i've been playing around with soap::lite for quite a while now
      having great fun. however: someone forced me to write a soap client
      library with java and axis. that was the point where fun with soap
      ended (on the java side - not on the perl one...) :))
      i finally got it to work but i'm not yet satisfied.

      maybe one of you has a better solution for the following issue or has
      come around this one earlier. in particular: the "copying" from one hashmap to
      another seems to me to be very inefficient. has anyone got an idea
      how to get around that and still be able to access each value by name?

      the soap-server:
      SOAP::Lite 0.55.
      a method called getHappiness()
      takes a number of named parameters:
      - firstname as string
      - lastname as string
      - happyness as string
      - someotherthing as string

      and returns a number of named parameters to the axis client without
      binding them together in a special soap-type:
      - name as string
      - yourHappyness as string
      - aPieceOfText as string

      the soap client:
      Apache Axis 1.0.
      sends the parameters and prints the result params to the commandline
      (for now...):

      public ReturnObject getResults() {
      // create service and call...
      Service service = new Service();
      Call call = (Call) service.createCall();

      // set call properties...
      call.setTargetEndpointAddress( new java.net.URL("http://somewhere.org/path/to/soap/service") );
      call.setOperationName(new QName("http://somewhere.org/path/to/someclass", "getHappyness"));
      call.addParameter( "firstname", XMLType.XSD_STRING, ParameterMode.IN );
      call.addParameter( "lastname", XMLType.XSD_STRING, ParameterMode.IN );
      call.addParameter( "happyness", XMLType.XSD_INT, ParameterMode.IN );
      call.addParameter( "someotherthing", XMLType.XSD_STRING, ParameterMode.IN );
      call.setReturnType( XMLType.XSD_STRING );

      call.invoke( new Object [] { "firstname",
      "someotherthing" });

      Map soapResult = call.getOutputParams();
      HashMap res = new HashMap();

      // build a map with string keys and string values from the
      // RPCParam-map that comes from call.getOutputParams() to be
      // able to access each value by name later on...
      for(int i=0; i < soapResult.size(); i++) {
      soapResult = null;

      // write result to return-object:
      ReturnObject ro = new ReturnObject();

      return ro;

      thanks for your help - even if i shouldn't get an answer, this might
      be an entry point for people that expierience this problem later on...

      best regards
    Your message has been successfully submitted and would be delivered to recipients shortly.