{{XSD_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
{{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_string},
+ {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_datetime},
//support some of the 1999 data types
{{XSD_STRING, XSD_STRING_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
{{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
+ {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
php_url *phpurl = NULL;
SOAP_STREAM stream;
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
zval *raw_request;
#endif
xmlDocDumpMemory(doc, &buf, &buf_size);
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
MAKE_STD_ZVAL(raw_request);
ZVAL_STRINGL(raw_request, buf, buf_size, 1);
add_property_zval(this_ptr, "__last_request", raw_request);
}
else
php_error(E_ERROR,"Could not connect to host");
- //php_url_free(phpurl);
+ /*php_url_free(phpurl);*/
}
if(stream)
{
zval **cookies;
- char *header = "POST %s HTTP/1.1\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
+ char *header = "POST %s HTTP/1.0\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
int size = strlen(header) + strlen(phpurl->host) + strlen(phpurl->path) + 10;
- // TODO: Add authication
+ /* TODO: Add authication */
if(sdl != NULL)
{
- // TODO: need to grab soap action from wsdl....
+ /* TODO: need to grab soap action from wsdl.... */
soap_headers = emalloc(size + strlen(soapaction));
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
}
if(err != (int)strlen(soap_headers))
php_error(E_ERROR,"Failed Sending HTTP Headers");
- // Send cookies along with request
+ /* Send cookies along with request */
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS)
{
smart_str cookie_str = {0};
zval **socket_ref;
SOAP_STREAM stream;
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
zval *raw_response;
#endif
if(!get_http_body(stream, http_headers, &http_body, &http_body_size))
php_error(E_ERROR, "Error Fetching http body");
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
MAKE_STD_ZVAL(raw_response);
ZVAL_STRINGL(raw_response, http_body, http_body_size, 1);
add_property_zval(this_ptr, "__last_response", raw_response);
#endif
- // Close every time right now till i can spend more time on it
- // it works.. it's just slower??
- //See if the server requested a close
+ /*
+ * Close every time right now till i can spend more time on it
+ * it works.. it's just slower??
+ * See if the server requested a close
+ */
http_close = TRUE;
+ /*
connection = get_http_header_value(http_headers,"Connection: ");
if(connection)
{
if(!strncmp(http_version,"1.1", 3))
http_close = FALSE;
}
+ */
if(http_close)
{
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", strlen("httpsocket") + 1);
}
- //Check and see if the server even sent a xml document
+ /* Check and see if the server even sent a xml document */
content_type = get_http_header_value(http_headers,"Content-Type: ");
if(content_type)
{
efree(content_type);
}
- //Grab and send back every cookie
- //Not going to worry about Path: because
- //we shouldn't be changing urls so path dont
- //matter too much
+ /*
+ Grab and send back every cookie
+ Not going to worry about Path: because
+ we shouldn't be changing urls so path dont
+ matter too much
+ */
cookie_itt = strstr(http_headers,"Set-Cookie: ");
while(cookie_itt)
{
trans_enc = get_http_header_value(headers, "Transfer-Encoding: ");
content_length = get_http_header_value(headers, "Content-Length: ");
- //this is temp...
- // netscape enterprise server sends in lowercase???
+ /*
+ this is temp...
+ netscape enterprise server sends in lowercase???
+ */
if(content_length == NULL)
content_length = get_http_header_value(headers, "Content-length: ");
#ifdef PHP_STREAMS
php_stream_getc(stream);php_stream_getc(stream);
#else
- //Eat up '\r' '\n'
+ /* Eat up '\r' '\n' */
php_sock_fgetc(stream);php_sock_fgetc(stream);
#endif
}
# define PHP_STREAMS
#endif
+#define SOAP_DEBUG 1
+
#ifdef PHP_WIN32
# ifdef PHP_STREAMS
# define SOAP_STREAM php_stream *
PHP_FE(__call, NULL)
PHP_FE(__parse, NULL)
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
PHP_FE(__getlastrequest, NULL)
PHP_FE(__getlastresponse, NULL)
PHP_FE(__getfunctions, NULL)
int fault_string_len, fault_code_len, fault_actor_len;
zval *thisObj, *details = NULL;
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs", &fault_string, &fault_string_len,
- &fault_code, &fault_code_len, &details, &fault_actor, &fault_actor_len) == FAILURE)
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs",
+ &fault_code, &fault_code_len, &fault_string, &fault_string_len,
+ &details, &fault_actor, &fault_actor_len) == FAILURE)
php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
GET_THIS_OBJECT(thisObj);
PHP_FUNCTION(__call)
{
- char *function, *soap_action, *uri;
- int function_len, soap_action_len, uri_len, i = 0;
- zval *args;
- zval **real_args;
- zval **param;
+ char *function=NULL, *soap_action=NULL, *uri=NULL;
+ int function_len=0, soap_action_len=0, uri_len=0, i = 0;
+ zval *args=NULL;
+ zval **real_args=NULL;
+ zval **param=NULL;
xmlDocPtr request = NULL;
- int num_params, arg_count;
- zval **ret_params;
+ int num_params=0, arg_count=0;
+ zval **ret_params=NULL;
- char *buffer;
+ char *buffer=NULL;
- int len;
+ int len=0;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|ss",
&function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len) == FAILURE)
GET_THIS_OBJECT(thisObj);
- if(zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault")) == SUCCESS)
+ if(zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault")))
RETURN_TRUE
else
RETURN_FALSE
RETURN_NULL();
}
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
PHP_FUNCTION(__getfunctions)
{
sdlPtr sdl;
{
zval *fault;
MAKE_STD_ZVAL(fault);
- set_soap_fault(fault, fault_string, fault_code, fault_actor, fault_detail);
+ set_soap_fault(fault, fault_code, fault_string, fault_actor, fault_detail);
add_property_zval(obj, "__soap_fault", fault);
}
TSRMLS_FETCH();
php_stream_close(stream);
#else
- close(stream);
+ SOCK_CLOSE(stream);
#endif
}