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

Perl client to Java web service

Expand Messages
  • Jason
    I m having a hard time writing a Perl client to my Java web service. So far I ve been able to access the service fine, the problem is when one of my methods on
    Message 1 of 2 , Jan 12, 2004
    View Source
    • 0 Attachment
      I'm having a hard time writing a Perl client to my Java web service.

      So far I've been able to access the service fine, the problem is when
      one of my methods on the service requires a complex Java class as a
      paramater. I have no idea how to go about passing something like that
      via SOAP. Can someone point me to a tutorial, or even better, perhaps
      show me what the SOAP request would look like? I'll include a very
      simple Java class. If I could just see one good example of a Java
      class represented in SOAP, using complex object types, I could figure
      out my problem.


      ---

      package my.java.package;

      import java.util.Date;

      public class ComplexClass
      {
      private int intProperty = 0;
      private String stringProperty = null;
      private Date dateProperty = null;

      public void setIntProperty(int inInt)
      {
      intProperty = inInt;
      }

      public int getIntProperty()
      {
      return intProperty;
      }

      public void setStringProperty(String inString)
      {
      stringProperty = inString;
      }

      public String getStringProperty()
      {
      return stringProperty;
      }

      public void setDateProperty(Date inDate)
      {
      dateProperty = inDate
      }

      public Date getDate()
      {
      return dateProperty;
      }

      }
    • Aaron Trevena
      ... You could use complex types representing java objects, but it would make SOAP clients a lot less simple to write in any non-Java language. It would also
      Message 2 of 2 , Jan 13, 2004
      View Source
      • 0 Attachment
        On Mon, 12 Jan 2004, Jason wrote:
        > So far I've been able to access the service fine, the problem is when
        > one of my methods on the service requires a complex Java class as a
        > paramater. I have no idea how to go about passing something like that
        > via SOAP. Can someone point me to a tutorial, or even better, perhaps
        > show me what the SOAP request would look like? I'll include a very
        > simple Java class. If I could just see one good example of a Java
        > class represented in SOAP, using complex object types, I could figure
        > out my problem.

        You could use complex types representing java objects, but it would make
        SOAP clients a lot less simple to write in any non-Java language. It would
        also defeat the purpose of SOAP - S is supposed to stand for Simple. If
        you want to pass java objects around then use RMI and CORBA - thats what
        they were made for.

        Of course you could always assume that people might not use java and so
        design a web interface that is transparent - take arguments, and construct
        the java object you want yourself rather than expecting the client to do
        it.

        The best solution would be to design a simple XML representation of what
        you want, and parse that into a new java object inside your webservice -
        you shouldn't expect client programmers to do your job for you ;) Then if
        you really want to make your webservice professional you could provide a
        WDSL so that client programmers can (in theory at least) built clients
        quickly without having to delve too much into complex data structures.

        If you want to build complex data (rather than complex data types) in SOAP
        see the <plug>SOAP::Data::Builder</plug> perl module, which should make
        your life easier.

        Hope that helps,

        A.

        --
        Aaron J Trevena - Perl Hacker, Kung Fu Geek, Internet Consultant
        AutoDia --- Automatic UML and HTML Specifications from Perl, C++
        and Any Datasource with a Handler. http://droogs.org/autodia
      Your message has been successfully submitted and would be delivered to recipients shortly.