GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTTP_XML(3) FreeBSD Library Functions Manual HTTP_XML(3)

http_xml_send, http_xml_send_xmlrpc, —
XML and XML-RPC requests over HTTP

PDEL Library (libpdel, -lpdel)

#include <sys/types.h>
#include <netinet/in.h>
#include <pdel/http/xml.h>

int
http_xml_send(struct http_client *client, struct in_addr ip, u_int16_t port, int https, const char *urlpath, const char *username, const char *password, const char *ptag, const char *pattrs, const struct structs_type *ptype, const void *payload, int pflags, const char *rtag, char **rattrsp, const char *rattrs_mtype, const struct structs_type *rtype, void *reply, int rflags, structs_xmllog_t *rlogger);

int
http_xml_send_xmlrpc(struct http_client *client, struct in_addr ip, u_int16_t port, int https, const char *username, const char *password, const char *methodName, u_int nparams, const struct structs_type **ptypes, const void **pdatas, const struct structs_type *rtype, void *reply, struct xmlrpc_compact_fault *fault, structs_xmllog_t *rlogger);

int
http_xml_send_xmlrpc2(struct http_client *client, struct in_addr ip, u_int16_t port, int https, const char *username, const char *password, const char *urlpath, const char *methodName, u_int nparams, const struct structs_type **ptypes, const void **pdatas, const struct structs_type *rtype, void *reply, struct xmlrpc_compact_fault *fault, structs_xmllog_t *rlogger);

These functions send and receive XML and XML-RPC over HTTP and HTTPS. They are convenience wrappers around the http_request(3), http_response(3), structx_xml_input(3), structs_xml_output(3), and structs_xmlrpc(3) routines.

http_xml_send() uses client to send an HTTP request for the URL path urlpath (which must being with a '/') to IP address ip and port port. If https is non-zero, an SSL (HTTPS) request is made. The username and password may be non- NULL for "Basic" HTTP authentication.

The remaining arguments to http_xml_send() describe the optional XML request payload and the expected XML reply payload.

To include a payload in the request, payload should be non- NULL. If so, ptag, pattrs, ptype, payload, and pflags are handled exactly like the elem_tag, attrs, type, data, and flags parameters (respectively) to the function structs_xml_output(3). The request payload will be sent using an HTTP POST with MIME type "text/xml". If payload is NULL, an HTTP GET request is sent instead.

The HTTP response must contain an XML document, which is parsed and converted into native binary format. The rtag, rattrsp, rattrs_mtype, rtype, reply, rflags, and rlogger are handled exactly like the elem_tag, attrp, attr_type, type, data, flags, and logger parameters (respectively) to the function structs_xml_input(3).

http_xml_send_xmlrpc() sends an XML-RPC request. The client, ip, port, https, username, password, and rlogger parameters are as with http_xml_send(). The XML-RPC method name is pointed to by methodName. nparams XML-RPC request parameters are sent; ptypes must point to an array of nparams parameter types and pdatas to an array of nparams parameter values having the corresponding types. These are “compact” structs(3) types that will be automatically expanded into “exploded” XML-RPC types when the actual request is sent (see structs_xmlrpc(3)).

To send exploded XML-RPC values directly, set ptypes to NULL. Then it will be assumed that each element in the pdatas array is an instance of structs_type_xmlrpc_value(3), i.e., a struct xmlrpc_value_union.

If reply is NULL, the reply is ignored. Otherwise, the XML-RPC return value must have “compact” type matching rtype and reply must point to an uninitialized region of memory large enough to hold an instance of rtype. If the request is successful and no fault is returned, http_send_xmlrpc() returns zero and reply will be initialized with the “compacted” XML-RPC return value. If the returned value does not match rtype, then -1 is returned with errno set appropriately.

To have the exploded XML-RPC value returned directly, set rtype to NULL. Then it will be assumed that reply points to an uninitialized instance of structs_type_xmlrpc_value(3), i.e., a struct xmlrpc_value_union, and the reply will be returned unmodified.

If an XML-RPC fault is returned, then *reply remains unmodified and http_xml_send_xmlrpc() returns -2. In addition, if fault is not NULL, then it is assumed to point to an uninitialized instance of structs_type_xmlrpc_compact_fault, i.e., a struct xmlrpc_compact_fault. The instance will be initialized with the received XML-RPC fault. The calling function is responsible for eventually uninitializing it.

http_xml_send_xmlrpc2() is the same as http_xml_send_xmlrpc() but allows the caller to specify an URL path other than the standard “/RPC2”. sends an XML-RPC request.

Upon error the above functions return -1 and set errno to an appropriate value.

If http_xml_send_xmlrpc() or http_xml_send_xmlrpc2() receives an XML-RPC fault from the server, -2 is returned.

http_client(3), http_request(3), http_response(3), http_servlet_xml(3), http_servlet_xmlrpc(3), libpdel(3), structs_xml_input(3), structs_xmlrpc(3)

XML-RPC Home Page, http://www.xmlrpc.org/.

The PDEL library was developed at Packet Design, LLC. http://www.packetdesign.com/

Archie Cobbs ⟨archie@freebsd.org⟩

HTTP redirects are not followed; instead they generate an error.
April 22, 2002 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.