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

Re: [soaplite] changing Accept: headers

Expand Messages
  • Byrne Reese
    Currently in 0.60, this capability is not easily accomplished. In fact you identified the only way to do it: subclass SOAP::Transport::HTTP::Client. But in
    Message 1 of 4 , Oct 8, 2004
    • 0 Attachment
      Currently in 0.60, this capability is not easily accomplished. In fact you identified the only way to do it: subclass SOAP::Transport::HTTP::Client.

      But in SOAP::Lite 0.65 due out next week, this capability has finally been added. In fact, SOAP clients finally have direct access to the HTTP::Request and HTTP::Response objects making a great many things easier to do - i.e. setting cookies, reading or writing response content. You name it.

      For example, to change the Accept headers, one would do the following:

      my $client = SOAP::Lite
          ->readable(1)
          ->uri($NS)
          ->proxy($HOST);
       
      $client->transport->http_request->header(Accept => ['text/xml', 'multipart/*', 'application/soap', 'text/plain']);

      $client->myMethod();

      Anyway, I know this is a response to an "old" question, but I thought I would let you know that the newsgroup is being read, bugs fixed, and features being added.

      Andrew Moore wrote:

      Hi -

      I'm working with an IBM redback application server from a SOAP::Lite
      client. The server doesn't seem to like the default Accept: headers that
      SOAP::Transport::HTTP produces. I'd like to be able to remove the
      "Accept: multipart/*" header since it appears to confuse the server.
      Yes, I am apparently working aruond a bug in the server.

      Rather than subclassing SOAP::Transport::HTTP and overriding the
      send_receive() method in it to fix the headers, is there a way to adjust
      the headers generated in SOAP::Transport::HTTP? I notice that they are
      made with
      $req->header(Accept => ['text/xml', 'multipart/*']);
      but I can't seem to specify an alternative Accept header.

      Any ideas?

      Thanks,
      Andy






      Yahoo! Groups Links


    • Byrne Reese
      Setting the HTTP timeout in SOAP::Lite can be accomplished using the following code: my $soap = SOAP::Lite - uri($uri) - proxy($proxyUrl, timeout = 5 ); print
      Message 2 of 4 , Oct 8, 2004
      • 0 Attachment
        Setting the HTTP timeout in SOAP::Lite can be accomplished using the following code:
        my $soap = SOAP::Lite
           ->uri($uri)
           ->proxy($proxyUrl, timeout => 5 );
        print "timeout: ".$soap->proxy->timeout."\n";
        $soap->proxy->timeout(100);
        print "timeout: ".$soap->proxy->timeout."\n";
        print $soap->c2f(SOAP::Data->name('temperature' => 100));
        This is because SOAP::Lite->proxy returns an instance of the transport layer. And in HTTP the SOAP::Transport::HTTP::Client class extends LWP::UserAgent. All methods available in LWP::UserAgent are also available to users of SOAP::Lite's SOAP::Transport::HTTP::Client class. Which includes timeout.


        Peijun Zhang wrote:
        Hi, everyone,

        I am developing a SOAP server/client in OO-style. I
        need to transfer a big size of data. When I am trying
        it, I always got an error "500 read timeout at ..."
        (it is about 220 seconds). I guess what I need to do
        is to re-set timeout parameter at both server and
        client sides. However, I were not able to have it
        done. Could anyone give me some pointers?

        Thanks

        Peijun Zhang

        __________________________________
        Do you Yahoo!?
        Yahoo! SiteBuilder - Free web site building tool. Try it!
        http://webhosting.yahoo.com/ps/sb/



        Yahoo! Groups Links


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