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

Re: [soaplite] Java to Perl - sending Key/Value Pairs w/SOAP

Expand Messages
  • Paul Kulchenko
    Hi, David! ... You didn t show package code on server side, but as far as I can guess you don t have this line in your code: package MyPackage; @ISA =
    Message 1 of 7 , Apr 29, 2001
    • 0 Attachment
      Hi, David!

      > There's a line in the ACCESSING HEADERS section that says
      > "You will get this functionality ONLY if you inherit your class
      > from the
      > SOAP::Server::Parameters class. This should keep existing code
      > working and
      > provides this feature only when you need it."
      >
      > Am I missing something?
      You didn't show package code on server side, but as far as I can
      guess you don't have this line in your code:

      package MyPackage;

      @ISA = 'SOAP::Server::Parameters';

      ... rest of your module code it here

      presence of SOAP::Server::Parameters will tell SOAP processor to add
      envelope as the last paramater for method call, so all your methods
      in this package will get it. Probably verbiage is unclear. I would
      appreciate if you could rephrase it.

      Best wishes, Paul.

      --- David Sarno <david.sarno@...> wrote:
      > Paul,
      >
      > Thanks for the help so far. Unfortunately, the following doesn't
      > work:
      >
      > sub Create {
      > my $self = shift;
      > my $envelope = pop;
      > %args = (Owner => undef,
      > ....,
      > %{$envelope->method});
      > ...CODE...
      > }
      >
      > The XML output is below, but when I execute a client call, I think
      > the pop
      > is getting a data parameter, not the envelope. It's trying to call
      > somearg->method. When I do a parameter trace with +trace
      > qw(parameters),
      > the envelope doesn't show up at the end of the list.
      >
      > POST http://myserversoap/serv.cgi
      > Accept: text/xml
      > Accept: multipart/*
      > Content-Length: 948
      > Content-Type: text/xml; charset=utf-8
      > SOAPAction: "RTCreate#Create"
      >
      > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      >
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body><namesp1:Create
      > xmlns:namesp1="RTCreate"><c-gensym5
      > xsi:type="xsd:string">MIMEObj</c-gensym5><c-gensym7
      > xsi:null="1"/><c-gensym9
      > xsi:type="xsd:string">Subject</c-gensym9><c-gensym11
      > xsi:type="xsd:string">this is the subject</c-gensym11><c-gensym13
      > xsi:type="xsd:string">Owner</c-gensym13><c-gensym15
      > xsi:type="xsd:string">das</c-gensym15><c-gensym17
      > xsi:type="xsd:string">Requestor</c-gensym17><c-gensym19
      > xsi:type="xsd:string"/><c-gensym21
      > xsi:type="xsd:string">Queue</c-gensym21><c-gensym23
      >
      xsi:type="xsd:string">testqueue</c-gensym23></namesp1:Create></SOAP-ENV:Body
      > ></SOAP-ENV:Envelope>
      > HTTP/1.1 500 Internal Server Error
      > Connection: close
      > Date: Mon, 30 Apr 2001 03:02:10 GMT
      > Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1
      > OpenSSL/0.9.5a
      > DAV/1.0.2 PHP/4.0.4pl1 mod_perl/1.24 mod_jk
      > Content-Length: 618
      > Content-Type: text/xml
      > Client-Date: Mon, 30 Apr 2001 03:02:13 GMT
      > Client-Peer: ----
      > SOAPServer: SOAP::Lite/Perl/0.50
      >
      > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      >
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body><SOAP-ENV:Fault>
      > <faultcode
      > xsi:type="xsd:string">SOAP-ENV:Server</faultcode><faultstring
      > xsi:type="xsd:string">Can't locate object method "method" via
      > package
      > "testqueue" at RTCreate.pm line 48.
      > </faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
      >
      > There's a line in the ACCESSING HEADERS section that says
      > "You will get this functionality ONLY if you inherit your class
      > from the
      > SOAP::Server::Parameters class. This should keep existing code
      > working and
      > provides this feature only when you need it."
      >
      > Am I missing something?
      >
      > Thanks again,
      >
      > Dave
      >
      >
      > > method call will return hash where keys are NAMEs of parameters
      > and
      > > VALUEs are values, so it should do what you need. Let me know if
      > it's
      > > not what you want.
      > >
      > > Best wishes, Paul.
      > >
      > > --- David Sarno <david.sarno@...> wrote:
      > > > > Difficult to say something without looking into wiredump or
      > > > source
      > > > > code on client side. Could you run it thru tcpTrace (or
      > something
      > > > > similar) and send us request message?
      > > >
      > > > Here's the client source, I don't have tcptrace installed, but
      > will
      > > > work on
      > > > it. The Parameter objects take a name, class, value and
      > encoding.
      > > > The way
      > > > we want it to work, the (name, value) would be a key/value
      > pair. In
      > > > practive, only the value is coming across to the remote method.
      > As
      > > > you can
      > > > see, I created the Call with a redundant string value for each
      > > > Parameter
      > > > (e.g. OwnerKey + val, and then Owner + val -- where it would be
      > > > better to
      > > > just pass Owner, Val once). This fixes the problem, but seems
      > > > messy. On the
      > > > other hand, maybe it isn't. Any advice?
      > > >
      > > > Thanks again.
      > > >
      > > > --dave
      > > >
      > > > ****
      > > > import java.io.*;
      > > > import java.net.*;
      > > > import java.util.*;
      > > > import org.apache.soap.util.xml.*;
      > > > import org.apache.soap.*;
      > > > import org.apache.soap.rpc.*;
      > > >
      > > > public class RTClient {
      > > > static XMLParserLiaison xpl = new XercesParserLiaison ();
      > > >
      > > > public static void main (String[] args) throws Exception {
      > > > if( args.length < 5 ) {
      > > > System.err.println ("Usage: java " +
      > RTClient.class.getName ()
      > > > +
      > > > " Owner Queue Subject Requestor Msg");
      > > > System.exit (1);
      > > > }
      > > >
      > > > URL url = new URL("http://myserver.com/serv.cgi");
      > > > String owner = args[0];
      > > > String queue = args[1];
      > > > String subject = args[2];
      > > > String requestor = args[3];
      > > > String msg = args[4];
      > > >
      > > > // Build the call.
      > > > String enc = new String(Constants.NS_URI_SOAP_ENC);
      > > > Call call = new Call ();
      > > > call.setTargetObjectURI("RTCreate");
      > > > call.setMethodName("Create");
      > > > call.setEncodingStyleURI(enc);
      > > > Vector params = new Vector ();
      > > > params.addElement(new Parameter("OwnerKey", String.class,
      > "Owner",
      > > > null));
      > > > params.addElement(new Parameter("Owner", String.class,
      > someowner,
      > > > null));
      > > > params.addElement(new Parameter("QueueKey", String.class,
      > "Queue",
      > > > null));
      > > > params.addElement(new Parameter("Queue", String.class,
      > somequeue,
      > > > null));
      > > > call.setParams (params);
      > > > System.out.println("Call:\n" + call.toString() + "\n\n");
      > > >
      > > > // 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 (url, "");
      > > >
      > > > // 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
      > > > ());
      > > > System.out.println (" Whole fault = " + fault.toString());
      > > > } else {
      > > > Parameter result = resp.getReturnValue ();
      > > > System.out.println(result.getValue());
      > > > System.out.println(resp.toString());
      > > > }
      > > > }
      > > > }
      > > >
      > > > ******
      > > >
      > > > > Something that MIGHT help is that SOAP::Lite passes
      > CLASS?OBJECT
      >
      === message truncated ===


      __________________________________________________
      Do You Yahoo!?
      Yahoo! Auctions - buy the things you want at great prices
      http://auctions.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.