Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: REST Webservices and CGI.pm

by ruoso (Curate)
on Apr 13, 2007 at 08:19 UTC ( [id://609845]=note: print w/replies, xml ) Need Help??


in reply to REST Webservices and CGI.pm

You probably may want to know that the later version of CGI does support XForms Model POST, both as application/xml and as multipart/related. When you do such a post, the XML is available through the query param XForms:Model. As in CGI.pm

# Process XForms postings. We know that we have XForms in the # following cases: # method eq 'POST' && content-type eq 'application/xml' # method eq 'POST' && content-type =~ /multipart\/related.+start +=/ # There are more cases, actually, but for now, we don't support +other # methods for XForm posts. # In a XForm POST, the QUERY_STRING is parsed normally. # If the content-type is 'application/xml', we just set the para +m # XForms:Model (referring to the xml syntax) param containing th +e # unparsed XML data. # In the case of multipart/related we set XForms:Model as above, + but # the other parts are available as uploads with the Content-ID a +s the # the key. # See the URL below for XForms specs on this issue. # http://www.w3.org/TR/2006/REC-xforms-20060314/slice11.html#sub +mit-options
daniel

Replies are listed 'Best First'.
Re^2: REST Webservices and CGI.pm
by derby (Abbot) on Apr 13, 2007 at 12:58 UTC

    Thanks ruoso. The new version of CGI still doesn't support PUT but holy crap ... a mime type of application/xml - that's a broad stroke that's going to cause lots-o-people grief - what was the W3C thinking when they decided that -- not all xml http traffic is going to be XForms.

    -derby

    Update: Looking at RFC 3023, you would think the correct mime type for XForms should be application/xforms-xml ... but hey what do I know.

Re^2: REST Webservices and CGI.pm
by wdsaeghe (Acolyte) on Oct 18, 2011 at 08:07 UTC
    Thanks for explaining this here. Is it documented anywhere? I have been chewing on CGI and the POSTDATA parameter for the last day, only to find out that the documentation is out-of-date. From the documentation on CPAN and perldoc:

    If POSTed data is not of type application/x-www-form-urlencoded or multipart/form-data, then the POSTed data will not be processed, but instead be returned as-is in a parameter named POSTDATA.

    ...

    (If you don't know what the preceding means, don't worry about it. It only affects people trying to use CGI for XML processing and other specialized tasks.)

    So, me, thinking I am using CGI for XML processing... Only after having it print out everything it's got, I find a param('XForms:Model') - I can't find anything about that on CPAN or perldoc for CGI though! Can someone update the doc or should I file a bug-report on CPAN?
      param('XForms:Model')

      would mean that something script sent a CGI parameter to your script with the name XForms:Model. Why would what other programs send to your script need to be documented in CGI.pm? Update: Ah - XForms:Model would be somewhat "special", I now see. If this is handled by CGI.pm, then it should be documented there indeed.

        Indeed. The code that sends, is this:
        my $browser = LWP::UserAgent->new; push @{ $browser->requests_redirectable }, 'POST'; my $response = $browser->post( $url, [], 'content-type'=> 'application/xml', 'content' => $xml );
        and just using a commandline curl POST (to indeed check LWP was not doing special stuff and inventing XForms:Model parameters) gives the same result.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://609845]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-04-23 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found