[wsf-c-dev] svn commit r200 - in wsf/php: . build build/src src
src/samples src/samples/math src/samples/resources
src/scripts src/tests src/xdocs src/xdocs/samples src/xdocs/style
svn at wso2.com
svn at wso2.com
Mon Dec 11 01:32:53 PST 2006
Author: sanjaya
Date: Mon Dec 11 01:32:52 2006
New Revision: 200
Added:
wsf/php/AUTHORS
wsf/php/COPYING (contents, props changed)
wsf/php/ChangeLog
wsf/php/INSTALL
wsf/php/Makefile.am
wsf/php/NEWS
wsf/php/README
wsf/php/autogen.sh (contents, props changed)
wsf/php/build/
wsf/php/build.sh (contents, props changed)
wsf/php/build/src/
wsf/php/build/src/config.m4 (contents, props changed)
wsf/php/configure.ac
wsf/php/src/
wsf/php/src/LICENSE (contents, props changed)
wsf/php/src/README.INSTALL
wsf/php/src/README.INSTALL_WIN32
wsf/php/src/config.m4 (contents, props changed)
wsf/php/src/config.w32 (contents, props changed)
wsf/php/src/out_transport_info.c (contents, props changed)
wsf/php/src/package2.xml
wsf/php/src/php_encoding.c
wsf/php/src/php_encoding.h
wsf/php/src/php_http.c
wsf/php/src/php_http.h
wsf/php/src/php_schema.c
wsf/php/src/php_schema.h
wsf/php/src/php_sdl.c
wsf/php/src/php_sdl.h
wsf/php/src/php_xml.c
wsf/php/src/php_xml.h
wsf/php/src/project.xml
wsf/php/src/samples/
wsf/php/src/samples/README.SAMPLES
wsf/php/src/samples/echo_client.php
wsf/php/src/samples/echo_client_addr.php
wsf/php/src/samples/echo_client_multiple_invocation.php
wsf/php/src/samples/echo_client_sec_digest.php
wsf/php/src/samples/echo_client_sec_plaintext.php
wsf/php/src/samples/echo_client_sec_timestamp.php
wsf/php/src/samples/echo_service.php
wsf/php/src/samples/echo_service_addr.php
wsf/php/src/samples/echo_service_sec.php
wsf/php/src/samples/google_search.php
wsf/php/src/samples/google_spell.php
wsf/php/src/samples/math/
wsf/php/src/samples/math/math_client.php
wsf/php/src/samples/math/math_service.php
wsf/php/src/samples/mtom_download_client.php
wsf/php/src/samples/mtom_download_service.php
wsf/php/src/samples/mtom_upload_client.php
wsf/php/src/samples/mtom_upload_service.php
wsf/php/src/samples/notify_client.php
wsf/php/src/samples/notify_service.php
wsf/php/src/samples/reply_echo_service.php
wsf/php/src/samples/request_client_dom.php
wsf/php/src/samples/request_client_msg.php
wsf/php/src/samples/request_client_simplexml.php
wsf/php/src/samples/request_client_str.php
wsf/php/src/samples/resources/
wsf/php/src/samples/resources/axis2.jpg (contents, props changed)
wsf/php/src/samples/resources/passwords
wsf/php/src/samples/wsdl_service.php
wsf/php/src/scripts/
wsf/php/src/scripts/WS_WsdlBinding.php
wsf/php/src/scripts/WS_WsdlConsts.php
wsf/php/src/scripts/WS_WsdlCreater.php
wsf/php/src/scripts/WS_WsdlMessage.php
wsf/php/src/scripts/WS_WsdlOperations.php
wsf/php/src/scripts/WS_WsdlPort.php
wsf/php/src/scripts/WS_WsdlScript.php
wsf/php/src/scripts/WS_WsdlService.php
wsf/php/src/scripts/WS_WsdlType.php
wsf/php/src/scripts/wsdl_script.php
wsf/php/src/scripts/wsf.php
wsf/php/src/stream.c (contents, props changed)
wsf/php/src/tests/
wsf/php/src/tests/001.phpt
wsf/php/src/util.c (contents, props changed)
wsf/php/src/worker.c (contents, props changed)
wsf/php/src/wsf.c (contents, props changed)
wsf/php/src/wsf.h (contents, props changed)
wsf/php/src/wsf_common.h (contents, props changed)
wsf/php/src/wsf_out_transport_info.h (contents, props changed)
wsf/php/src/wsf_stream.h (contents, props changed)
wsf/php/src/wsf_util.h (contents, props changed)
wsf/php/src/wsf_worker.h (contents, props changed)
wsf/php/src/wsf_xml_msg_recv.h (contents, props changed)
wsf/php/src/xdocs/
wsf/php/src/xdocs/api.html
wsf/php/src/xdocs/api_content.html
wsf/php/src/xdocs/api_toc.html
wsf/php/src/xdocs/index.html
wsf/php/src/xdocs/install_guide.html
wsf/php/src/xdocs/manual.html
wsf/php/src/xdocs/manual_content.html
wsf/php/src/xdocs/manual_toc.html
wsf/php/src/xdocs/samples/
wsf/php/src/xdocs/samples/google_spell.html
wsf/php/src/xdocs/samples/hello_client.html
wsf/php/src/xdocs/samples/hello_service.html
wsf/php/src/xdocs/style/
wsf/php/src/xdocs/style/api_style.css
wsf/php/src/xml_msg_recv.c (contents, props changed)
Log:
Moving WSO2 WSF4PHP to the new location
Added: wsf/php/AUTHORS
==============================================================================
Added: wsf/php/COPYING
==============================================================================
--- (empty file)
+++ wsf/php/COPYING Mon Dec 11 01:32:52 2006
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: wsf/php/ChangeLog
==============================================================================
Added: wsf/php/INSTALL
==============================================================================
--- (empty file)
+++ wsf/php/INSTALL Mon Dec 11 01:32:52 2006
@@ -0,0 +1,38 @@
+Building and Installing WSO2 WSF for PHP from Source on Linux.
+
+===========================================================
+
+Go to the directory where you have extracted the source distribution.
+Run the following:
+ ./configure
+ make
+ make install
+Note: You may require super user privileges to run 'make install' on your system.
+
+After installing the extension, you have to edit the php.ini file
+and add the following line to the php.ini file:
+extension=wsf.so
+
+Now you are ready to use WSO2 WSF for PHP.
+Copy the wsf.php script to your web server's document root.
+Also copy all the samples to your web server's document root.
+Test with a Web browser; as an example access http://localhost/echo_client.php
+
+[NOTES:
+ You may run './configure --help' for more information on configure options.
+
+ If you don't provide the --prefix configure option, WSO2 WSF for PHP
+ will by default be installed into the PHP extensions directory.
+
+
+ If you provide the --prefix configure option you will have to
+ edit the php.ini file in your system and add the following entry.
+ Note that WSO2 WSF for C would be installed to a folder named "wsf_c"
+ in the prefix folder.
+
+[wsf]
+wsf.home="path to your wsf_c installation directory"
+
+END of NOTES]
+
+
Added: wsf/php/Makefile.am
==============================================================================
--- (empty file)
+++ wsf/php/Makefile.am Mon Dec 11 01:32:52 2006
@@ -0,0 +1,2 @@
+SUBDIRS= wsf_c/axis2 wsf_c/sandesha2/ src
+
Added: wsf/php/NEWS
==============================================================================
Added: wsf/php/README
==============================================================================
--- (empty file)
+++ wsf/php/README Mon Dec 11 01:32:52 2006
@@ -0,0 +1,7 @@
+WSO2 Web Services Framework for PHP is a PHP extension that could be used
+to provide and consume Web services.
+
+It supports SOAP 1.1, SOAP 1.2, MTOM, WS-Addressing, WS-Security UsernameToken
+as well as REST style invocation.
+
+Please refer docs/manual.html for more information.
Added: wsf/php/autogen.sh
==============================================================================
--- (empty file)
+++ wsf/php/autogen.sh Mon Dec 11 01:32:52 2006
@@ -0,0 +1,42 @@
+#!/bin/bash
+echo -n 'Running libtoolize...'
+if libtoolize --force > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running aclocal...'
+if aclocal > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running autoheader...'
+if autoheader > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running autoconf...'
+if autoconf > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running automake...'
+if automake --add-missing > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo 'done'
Added: wsf/php/build.sh
==============================================================================
--- (empty file)
+++ wsf/php/build.sh Mon Dec 11 01:32:52 2006
@@ -0,0 +1,20 @@
+#!/bin/bash
+#./autogen.sh
+
+if [ -d "wsf_c" ];then
+ cd wsf_c
+ svn up
+ cd ..
+else
+ svn co https://www-lk.wso2.com/repo/wso2/php_axis2/wsf/c
+ mv c wsf_c
+fi
+
+cd wsf_c
+./build.sh
+
+cd ..
+./autogen.sh
+./configure
+make
+
Added: wsf/php/build/src/config.m4
==============================================================================
--- (empty file)
+++ wsf/php/build/src/config.m4 Mon Dec 11 01:32:52 2006
@@ -0,0 +1,46 @@
+PHP_ARG_ENABLE(wsf, whether to eable AXIS2 support,
+[ --with-wsf Enable WSO2 WSF for PHP support])
+
+if test "$PHP_WSF" = "yes"; then
+ AC_DEFINE(HAVE_WSF, 1, [Whether you have WSO2 WSF for PHP])
+
+ if test -z "AXIS2C_HOME"; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR(Cannot find Axis2C home. Please set AXIS2C_HOME env variable)
+ fi
+
+ if test "$PHP_LIBXML" = "no"; then
+ AC_MSG_ERROR([SimpleXML extension requires LIBXML extension, add --enable-libxml])
+ fi
+
+ dnl # add include path
+ PHP_ADD_INCLUDE(../wsf_c/axis2/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/util/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/axiom/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/xml_schema/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/woden/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/rampart/include/)
+ PHP_ADD_INCLUDE(/usr/include/libxml2)
+ dnl # check for lib and symbol presence
+
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_parser, ../wsf_c/axis2/axiom/src/parser/libxml2/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_axiom, ../wsf_c/axis2/axiom/src/om/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_minizip, ../wsf_c/axis2/util/src/minizip/.libs, WSF_SHARED_LIBADD)
+
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_engine, ../wsf_c/axis2/modules/core/engine/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_wsdl, ../wsf_c/axis2/modules/wsdl/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_util, ../wsf_c/axis2/util/src/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_http_sender, ../wsf_c/axis2/modules/core/transport/http/sender/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_http_receiver, ../wsf_c/axis2/modules/core/transport/http/receiver/.libs, WSF_SHARED_LIBADD)
+
+ PHP_SUBST(WSF_SHARED_LIBADD)
+
+ PHP_NEW_EXTENSION(wsf, wsf.c php_xml.c php_encoding.c php_schema.c php_http.c php_sdl.c xml_msg_recv.c util.c stream.c worker.c out_transport_info.c , $ext_shared)
+
+ PHP_ADD_EXTENSION_DEP(wsf, libxml)
+
+ PHP_ADD_EXTENSION_DEP(wsf, dom)
+
+ dnl PHP_ADD_EXTENSION_DEP(axis2, simplexml)
+
+fi
Added: wsf/php/configure.ac
==============================================================================
--- (empty file)
+++ wsf/php/configure.ac Mon Dec 11 01:32:52 2006
@@ -0,0 +1,315 @@
+dnl run autogen.sh to generate the configure script.
+
+AC_PREREQ(2.59)
+
+AC_INIT(wso2_wsf, 1.0.alpha)
+AC_CANONICAL_SYSTEM
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE([tar-ustar])
+dnl AC_PREFIX_DEFAULT(/usr/local/axis2cd)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CPP
+AM_PROG_LIBTOOL
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+EXTENSION_DIR=`$PHP_CONFIG --extension-dir`
+
+
+dnl Checks for libraries.
+AC_CHECK_LIB(dl, dlopen)
+AC_CHECK_LIB(z, inflate)
+
+axis2_prefix="/usr/local/axxxis2"
+export axis2_prefix
+if test -d $srcdir/wsf_c/axis2; then
+ AC_CONFIG_SUBDIRS(wsf_c/axis2)
+fi
+
+if test -d $srcdir/wsf_c/sandesha2; then
+ AC_CONFIG_SUBDIRS(wsf_c/sandesha2)
+fi
+
+if test -d $srcdir/src; then
+dnl AC_CONFIG_SUBDIRS(wsf_php, [$wsf_php_flags --prefix=/usr/local/axxxis])
+ AC_CONFIG_SUBDIRS(src)
+fi
+
+
+#CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -Wno-implicit-function-declaration"
+CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
+if test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration -Werror"
+# CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration"
+fi
+LDFLAGS="$LDFLAGS -lpthread"
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdio.h stdlib.h string.h])
+AC_CHECK_HEADERS([sys/socket.h])
+AC_CHECK_HEADERS([net/if.h], [], [],
+[#include <stdio.h>
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+])
+AC_CHECK_HEADERS([linux/if.h],[],[],
+[
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+])
+AC_CHECK_HEADERS([net/if_types.h])
+AC_CHECK_HEADERS([net/if_dl.h])
+
+dnl This is a check to see if we are running MacOS X
+dnl It may be better to do a Darwin check
+AC_CHECK_HEADERS([sys/appleapiopts.h])
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+dnl Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+#AC_CHECK_FUNCS([memmove])
+
+AC_MSG_CHECKING(whether to build rampart )
+AC_ARG_ENABLE(rampart, [ --enable-rampart build ramprt. default=yes],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(yes)
+ RAMPART_DIR=""
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ RAMPART_DIR="rampart"
+ if test -d $srcdir/rampart; then
+ AC_CONFIG_SUBDIRS(rampart)
+ fi
+
+ ;;
+ esac ],
+ AC_MSG_RESULT(yes)
+)
+
+AC_MSG_CHECKING(whether to build libxml2 xml parser library)
+AC_ARG_ENABLE(libxml2, [ --enable-libxml2 build libxml2 xml parser library wrapper. default=yes],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ WRAPPER_DIR=""
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ WRAPPER_DIR="libxml2"
+ PKG_CHECK_MODULES(PARSER, libxml-2.0)
+ CFLAGS="$CFLAGS $PARSER_LIBS"
+
+ ;;
+ esac ],
+ AC_MSG_RESULT(yes)
+ WRAPPER_DIR="libxml2"
+)
+
+
+GUTHTHILA_LIBS=""
+
+AC_MSG_CHECKING(whether to build guththila xml parser library)
+AC_ARG_ENABLE(guththila, [ --enable-guththila build guththila xml parser library wrapper. default=no],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ WRAPPER_DIR="guththila"
+ if test -d $srcdir/guththila; then
+ AC_CONFIG_SUBDIRS(guththila)
+ fi
+
+ GUTHTHILA_LIBS="/guththila/src/"
+ GUTHTHILA_DIR="guththila"
+
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(whether to use apache2 as server transport)
+AC_ARG_WITH(apache2,
+[ --with-apache2[=PATH] use apache2 as server transport.],
+[ case "$withval" in
+ no)
+ AC_MSG_RESULT(no)
+ APACHE2BUILD=""
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ dnl Find apache2 include dir in the path pointed by APACHE2_HOME env variable
+ if test -d $withval; then
+ apache2inc="-I$withval/include"
+ dnl else find the apache2 include dir in /usr/local/apache2
+ elif test -d '/usr/include/apache2'; then
+ apache2inc="-I/usr/include/apache2"
+ else
+ AC_MSG_ERROR(could not find apache2. stop)
+ fi
+ APACHE2BUILD="apache2"
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(whether to use apr. Note that if you build with apache2 you might need to do this.)
+AC_ARG_WITH(apr,
+[ --with-apr[=PATH] use apr.],
+[ case "$withval" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ dnl Find apr include dir in the path
+ if test -d $withval; then
+ aprinc="-I$withval/include"
+ dnl else find the apache2 include dir in /usr/local/apache2
+ elif test -d '/usr/include/apr-0'; then
+ aprinc="-I/usr/include/apr-0"
+ else
+ AC_MSG_ERROR(could not find apr. stop)
+ fi
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(whether to build tests)
+AC_ARG_ENABLE(tests, [ --enable-tests build tests. default=yes],
+[ case "${enableval}" in
+ yes)
+ AC_MSG_RESULT(yes)
+ TESTDIR="test"
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ TESTDIR=""
+
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+ TESTDIR=""
+)
+
+AC_CHECK_LIB(cutest, CuTestInit, [], [TESTDIR=""])
+
+AC_MSG_CHECKING(whether to enable trace)
+AC_ARG_ENABLE(trace, [ --enable-trace enable trace. default=no],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS"
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS -DAXIS2_TRACE"
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS"
+)
+
+AC_MSG_CHECKING(whether to enable multi threading)
+AC_ARG_ENABLE(multi-thread, [ --enable-multi-thread enable multi thread. default=yes],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS"
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS -DAXIS2_SVR_MULTI_THREADED"
+ ;;
+ esac ],[
+ AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS -DAXIS2_SVR_MULTI_THREADED"]
+)
+
+AC_MSG_CHECKING(whether to use openssl)
+AC_ARG_ENABLE(openssl, [ --enable-openssl enable ssl. default=no],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS"
+ ssl_enabled=false
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS -DAXIS2_SSL_ENABLED"
+ ssl_enabled=true
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS"
+)
+
+
+AC_MSG_CHECKING(whether to build dynamic invocation client library)
+AC_ARG_ENABLE(diclient, [ --enable-diclient build diclient library wrapper. default=no],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ DICLIENT_DIR=""
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ DICLIENT_DIR="diclient"
+
+ ;;
+ esac ],
+ AC_MSG_RESULT(yes)
+ DICLIENT_DIR="diclient"
+)
+
+
+
+APACHE2INC=$apache2inc
+APRINC=$aprinc
+AC_MSG_RESULT($EXTENSION_DIR)
+
+AC_SUBST(EXTENSION_DIR)
+AC_SUBST(PARSER_LIBS)
+AC_SUBST(APACHE2INC)
+AC_SUBST(APRINC)
+AC_SUBST(DICLIENT_DIR)
+AC_SUBST(TESTDIR)
+AC_SUBST(SAMPLES)
+AC_SUBST(APACHE2BUILD)
+AC_SUBST(PARSER_DIR)
+AC_SUBST(WRAPPER_DIR)
+AC_SUBST(GUTHTHILA_DIR)
+AC_SUBST(RAMPART_DIR)
+AC_SUBST(GUTHTHILA_LIBS)
+AM_CONDITIONAL(AXIS2_SSL_ENABLED, test x$ssl_enabled = xtrue)
+#export PARSER_DIR
+export WRAPPER_DIR
+export prefix
+AC_CONFIG_COMMANDS([wsf], [cd src])
+AC_CONFIG_COMMANDS([php], [phpize])
+
+AC_CONFIG_FILES([Makefile
+ ])
+
+AC_OUTPUT
Added: wsf/php/src/LICENSE
==============================================================================
--- (empty file)
+++ wsf/php/src/LICENSE Mon Dec 11 01:32:52 2006
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: wsf/php/src/README.INSTALL
==============================================================================
--- (empty file)
+++ wsf/php/src/README.INSTALL Mon Dec 11 01:32:52 2006
@@ -0,0 +1,38 @@
+Building and Installing WSO2 WSF for PHP from Source on Linux.
+
+===========================================================
+
+Go to the directory where you have extracted the source distribution.
+Run the following:
+ ./configure
+ make
+ make install
+Note: You may require super user privileges to run 'make install' on your system.
+
+After installing the extension, you have to edit the php.ini file
+and add the following line to the php.ini file:
+extension=wsf.so
+
+Now you are ready to use WSO2 WSF for PHP.
+Copy the wsf.php script to your web server's document root.
+Also copy all the samples to your web server's document root.
+Test with a Web browser; as an example access http://localhost/echo_client.php
+
+[NOTES:
+ You may run './configure --help' for more information on configure options.
+
+ If you don't provide the --prefix configure option, WSO2 WSF for PHP
+ will by default be installed into the PHP extensions directory.
+
+
+ If you provide the --prefix configure option you will have to
+ edit the php.ini file in your system and add the following entry.
+ Note that WSO2 WSF for C would be installed to a folder named "wsf_c"
+ in the prefix folder.
+
+[wsf]
+wsf.home="path to your wsf_c installation directory"
+
+END of NOTES]
+
+
Added: wsf/php/src/README.INSTALL_WIN32
==============================================================================
--- (empty file)
+++ wsf/php/src/README.INSTALL_WIN32 Mon Dec 11 01:32:52 2006
@@ -0,0 +1,113 @@
+Building and Installing WSO2 WSF for PHP on Win32.
+
+If you need any help with building or installation , send a
+mail to wsf-PHP-user at lists.wso2.net
+===========================================================
+Contents:
+1. How to build PHP under Windows
+2. How to build wsf_c under Windows from source
+ a. Requirements
+ b. Using command prompt.
+3. Building WSF extension
+4. Installing WSF extension as a PHP extension.
+
+===========================================================
+
+1. How to build PHP under Windows.
+ Please refer to README.WIN32-BUILD-SYSTEM file that comes
+ with PHP source distribution.
+
+2. How to build wsf_c under Windows from source
+
+ a. Requirements
+
+ You need to download following:
+ libxml2 binary distribution
+ zlib binary distribution
+ iconv binary distribution
+
+ b. Using the command prompt
+
+ If you have Visual Studio command prompt, open it and change
+ directory to "wsf_c/axis2c/build/win32" of the extract folder.
+
+ If not, create a new shortcut and set target to:
+
+ %comspec% /k "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"
+
+ Now change directory to "wsf_c/axis2c/build/win32" and edit
+ the configure.in file and set your binary installation
+ locations of libxml2, zlib and iconv libraries.
+
+ "nmake dist" will build the binary under "wsf_c/axis2c/build" directory.
+
+3. Building WSO2 WSF
+
+ Before trying this, please refer README.WIN32-BUILD-SYSTEM
+ file in PHP source distribution and build PHP source under Windows.
+
+ Create a bat file named wsfvars.bat with following entries
+ using your directory locations.
+
+ @SET PATH=%PATH%;<path_to_extract_folder>\axis2c\build\wsf_c\lib;
+ @SET INCLUDE=%INCLUDE%;<path_to_extract_folder>\wsf_c\axis2c\build\wsf_c\include;
+ @SET LIB=%LIB%;<path_to_extract_folder>\wsf_c\axis2c\build\wsf_c\lib;
+
+ Then using the same command prompt used to build the PHP source,
+ run the wsfvars.bat file.
+
+ Copy wsf_php folder to php_source/ext directory.
+
+ Run "buildconf.bat" to rebuild the configre.js file.
+
+ "cscript /nologo configure.js --help" will give the configuration options.
+ You will find the option --with-wsf.
+
+ Use "cscript configure.js --with-wsf=shared" to configure the wsf extension as a dll
+
+ "nmake" will build wsf extension.
+
+4. Installing WSO2 WSF as a PHP extension.
+
+ If you have build from the source you should now have the
+
+ wsf_c binary and the php_wsf.dll.
+
+ If you have extracted the binary you should have the following structure.
+
+ wso2_wsf_1.0.alpha1-bin
+ |
+ +-- wsf_c
+ |
+ +-- php_wsf.dll
+
+
+ 1. Copy php_wsf.dll to PHP installation directory.
+
+ 2. Add wsf_c\lib directory to path.
+
+ 3. Add the following entries to your php.ini file which is in your PHP
+ installation location.
+ [wsf]
+ wsf.home="<path_to_extract_folder>\wsf_c"
+ wsf.log_path="<path_to_extract_folder>\wsf_c\logs"
+
+ extension=php_wsf.dll
+
+ 5. Create an environment variable PHPRC to point to your php.ini file location.
+
+ 6. Configure the Apache2 Web server with PHP as follows.
+
+ Copy php5apache2.dll to Apache2/modules directory.
+ Add following entries in httpd.conf file.
+
+ LoadModule php5_module modules/php5apache2.dll
+
+ AddType application/x-httpd-php .php .phtml
+ AddType application/x-httpd-php-source .phps
+
+ 7. Copy the wsf.php script and all the samples to your Web server's document root
+
+ Now you should be able to run the samples in samples directory.
+
+
Added: wsf/php/src/config.m4
==============================================================================
--- (empty file)
+++ wsf/php/src/config.m4 Mon Dec 11 01:32:52 2006
@@ -0,0 +1,46 @@
+PHP_ARG_ENABLE(wsf, whether to eable AXIS2 support,
+[ --with-wsf Enable WSO2 WSF for PHP support])
+
+if test "$PHP_WSF" = "yes"; then
+ AC_DEFINE(HAVE_WSF, 1, [Whether you have WSO2 WSF for PHP])
+
+ if test -z "AXIS2C_HOME"; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR(Cannot find Axis2C home. Please set AXIS2C_HOME env variable)
+ fi
+
+ if test "$PHP_LIBXML" = "no"; then
+ AC_MSG_ERROR([SimpleXML extension requires LIBXML extension, add --enable-libxml])
+ fi
+
+ dnl # add include path
+ PHP_ADD_INCLUDE(../wsf_c/axis2/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/util/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/axiom/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/xml_schema/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/woden/include/)
+ PHP_ADD_INCLUDE(../wsf_c/axis2/rampart/include/)
+ PHP_ADD_INCLUDE(/usr/include/libxml2)
+ dnl # check for lib and symbol presence
+
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_parser, ../wsf_c/axis2/axiom/src/parser/libxml2/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_axiom, ../wsf_c/axis2/axiom/src/om/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_minizip, ../wsf_c/axis2/util/src/minizip/.libs, WSF_SHARED_LIBADD)
+
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_engine, ../wsf_c/axis2/modules/core/engine/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_wsdl, ../wsf_c/axis2/modules/wsdl/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_util, ../wsf_c/axis2/util/src/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_http_sender, ../wsf_c/axis2/modules/core/transport/http/sender/.libs, WSF_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(axis2_http_receiver, ../wsf_c/axis2/modules/core/transport/http/receiver/.libs, WSF_SHARED_LIBADD)
+
+ PHP_SUBST(WSF_SHARED_LIBADD)
+
+ PHP_NEW_EXTENSION(wsf, wsf.c php_xml.c php_encoding.c php_schema.c php_http.c php_sdl.c xml_msg_recv.c util.c stream.c worker.c out_transport_info.c , $ext_shared)
+
+ PHP_ADD_EXTENSION_DEP(wsf, libxml)
+
+ PHP_ADD_EXTENSION_DEP(wsf, dom)
+
+ dnl PHP_ADD_EXTENSION_DEP(axis2, simplexml)
+
+fi
Added: wsf/php/src/config.w32
==============================================================================
--- (empty file)
+++ wsf/php/src/config.w32 Mon Dec 11 01:32:52 2006
@@ -0,0 +1,22 @@
+// $Id: config.w32,v 1.5 2006/06/22 10:29:33 nabeel Exp $
+// vim:ft=javascript
+
+ ARG_WITH("wsf", "WSO2 WSF for PHP support", "no");
+
+ if(PHP_WSF != "no" && PHP_LIBXML == "yes"){
+ if(CHECK_LIB("axis2_engine.lib", "wsf", PHP_WSF) &&
+ CHECK_LIB("axiom.lib", "wsf", PHP_WSF) &&
+ CHECK_LIB("axis2_util.lib", "wsf", PHP_WSF) &&
+ CHECK_LIB("axis2_parser.lib", "wsf", PHP_WSF) &&
+ CHECK_LIB("libxml2.lib", "wsf", PHP_WSF)){
+
+ EXTENSION("wsf", "wsf.c worker.c xml_msg_recv.c stream.c util.c out_transport_info.c");
+
+ AC_DEFINE("HAVE_WSF",1,"Have wsf library");
+ ADD_EXTENSION_DEP('dom', 'dom');
+
+ }
+ else{
+ WARNING("wsf not enabled , Libraries and headers not found");
+ }
+ }
Added: wsf/php/src/out_transport_info.c
==============================================================================
--- (empty file)
+++ wsf/php/src/out_transport_info.c Mon Dec 11 01:32:52 2006
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://wso2.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "wsf_out_transport_info.h"
+#include <axis2_string.h>
+#include <axis2_http_transport.h>
+
+
+/**
+ * @brief Apache2 Out transport info impl structure
+ * Axis2 php_out_transport_info_impl
+ */
+typedef struct ws_out_transport_info_impl
+ ws_out_transport_info_impl_t;
+
+struct ws_out_transport_info_impl
+{
+ axis2_http_out_transport_info_t out_transport_info;
+ php_req_info_t *request;
+ axis2_char_t *encoding;
+};
+
+#define AXIS2_INTF_TO_IMPL(out_transport_info) \
+ ((ws_out_transport_info_impl_t *)(out_transport_info))
+
+/***************************** Function headers *******************************/
+axis2_status_t WS_CALL
+axis2_http_out_transport_info_set_content_type
+ (axis2_http_out_transport_info_t *info, const axis2_env_t *env,
+ const axis2_char_t *content_type);
+
+axis2_status_t WS_CALL
+axis2_http_out_transport_info_set_char_encoding
+ (axis2_http_out_transport_info_t *info, const axis2_env_t *env,
+ const axis2_char_t *encoding);
+
+axis2_status_t WS_CALL
+axis2_http_out_transport_info_free
+ (axis2_http_out_transport_info_t *out_transport_info,
+ const axis2_env_t *env);
+
+/***************************** End of function headers ************************/
+
+axis2_http_out_transport_info_t * WS_CALL
+ws_out_transport_info_create(const axis2_env_t *env,
+ php_req_info_t *request)
+{
+ ws_out_transport_info_impl_t *info_impl = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+
+ info_impl = (ws_out_transport_info_impl_t *)AXIS2_MALLOC
+ (env->allocator, sizeof(
+ ws_out_transport_info_impl_t));
+
+ if(NULL == info_impl){
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ info_impl->request = request;
+ info_impl->encoding = NULL;
+
+ info_impl->out_transport_info.ops = AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_http_out_transport_info_ops_t));
+ if(NULL == info_impl->out_transport_info.ops){
+ axis2_http_out_transport_info_free((axis2_http_out_transport_info_t*)
+ info_impl, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ info_impl->out_transport_info.ops->set_content_type =
+ axis2_http_out_transport_info_set_content_type;
+ info_impl->out_transport_info.ops->set_char_encoding =
+ axis2_http_out_transport_info_set_char_encoding;
+ info_impl->out_transport_info.ops->free =
+ axis2_http_out_transport_info_free;
+
+ return &(info_impl->out_transport_info);
+}
+
+
+axis2_status_t WS_CALL
+axis2_http_out_transport_info_free (axis2_http_out_transport_info_t *info,
+ const axis2_env_t *env)
+{
+ ws_out_transport_info_impl_t *info_impl = NULL;
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ info_impl = AXIS2_INTF_TO_IMPL(info);
+
+ info_impl->request = NULL; /* request doesn't belong to info */
+ if(NULL != info_impl->encoding){
+ AXIS2_FREE(env->allocator, info_impl->encoding);
+ info_impl->encoding = NULL;
+ }
+ if(NULL != info->ops)
+ AXIS2_FREE(env->allocator, info->ops);
+
+ AXIS2_FREE(env->allocator, info_impl);
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t WS_CALL
+ws_out_transport_info_free_void_arg (void *transport_info,
+ const axis2_env_t *env)
+{
+ axis2_http_out_transport_info_t *transport_info_l = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ transport_info_l = (axis2_http_out_transport_info_t *) transport_info;
+ return axis2_http_out_transport_info_free(transport_info_l, env);
+}
+
+axis2_status_t WS_CALL
+axis2_http_out_transport_info_set_content_type
+ (axis2_http_out_transport_info_t *info, const axis2_env_t *env,
+ const axis2_char_t *content_type)
+{
+ axis2_char_t *tmp1 = NULL;
+ axis2_char_t *tmp2 = NULL;
+ ws_out_transport_info_impl_t *info_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, content_type, AXIS2_FAILURE);
+
+ info_impl = AXIS2_INTF_TO_IMPL(info);
+
+ if(NULL != info_impl->encoding){
+
+ tmp1 = AXIS2_STRACAT(content_type, ";charset=", env);
+ tmp2 = AXIS2_STRACAT(tmp1, info_impl->encoding, env);
+ info_impl->request->content_type = AXIS2_STRDUP(tmp2, env);
+ AXIS2_FREE(env->allocator, tmp1);
+ AXIS2_FREE(env->allocator, tmp2);
+ }
+ else{
+ info_impl->request->content_type = AXIS2_STRDUP(content_type, env);
+ }
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t WS_CALL
+axis2_http_out_transport_info_set_char_encoding
+ (axis2_http_out_transport_info_t *info, const axis2_env_t *env,
+ const axis2_char_t *encoding)
+{
+ ws_out_transport_info_impl_t *info_impl = NULL;
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encoding, AXIS2_FAILURE);
+
+ info_impl = AXIS2_INTF_TO_IMPL(info);
+
+ if(NULL != info_impl->encoding){
+ AXIS2_FREE(env->allocator, info_impl->encoding);
+ }
+ info_impl->encoding = AXIS2_STRDUP(encoding, env);
+ return AXIS2_SUCCESS;
+}
Added: wsf/php/src/package2.xml
==============================================================================
--- (empty file)
+++ wsf/php/src/package2.xml Mon Dec 11 01:32:52 2006
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.4.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+ http://pear.php.net/dtd/tasks-1.0.xsd
+ http://pear.php.net/dtd/package-2.0
+ http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Axis2</name>
+ <channel>pecl.php.net</channel>
+ <summary>Web Services for PHP</summary>
+ <description>This extension provides a web services implementation using Axis2/C</description>
+ <lead>
+ <name>Nabeel Yoosuf</name>
+ <user>nabeel</user>
+ <email>nabeel at php.net</email>
+ <active>yes</active>
+ </lead>
+
+ <date>2006-05-21</date>
+ <version>
+ <release>0.1.1</release>
+ <api>0.1.0</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Fixed the bug of incorrect dependency libraries in package xml.
+ </notes>
+
+ <contents>
+ <dir name="/">
+ <file name="config.m4" role="src" />
+ <file name="credits" role="doc" />
+ <file name="EXPERIMENTAL" role="doc" />
+ <file name="README.INSTALL" role="doc" />
+ <file name="service_client.c" role="src" />
+ <file name="service_proxy.c" role="src" />
+ <file name="axis2.c" role="src" />
+ <file name="php_axis2.h" role="src" />
+ <file name="axis2_fe.h" role="src" />
+ <file name="axis2_ce.h" role="src" />
+ <file name="axis2_properties.h" role="src" />
+ <file name="axis2_common.h" role="src" />
+ <file name="axis2_php_stream.h" role="src" />
+ <file name="php_stream.c" role="src" />
+ <file name="fault.c" role="src" />
+ <file name="om_node.c" role="src" />
+ <file name="om_element.c" role="src" />
+ <file name="om_attribute.c" role="src" />
+ <file name="om_comment.c" role="src" />
+ <file name="om_processing_instruction.c" role="src" />
+ <file name="om_doctype.c" role="src" />
+ <file name="om_document.c" role="src" />
+ <file name="om_output.c" role="src" />
+ <file name="om_namespace.c" role="src" />
+ <file name="om_stax_builder.c" role="src" />
+ <file name="om_text.c" role="src" />
+ <file name="param.c" role="src" />
+ <file name="qname.c" role="src" />
+ <file name="soap_body.c" role="src" />
+ <file name="soap_fault.c" role="src" />
+ <file name="soap_header_block.c" role="src" />
+ <file name="soap_header.c" role="src" />
+ <file name="soap_message.c" role="src" />
+ <file name="xml_reader.c" role="src" />
+ <file name="xml_writer.c" role="src" />
+ <dir name="samples/">
+ <file name="echo_client_string_xml_in_out.php" role="test" />
+ <file name="echo_client_string_xml_in_out2.php" role="test" />
+ <file name="echo_client_string_xml_in_out3.php" role="test" />
+ <file name="echo_client_dom_in_out.php" role="test" />
+ <file name="echo_client_dom_in_out2.php" role="test" />
+ <file name="echo_client_simple_xml_in_out.php" role="test" />
+ <file name="echo_client_simple_xml_in_out2.php" role="test" />
+ <file name="google_spell_string_xml_in_out.php" role="test" />
+ <file name="google_search_string_xml_in_out.php" role="test" />
+ </dir> <!-- samples/ -->
+ <dir name="xdocs/">
+ <file name="index.html" role="doc" />
+ <file name="navigation.xml" role="doc" />
+ <dir name="docs/">
+ <file name="index.html" role="doc" />
+ <file name="installationguide.html" role="doc" />
+ <file name="userguide.html" role="doc" />
+ <file name="developerguide.html" role="doc" />
+ </dir> <!-- docs/ -->
+ </dir> <!-- xdocs/ -->
+ </dir> <!-- / -->
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>5.0.3</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.0</min>
+ </pearinstaller>
+ </required>
+ </dependencies>
+ <providesextension>axis2</providesextension>
+ <extsrcrelease />
+
+ <changelog>
+ <release>
+ <date>2006-05-20</date>
+ <version>
+ <release>0.1.0</release>
+ <api>0.1.0</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>Initial Release of Axis2.
+ - Provides an XML in/out model to consume web services
+ - Supports Plain XML, DOM and SimpleXML
+ - Provides module engagement support (WS-Addressing is demonstrated).
+ - Provides SOAP and OM APIs to manipulate XML
+ </notes>
+ </release>
+ </changelog>
+</package>
+
+
Added: wsf/php/src/php_encoding.c
==============================================================================
--- (empty file)
+++ wsf/php/src/php_encoding.c Mon Dec 11 01:32:52 2006
@@ -0,0 +1,3328 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2006 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license at php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Brad Lafountain <rodif_bl at yahoo.com> |
+ | Shane Caraveo <shane at caraveo.com> |
+ | Dmitry Stogov <dmitry at zend.com> |
+ +----------------------------------------------------------------------+
+*/
+/* $Id: php_encoding.c,v 1.103.2.21.2.13 2006/10/24 05:20:50 dmitry Exp $ */
+
+
+#include <libxml/parserInternals.h>
+#include "wsf.h"
+#include "ext/libxml/php_libxml.h"
+#include "ext/standard/base64.h"
+#include "zend_strtod.h"
+#include <time.h>
+
+/* zval type decode */
+static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_long(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_bool(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_string(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_stringr(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_stringc(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_null(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_base64(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_hexbin(encodeTypePtr type, xmlNodePtr data);
+
+static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_bool(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+/* String encode */
+static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+/* Null encode */
+static xmlNodePtr to_xml_null(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+/* Array encode */
+static xmlNodePtr guess_array_map(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_list1(encodeTypePtr enc, zval *data, int style, xmlNodePtr parent);
+
+/* Datetime encode/decode */
+static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *format, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_datetime(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_time(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_date(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_gyearmonth(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_gyear(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_gmonthday(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_gday(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_gmonth(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_duration(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+static zval *to_zval_object(encodeTypePtr type, xmlNodePtr data);
+static zval *to_zval_array(encodeTypePtr type, xmlNodePtr data);
+
+static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+static zval *to_zval_any(encodeTypePtr type, xmlNodePtr data);
+static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+/* Try and guess for non-wsdl clients and servers */
+static zval *guess_zval_convert(encodeTypePtr type, xmlNodePtr data);
+static xmlNodePtr guess_xml_convert(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
+
+static int is_map(zval *array);
+static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *out_type TSRMLS_DC);
+
+static xmlNodePtr check_and_resolve_href(xmlNodePtr data);
+
+static void set_ns_prop(xmlNodePtr node, char *ns, char *name, char *val);
+static void set_xsi_nil(xmlNodePtr node);
+static void set_xsi_type(xmlNodePtr node, char *type);
+
+static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smart_str* ret);
+static void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
+
+static void set_ns_and_type(xmlNodePtr node, encodeTypePtr type);
+
+#define FIND_XML_NULL(xml,zval) \
+ { \
+ xmlAttrPtr null; \
+ if (!xml) { \
+ ZVAL_NULL(zval); \
+ return zval; \
+ } \
+ if (xml->properties) { \
+ null = get_attribute(xml->properties, "nil"); \
+ if (null) { \
+ ZVAL_NULL(zval); \
+ return zval; \
+ } \
+ } \
+ }
+
+#define FIND_ZVAL_NULL(zval, xml, style) \
+{ \
+ if (!zval || Z_TYPE_P(zval) == IS_NULL) { \
+ if (style == SOAP_ENCODED) {\
+ set_xsi_nil(xml); \
+ } \
+ return xml; \
+ } \
+}
+
+encode defaultEncoding[] = {
+ {{UNKNOWN_TYPE, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert},
+
+ {{IS_NULL, "nil", XSI_NAMESPACE, NULL}, to_zval_null, to_xml_null},
+ {{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
+ {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
+ {{IS_BOOL, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
+ {{IS_CONSTANT, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
+ {{IS_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_array, guess_array_map},
+ {{IS_CONSTANT_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
+ {{IS_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
+ {{IS_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_array, guess_array_map},
+ {{IS_CONSTANT_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
+ {{IS_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
+
+ {{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_stringc, to_xml_string},
+ {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
+ {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
+
+ {{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_datetime},
+ {{XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_time},
+ {{XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_date},
+ {{XSD_GYEARMONTH, XSD_GYEARMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gyearmonth},
+ {{XSD_GYEAR, XSD_GYEAR_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gyear},
+ {{XSD_GMONTHDAY, XSD_GMONTHDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gmonthday},
+ {{XSD_GDAY, XSD_GDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gday},
+ {{XSD_GMONTH, XSD_GMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_gmonth},
+ {{XSD_DURATION, XSD_DURATION_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_duration},
+
+ {{XSD_HEXBINARY, XSD_HEXBINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_hexbin, to_xml_hexbin},
+ {{XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_base64, to_xml_base64},
+
+ {{XSD_LONG, XSD_LONG_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_SHORT, XSD_SHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_BYTE, XSD_BYTE_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_NONPOSITIVEINTEGER, XSD_NONPOSITIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_POSITIVEINTEGER, XSD_POSITIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_NONNEGATIVEINTEGER, XSD_NONNEGATIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_NEGATIVEINTEGER, XSD_NEGATIVEINTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_UNSIGNEDBYTE, XSD_UNSIGNEDBYTE_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_UNSIGNEDSHORT, XSD_UNSIGNEDSHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_UNSIGNEDINT, XSD_UNSIGNEDINT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_UNSIGNEDLONG, XSD_UNSIGNEDLONG_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_INTEGER, XSD_INTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+
+ {{XSD_ANYTYPE, XSD_ANYTYPE_STRING, XSD_NAMESPACE, NULL}, guess_zval_convert, guess_xml_convert},
+ {{XSD_UR_TYPE, XSD_UR_TYPE_STRING, XSD_NAMESPACE, NULL}, guess_zval_convert, guess_xml_convert},
+ {{XSD_ANYURI, XSD_ANYURI_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_QNAME, XSD_QNAME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_NOTATION, XSD_NOTATION_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_NORMALIZEDSTRING, XSD_NORMALIZEDSTRING_STRING, XSD_NAMESPACE, NULL}, to_zval_stringr, to_xml_string},
+ {{XSD_TOKEN, XSD_TOKEN_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_LANGUAGE, XSD_LANGUAGE_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_NMTOKEN, XSD_NMTOKEN_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_NMTOKENS, XSD_NMTOKENS_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_list1},
+ {{XSD_NAME, XSD_NAME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_NCNAME, XSD_NCNAME_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_ID, XSD_ID_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_IDREF, XSD_IDREF_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_IDREFS, XSD_IDREFS_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_list1},
+ {{XSD_ENTITY, XSD_ENTITY_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+ {{XSD_ENTITIES, XSD_ENTITIES_STRING, XSD_NAMESPACE, NULL}, to_zval_stringc, to_xml_list1},
+
+ {{APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, NULL}, to_zval_map, to_xml_map},
+
+ {{SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
+ {{SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
+ {{SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
+ {{SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
+
+ /* 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_stringc, to_xml_string},
+ {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double},
+ {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double},
+
+ {{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_INT, XSD_INT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_BYTE, XSD_BYTE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{XSD_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_stringc, to_xml_string},
+
+ {{XSD_ANYXML, "<anyXML>", "<anyXML>", NULL}, to_zval_any, to_xml_any},
+
+ {{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
+};
+
+int numDefaultEncodings = sizeof(defaultEncoding)/sizeof(encode);
+
+
+void whiteSpace_replace(xmlChar* str)
+{
+ while (*str != '\0') {
+ if (*str == '\x9' || *str == '\xA' || *str == '\xD') {
+ *str = ' ';
+ }
+ str++;
+ }
+}
+
+void whiteSpace_collapse(xmlChar* str)
+{
+ xmlChar *pos;
+ xmlChar old;
+
+ pos = str;
+ whiteSpace_replace(str);
+ while (*str == ' ') {
+ str++;
+ }
+ old = '\0';
+ while (*str != '\0') {
+ if (*str != ' ' || old != ' ') {
+ *pos = *str;
+ pos++;
+ }
+ old = *str;
+ str++;
+ }
+ if (old == ' ') {
+ --pos;
+ }
+ *pos = '\0';
+}
+
+static encodePtr find_encoder_by_type_name(sdlPtr sdl, const char *type)
+{
+ if (sdl && sdl->encoders) {
+ HashPosition pos;
+ encodePtr *enc;
+
+ for (zend_hash_internal_pointer_reset_ex(sdl->encoders, &pos);
+ zend_hash_get_current_data_ex(sdl->encoders, (void **) &enc, &pos) == SUCCESS;
+ zend_hash_move_forward_ex(sdl->encoders, &pos)) {
+ if (strcmp((*enc)->details.type_str, type) == 0) {
+ return *enc;
+ }
+ }
+ }
+ return NULL;
+}
+
+xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr node = NULL;
+ TSRMLS_FETCH();
+
+ /* Special handling of class SoapVar */
+ if (data &&
+ Z_TYPE_P(data) == IS_OBJECT &&
+ Z_OBJCE_P(data) == ws_var_class_entry) {
+ zval **ztype, **zdata, **zns, **zstype, **zname, **znamens;
+ encodePtr enc = NULL;
+ HashTable *ht = Z_OBJPROP_P(data);
+
+ if (zend_hash_find(ht, "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
+ soap_error0(E_ERROR, "Encoding: SoapVar hasn't 'enc_type' propery");
+ }
+
+ if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
+ if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
+ enc = get_encoder(WSF_GLOBAL(sdl), Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
+ } else {
+ zns = NULL;
+ enc = get_encoder_ex(WSF_GLOBAL(sdl), Z_STRVAL_PP(zstype), Z_STRLEN_PP(zstype));
+ }
+ if (enc == NULL && WSF_GLOBAL(typemap)) {
+ encodePtr *new_enc;
+ smart_str nscat = {0};
+
+ if (zns != NULL) {
+ smart_str_appendl(&nscat, Z_STRVAL_PP(zns), Z_STRLEN_PP(zns));
+ smart_str_appendc(&nscat, ':');
+ }
+ smart_str_appendl(&nscat, Z_STRVAL_PP(zstype), Z_STRLEN_PP(zstype));
+ smart_str_0(&nscat);
+ if (zend_hash_find(WSF_GLOBAL(typemap), nscat.c, nscat.len + 1, (void**)&new_enc) == SUCCESS) {
+ enc = *new_enc;
+ }
+ smart_str_free(&nscat);
+ }
+ }
+ if (enc == NULL) {
+ enc = get_conversion(Z_LVAL_P(*ztype));
+ }
+ if (enc == NULL) {
+ enc = encode;
+ }
+
+ if (zend_hash_find(ht, "enc_value", sizeof("enc_value"), (void **)&zdata) == FAILURE) {
+ node = master_to_xml(enc, NULL, style, parent);
+ } else {
+ node = master_to_xml(enc, *zdata, style, parent);
+ }
+
+ if (style == SOAP_ENCODED || (WSF_GLOBAL(sdl) && encode != enc)) {
+ if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
+ if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
+ set_ns_and_type_ex(node, Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
+ } else {
+ set_ns_and_type_ex(node, NULL, Z_STRVAL_PP(zstype));
+ }
+ }
+ }
+
+ if (zend_hash_find(ht, "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS) {
+ xmlNodeSetName(node, BAD_CAST(Z_STRVAL_PP(zname)));
+ }
+ if (zend_hash_find(ht, "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS) {
+ xmlNsPtr nsp = encode_add_ns(node, Z_STRVAL_PP(znamens));
+ xmlSetNs(node, nsp);
+ }
+ } else {
+ if (WSF_GLOBAL(class_map) && data &&
+ Z_TYPE_P(data) == IS_OBJECT &&
+ !Z_OBJPROP_P(data)->nApplyCount) {
+ zend_class_entry *ce = Z_OBJCE_P(data);
+ HashPosition pos;
+ zval **tmp;
+ char *type_name = NULL;
+ uint type_len;
+ ulong idx;
+
+ for (zend_hash_internal_pointer_reset_ex(WSF_GLOBAL(class_map), &pos);
+ zend_hash_get_current_data_ex(WSF_GLOBAL(class_map), (void **) &tmp, &pos) == SUCCESS;
+ zend_hash_move_forward_ex(WSF_GLOBAL(class_map), &pos)) {
+ if (Z_TYPE_PP(tmp) == IS_STRING &&
+ ce->name_length == Z_STRLEN_PP(tmp) &&
+ zend_binary_strncasecmp(ce->name, ce->name_length, Z_STRVAL_PP(tmp), ce->name_length, ce->name_length) == 0 &&
+ zend_hash_get_current_key_ex(WSF_GLOBAL(class_map), &type_name, &type_len, &idx, 0, &pos) == HASH_KEY_IS_STRING) {
+
+ /* TODO: namespace isn't stored */
+ encodePtr enc = get_encoder(WSF_GLOBAL(sdl), WSF_GLOBAL(sdl)->target_ns, type_name);
+ if (enc) {
+ encode = enc;
+ } else if (WSF_GLOBAL(sdl)) {
+ enc = find_encoder_by_type_name(WSF_GLOBAL(sdl), type_name);
+ if (enc) {
+ encode = enc;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ if (encode == NULL) {
+ encode = get_conversion(UNKNOWN_TYPE);
+ }
+ if (WSF_GLOBAL(typemap) && encode->details.type_str) {
+ smart_str nscat = {0};
+ encodePtr *new_enc;
+
+ if (encode->details.ns) {
+ smart_str_appends(&nscat, encode->details.ns);
+ smart_str_appendc(&nscat, ':');
+ }
+ smart_str_appends(&nscat, encode->details.type_str);
+ smart_str_0(&nscat);
+ if (zend_hash_find(WSF_GLOBAL(typemap), nscat.c, nscat.len + 1, (void**)&new_enc) == SUCCESS) {
+ encode = *new_enc;
+ }
+ smart_str_free(&nscat);
+ }
+ if (encode->to_xml) {
+ node = encode->to_xml(&encode->details, data, style, parent);
+ }
+ }
+ return node;
+}
+
+static zval *master_to_zval_int(encodePtr encode, xmlNodePtr data)
+{
+ zval *ret = NULL;
+ TSRMLS_FETCH();
+
+ if (WSF_GLOBAL(typemap)) {
+ if (encode->details.type_str) {
+ smart_str nscat = {0};
+ encodePtr *new_enc;
+
+ if (encode->details.ns) {
+ smart_str_appends(&nscat, encode->details.ns);
+ smart_str_appendc(&nscat, ':');
+ }
+ smart_str_appends(&nscat, encode->details.type_str);
+ smart_str_0(&nscat);
+ if (zend_hash_find(WSF_GLOBAL(typemap), nscat.c, nscat.len + 1, (void**)&new_enc) == SUCCESS) {
+ encode = *new_enc;
+ }
+ smart_str_free(&nscat);
+ } else {
+ xmlAttrPtr type_attr = get_attribute_ex(data->properties,"type", XSI_NAMESPACE);
+
+ if (type_attr != NULL) {
+ encodePtr *new_enc;
+ xmlNsPtr nsptr;
+ char *ns, *cptype;
+ smart_str nscat = {0};
+
+ parse_namespace(type_attr->children->content, &cptype, &ns);
+ nsptr = xmlSearchNs(data->doc, data, BAD_CAST(ns));
+ if (nsptr != NULL) {
+ smart_str_appends(&nscat, (char*)nsptr->href);
+ smart_str_appendc(&nscat, ':');
+ }
+ smart_str_appends(&nscat, cptype);
+ smart_str_0(&nscat);
+ efree(cptype);
+ if (ns) {efree(ns);}
+ if (zend_hash_find(WSF_GLOBAL(typemap), nscat.c, nscat.len + 1, (void**)&new_enc) == SUCCESS) {
+ encode = *new_enc;
+ }
+ smart_str_free(&nscat);
+ }
+ }
+ }
+ if (encode->to_zval) {
+ ret = encode->to_zval(&encode->details, data);
+ }
+ return ret;
+}
+
+zval *master_to_zval(encodePtr encode, xmlNodePtr data)
+{
+ TSRMLS_FETCH();
+ data = check_and_resolve_href(data);
+
+ if (encode == NULL) {
+ encode = get_conversion(UNKNOWN_TYPE);
+ } else {
+ /* Use xsi:type if it is defined */
+ xmlAttrPtr type_attr = get_attribute_ex(data->properties,"type", XSI_NAMESPACE);
+
+ if (type_attr != NULL) {
+ encodePtr enc = get_encoder_from_prefix(WSF_GLOBAL(sdl), data, type_attr->children->content);
+
+ if (enc != NULL && enc != encode) {
+ encodePtr tmp = enc;
+ while (tmp &&
+ tmp->details.sdl_type != NULL &&
+ tmp->details.sdl_type->kind != XSD_TYPEKIND_COMPLEX) {
+ if (enc == tmp->details.sdl_type->encode ||
+ tmp == tmp->details.sdl_type->encode) {
+ enc = NULL;
+ break;
+ }
+ tmp = tmp->details.sdl_type->encode;
+ }
+ if (enc != NULL) {
+ encode = enc;
+ }
+ }
+ }
+ }
+ return master_to_zval_int(encode, data);
+}
+
+xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr ret = NULL;
+ zval *return_value;
+ TSRMLS_FETCH();
+
+ if (type && type->map && type->map->to_xml) {
+ MAKE_STD_ZVAL(return_value);
+
+ if (call_user_function(EG(function_table), NULL, type->map->to_xml, return_value, 1, &data TSRMLS_CC) == FAILURE) {
+ soap_error0(E_ERROR, "Encoding: Error calling to_xml callback");
+ }
+ if (Z_TYPE_P(return_value) == IS_STRING) {
+ xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
+ if (doc && doc->children) {
+ ret = xmlDocCopyNode(doc->children, parent->doc, 1);
+ }
+ xmlFreeDoc(doc);
+ }
+
+ zval_ptr_dtor(&return_value);
+ }
+ if (!ret) {
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ }
+ xmlAddChild(parent, ret);
+ if (style == SOAP_ENCODED) {
+ set_ns_and_type(ret, type);
+ }
+ return ret;
+}
+
+zval *to_zval_user(encodeTypePtr type, xmlNodePtr node)
+{
+ zval *return_value;
+ TSRMLS_FETCH();
+
+ if (type && type->map && type->map->to_zval) {
+ xmlBufferPtr buf;
+ zval *data;
+ xmlNodePtr copy;
+
+ copy = xmlCopyNode(node, 1);
+ buf = xmlBufferCreate();
+ xmlNodeDump(buf, NULL, copy, 0, 0);
+ MAKE_STD_ZVAL(data);
+ ZVAL_STRING(data, (char*)xmlBufferContent(buf), 1);
+ xmlBufferFree(buf);
+ xmlFreeNode(copy);
+
+ ALLOC_INIT_ZVAL(return_value);
+
+ if (call_user_function(EG(function_table), NULL, type->map->to_zval, return_value, 1, &data TSRMLS_CC) == FAILURE) {
+ soap_error0(E_ERROR, "Encoding: Error calling from_xml callback");
+ }
+ zval_ptr_dtor(&data);
+ } else {
+ ALLOC_INIT_ZVAL(return_value);
+ }
+ return return_value;
+}
+
+/* TODO: get rid of "bogus".. ither by passing in the already created xmlnode or passing in the node name */
+/* String encode/decode */
+static zval *to_zval_string(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ TSRMLS_FETCH();
+
+ if (WSF_GLOBAL(encoding) != NULL) {
+ xmlBufferPtr in = xmlBufferCreateStatic(data->children->content, xmlStrlen(data->children->content));
+ xmlBufferPtr out = xmlBufferCreate();
+ int n = xmlCharEncOutFunc(WSF_GLOBAL(encoding), out, in);
+
+ if (n >= 0) {
+ ZVAL_STRING(ret, (char*)xmlBufferContent(out), 1);
+ } else {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ }
+ xmlBufferFree(out);
+ xmlBufferFree(in);
+ } else {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ }
+ } else if (data->children->type == XML_CDATA_SECTION_NODE && data->children->next == NULL) {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
+ } else {
+ ZVAL_EMPTY_STRING(ret);
+ }
+ return ret;
+}
+
+static zval *to_zval_stringr(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ TSRMLS_FETCH();
+
+ whiteSpace_replace(data->children->content);
+ if (WSF_GLOBAL(encoding) != NULL) {
+ xmlBufferPtr in = xmlBufferCreateStatic(data->children->content, xmlStrlen(data->children->content));
+ xmlBufferPtr out = xmlBufferCreate();
+ int n = xmlCharEncOutFunc(WSF_GLOBAL(encoding), out, in);
+
+ if (n >= 0) {
+ ZVAL_STRING(ret, (char*)xmlBufferContent(out), 1);
+ } else {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ }
+ xmlBufferFree(out);
+ xmlBufferFree(in);
+ } else {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ }
+ } else if (data->children->type == XML_CDATA_SECTION_NODE && data->children->next == NULL) {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
+ } else {
+ ZVAL_EMPTY_STRING(ret);
+ }
+ return ret;
+}
+
+static zval *to_zval_stringc(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ TSRMLS_FETCH();
+
+ whiteSpace_collapse(data->children->content);
+ if (WSF_GLOBAL(encoding) != NULL) {
+ xmlBufferPtr in = xmlBufferCreateStatic(data->children->content, xmlStrlen(data->children->content));
+ xmlBufferPtr out = xmlBufferCreate();
+ int n = xmlCharEncOutFunc(WSF_GLOBAL(encoding), out, in);
+
+ if (n >= 0) {
+ ZVAL_STRING(ret, (char*)xmlBufferContent(out), 1);
+ } else {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ }
+ xmlBufferFree(out);
+ xmlBufferFree(in);
+ } else {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ }
+ } else if (data->children->type == XML_CDATA_SECTION_NODE && data->children->next == NULL) {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
+ } else {
+ ZVAL_EMPTY_STRING(ret);
+ }
+ return ret;
+}
+
+static zval *to_zval_base64(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ char *str;
+ int str_len;
+
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ whiteSpace_collapse(data->children->content);
+ str = (char*)php_base64_decode(data->children->content, strlen((char*)data->children->content), &str_len);
+ ZVAL_STRINGL(ret, str, str_len, 0);
+ } else if (data->children->type == XML_CDATA_SECTION_NODE && data->children->next == NULL) {
+ str = (char*)php_base64_decode(data->children->content, strlen((char*)data->children->content), &str_len);
+ ZVAL_STRINGL(ret, str, str_len, 0);
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
+ } else {
+ ZVAL_EMPTY_STRING(ret);
+ }
+ return ret;
+}
+
+static zval *to_zval_hexbin(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ unsigned char *str;
+ int str_len, i, j;
+ unsigned char c;
+
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ whiteSpace_collapse(data->children->content);
+ } else if (data->children->type != XML_CDATA_SECTION_NODE || data->children->next != NULL) {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ return ret;
+ }
+ str_len = strlen((char*)data->children->content) / 2;
+ str = emalloc(str_len+1);
+ for (i = j = 0; i < str_len; i++) {
+ c = data->children->content[j++];
+ if (c >= '0' && c <= '9') {
+ str[i] = (c - '0') << 4;
+ } else if (c >= 'a' && c <= 'f') {
+ str[i] = (c - 'a' + 10) << 4;
+ } else if (c >= 'A' && c <= 'F') {
+ str[i] = (c - 'A' + 10) << 4;
+ }
+ c = data->children->content[j++];
+ if (c >= '0' && c <= '9') {
+ str[i] |= c - '0';
+ } else if (c >= 'a' && c <= 'f') {
+ str[i] |= c - 'a' + 10;
+ } else if (c >= 'A' && c <= 'F') {
+ str[i] |= c - 'A' + 10;
+ }
+ }
+ str[str_len] = '\0';
+ ZVAL_STRINGL(ret, (char*)str, str_len, 0);
+ } else {
+ ZVAL_EMPTY_STRING(ret);
+ }
+ return ret;
+}
+
+static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr ret, text;
+ char *str;
+ int new_len;
+ TSRMLS_FETCH();
+
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, ret);
+ FIND_ZVAL_NULL(data, ret, style);
+
+ if (Z_TYPE_P(data) == IS_STRING) {
+ str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
+ new_len = Z_STRLEN_P(data);
+ } else {
+ zval tmp = *data;
+
+ zval_copy_ctor(&tmp);
+ convert_to_string(&tmp);
+ str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
+ new_len = Z_STRLEN(tmp);
+ zval_dtor(&tmp);
+ }
+
+ if (WSF_GLOBAL(encoding) != NULL) {
+ xmlBufferPtr in = xmlBufferCreateStatic(str, new_len);
+ xmlBufferPtr out = xmlBufferCreate();
+ int n = xmlCharEncInFunc(WSF_GLOBAL(encoding), out, in);
+
+ if (n >= 0) {
+ efree(str);
+ str = estrdup((char*)xmlBufferContent(out));
+ new_len = n;
+ } else if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
+ soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str);
+ }
+ xmlBufferFree(out);
+ xmlBufferFree(in);
+ } else if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
+ soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str);
+ }
+
+ text = xmlNewTextLen(BAD_CAST(str), new_len);
+ xmlAddChild(ret, text);
+ efree(str);
+
+ if (style == SOAP_ENCODED) {
+ set_ns_and_type(ret, type);
+ }
+ return ret;
+}
+
+static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr ret, text;
+ unsigned char *str;
+ int str_len;
+
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, ret);
+ FIND_ZVAL_NULL(data, ret, style);
+
+ if (Z_TYPE_P(data) == IS_STRING) {
+ str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRLEN_P(data), &str_len);
+ text = xmlNewTextLen(str, str_len);
+ xmlAddChild(ret, text);
+ efree(str);
+ } else {
+ zval tmp = *data;
+
+ zval_copy_ctor(&tmp);
+ convert_to_string(&tmp);
+ str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRLEN(tmp), &str_len);
+ text = xmlNewTextLen(str, str_len);
+ xmlAddChild(ret, text);
+ efree(str);
+ zval_dtor(&tmp);
+ }
+
+ if (style == SOAP_ENCODED) {
+ set_ns_and_type(ret, type);
+ }
+ return ret;
+}
+
+static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ static char hexconvtab[] = "0123456789ABCDEF";
+ xmlNodePtr ret, text;
+ unsigned char *str;
+ zval tmp;
+ int i, j;
+
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, ret);
+ FIND_ZVAL_NULL(data, ret, style);
+
+ if (Z_TYPE_P(data) != IS_STRING) {
+ tmp = *data;
+ zval_copy_ctor(&tmp);
+ convert_to_string(&tmp);
+ data = &tmp;
+ }
+ str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1);
+
+ for (i = j = 0; i < Z_STRLEN_P(data); i++) {
+ str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4];
+ str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15];
+ }
+ str[j] = '\0';
+
+ text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char));
+ xmlAddChild(ret, text);
+ efree(str);
+ if (data == &tmp) {
+ zval_dtor(&tmp);
+ }
+
+ if (style == SOAP_ENCODED) {
+ set_ns_and_type(ret, type);
+ }
+ return ret;
+}
+
+static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ whiteSpace_collapse(data->children->content);
+ ZVAL_DOUBLE(ret, atof((char*)data->children->content));
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
+ } else {
+ ZVAL_NULL(ret);
+ }
+ return ret;
+}
+
+static zval *to_zval_long(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ whiteSpace_collapse(data->children->content);
+ errno = 0;
+ ret->value.lval = strtol((char*)data->children->content, NULL, 0);
+ if (errno == ERANGE) { /* overflow */
+ ret->value.dval = zend_strtod((char*)data->children->content, NULL);
+ ret->type = IS_DOUBLE;
+ } else {
+ ret->type = IS_LONG;
+ }
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
+ } else {
+ ZVAL_NULL(ret);
+ }
+ return ret;
+}
+
+static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr ret;
+
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, ret);
+ FIND_ZVAL_NULL(data, ret, style);
+
+ if (Z_TYPE_P(data) == IS_DOUBLE) {
+ char s[256];
+
+ sprintf(s, "%0.0f",floor(Z_DVAL_P(data)));
+ xmlNodeSetContent(ret, BAD_CAST(s));
+ } else {
+ zval tmp = *data;
+
+ zval_copy_ctor(&tmp);
+ if (Z_TYPE(tmp) != IS_LONG) {
+ convert_to_long(&tmp);
+ }
+ convert_to_string(&tmp);
+ xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp));
+ zval_dtor(&tmp);
+ }
+
+ if (style == SOAP_ENCODED) {
+ set_ns_and_type(ret, type);
+ }
+ return ret;
+}
+
+static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr ret;
+ zval tmp;
+
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, ret);
+ FIND_ZVAL_NULL(data, ret, style);
+
+ tmp = *data;
+ zval_copy_ctor(&tmp);
+ if (Z_TYPE(tmp) != IS_DOUBLE) {
+ convert_to_double(&tmp);
+ }
+ convert_to_string(&tmp);
+ xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp));
+ zval_dtor(&tmp);
+
+ if (style == SOAP_ENCODED) {
+ set_ns_and_type(ret, type);
+ }
+ return ret;
+}
+
+static zval *to_zval_bool(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+
+ if (data && data->children) {
+ if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
+ whiteSpace_collapse(data->children->content);
+ if (stricmp((char*)data->children->content, "true") == 0 ||
+ stricmp((char*)data->children->content, "t") == 0 ||
+ strcmp((char*)data->children->content, "1") == 0) {
+ ZVAL_BOOL(ret, 1);
+ } else if (stricmp((char*)data->children->content, "false") == 0 ||
+ stricmp((char*)data->children->content, "f") == 0 ||
+ strcmp((char*)data->children->content, "0") == 0) {
+ ZVAL_BOOL(ret, 0);
+ } else {
+ ZVAL_STRING(ret, (char*)data->children->content, 1);
+ convert_to_boolean(ret);
+ }
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
+ } else {
+ ZVAL_NULL(ret);
+ }
+ return ret;
+}
+
+static xmlNodePtr to_xml_bool(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr ret;
+
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, ret);
+ FIND_ZVAL_NULL(data, ret, style);
+
+ if (zend_is_true(data)) {
+ xmlNodeSetContent(ret, BAD_CAST("true"));
+ } else {
+ xmlNodeSetContent(ret, BAD_CAST("false"));
+ }
+
+ if (style == SOAP_ENCODED) {
+ set_ns_and_type(ret, type);
+ }
+ return ret;
+}
+
+/* Null encode/decode */
+static zval *to_zval_null(encodeTypePtr type, xmlNodePtr data)
+{
+ zval *ret;
+ MAKE_STD_ZVAL(ret);
+ ZVAL_NULL(ret);
+ return ret;
+}
+
+static xmlNodePtr to_xml_null(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr ret;
+
+ ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, ret);
+ if (style == SOAP_ENCODED) {
+ set_xsi_nil(ret);
+ }
+ return ret;
+}
+
+static void set_zval_property(zval* object, char* name, zval* val TSRMLS_DC)
+{
+ zend_class_entry *old_scope;
+
+ old_scope = EG(scope);
+ EG(scope) = Z_OBJCE_P(object);
+#ifdef ZEND_ENGINE_2
+ val->refcount--;
+#endif
+ add_property_zval(object, name, val);
+ EG(scope) = old_scope;
+}
+
+static zval* get_zval_property(zval* object, char* name TSRMLS_DC)
+{
+ if (Z_TYPE_P(object) == IS_OBJECT) {
+ zval member;
+ zval *data;
+ zend_class_entry *old_scope;
+
+ ZVAL_STRING(&member, name, 0);
+ old_scope = EG(scope);
+ EG(scope) = Z_OBJCE_P(object);
+ data = Z_OBJ_HT_P(object)->read_property(object, &member, BP_VAR_IS TSRMLS_CC);
+ if (data == EG(uninitialized_zval_ptr)) {
+ /* Hack for bug #32455 */
+ zend_property_info *property_info;
+
+ property_info = zend_get_property_info(Z_OBJCE_P(object), &member, 1 TSRMLS_CC);
+ EG(scope) = old_scope;
+ if (property_info && zend_hash_quick_exists(Z_OBJPROP_P(object), property_info->name, property_info->name_length+1, property_info->h)) {
+ return data;
+ }
+ return NULL;
+ }
+ EG(scope) = old_scope;
+ return data;
+ } else if (Z_TYPE_P(object) == IS_ARRAY) {
+ zval **data_ptr;
+
+ if (zend_hash_find(Z_ARRVAL_P(object), name, strlen(name)+1, (void**)&data_ptr) == SUCCESS) {
+ return *data_ptr;
+ }
+ }
+ return NULL;
+}
+
+static void unset_zval_property(zval* object, char* name TSRMLS_DC)
+{
+ if (Z_TYPE_P(object) == IS_OBJECT) {
+ zval member;
+ zend_class_entry *old_scope;
+
+ ZVAL_STRING(&member, name, 0);
+ old_scope = EG(scope);
+ EG(scope) = Z_OBJCE_P(object);
+ Z_OBJ_HT_P(object)->unset_property(object, &member TSRMLS_CC);
+ EG(scope) = old_scope;
+ } else if (Z_TYPE_P(object) == IS_ARRAY) {
+ zend_hash_del(Z_ARRVAL_P(object), name, strlen(name)+1);
+ }
+}
+
+static void model_to_zval_any(zval *ret, xmlNodePtr node TSRMLS_DC)
+{
+ zval* any = NULL;
+
+ while (node != NULL) {
+ if (get_zval_property(ret, (char*)node->name TSRMLS_CC) == NULL) {
+ zval* val = master_to_zval(get_conversion(XSD_ANYXML), node);
+ if (get_attribute_ex(node->properties,"type", XSI_NAMESPACE) == NULL &&
+ Z_TYPE_P(val) == IS_STRING) {
+ while (node->next != NULL &&
+ get_zval_property(ret, (char*)node->next->name TSRMLS_CC) == NULL &&
+ get_attribute_ex(node->next->properties,"type", XSI_NAMESPACE) == NULL) {
+ zval* val2 = master_to_zval(get_conversion(XSD_ANYXML), node->next);
+ if (Z_TYPE_P(val2) != IS_STRING) {
+ break;
+ }
+ add_string_to_string(val, val, val2);
+ zval_ptr_dtor(&val2);
+ node = node->next;
+ }
+ }
+ if (any == NULL) {
+ any = val;
+ } else {
+ if (Z_TYPE_P(any) != IS_ARRAY) {
+ /* Convert into array */
+ zval *arr;
+
+ MAKE_STD_ZVAL(arr);
+ array_init(arr);
+ add_next_index_zval(arr, any);
+ any = arr;
+ }
+ /* Add array element */
+ add_next_index_zval(any, val);
+ }
+ }
+ node = node->next;
+ }
+ if (any) {
+ set_zval_property(ret, "any", any TSRMLS_CC);
+ }
+}
+
+static void model_to_zval_object(zval *ret, sdlContentModelPtr model, xmlNodePtr data, sdlPtr sdl TSRMLS_DC)
+{
+ switch (model->kind) {
+ case XSD_CONTENT_ELEMENT:
+ if (model->u.element->name) {
+ xmlNodePtr node = get_node(data->children, model->u.element->name);
+
+ if (node) {
+ zval *val;
+
+ node = check_and_resolve_href(node);
+ if (node && node->children && node->children->content) {
+ if (model->u.element->fixed && strcmp(model->u.element->fixed, (char*)node->children->content) != 0) {
+ soap_error3(E_ERROR, "Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)", model->u.element->name, model->u.element->fixed, node->children->content);
+ }
+ val = master_to_zval(model->u.element->encode, node);
+ } else if (model->u.element->fixed) {
+ xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlNodeSetContent(dummy, BAD_CAST(model->u.element->fixed));
+ val = master_to_zval(model->u.element->encode, dummy);
+ xmlFreeNode(dummy);
+ } else if (model->u.element->def && !model->u.element->nillable) {
+ xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlNodeSetContent(dummy, BAD_CAST(model->u.element->def));
+ val = master_to_zval(model->u.element->encode, dummy);
+ xmlFreeNode(dummy);
+ } else {
+ val = master_to_zval(model->u.element->encode, node);
+ }
+ if ((node = get_node(node->next, model->u.element->name)) != NULL) {
+ zval *array;
+
+ MAKE_STD_ZVAL(array);
+ array_init(array);
+ add_next_index_zval(array, val);
+ do {
+ if (node && node->children && node->children->content) {
+ if (model->u.element->fixed && strcmp(model->u.element->fixed, (char*)node->children->content) != 0) {
+ soap_error3(E_ERROR, "Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)", model->u.element->name, model->u.element->fixed, node->children->content);
+ }
+ val = master_to_zval(model->u.element->encode, node);
+ } else if (model->u.element->fixed) {
+ xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlNodeSetContent(dummy, BAD_CAST(model->u.element->fixed));
+ val = master_to_zval(model->u.element->encode, dummy);
+ xmlFreeNode(dummy);
+ } else if (model->u.element->def && !model->u.element->nillable) {
+ xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlNodeSetContent(dummy, BAD_CAST(model->u.element->def));
+ val = master_to_zval(model->u.element->encode, dummy);
+ xmlFreeNode(dummy);
+ } else {
+ val = master_to_zval(model->u.element->encode, node);
+ }
+ add_next_index_zval(array, val);
+ } while ((node = get_node(node->next, model->u.element->name)) != NULL);
+ val = array;
+ } else if ((WSF_GLOBAL(features) & SOAP_SINGLE_ELEMENT_ARRAYS) &&
+ (model->max_occurs == -1 || model->max_occurs > 1)) {
+ zval *array;
+
+ MAKE_STD_ZVAL(array);
+ array_init(array);
+ add_next_index_zval(array, val);
+ val = array;
+ }
+ set_zval_property(ret, model->u.element->name, val TSRMLS_CC);
+ }
+ }
+ break;
+ case XSD_CONTENT_ALL:
+ case XSD_CONTENT_SEQUENCE:
+ case XSD_CONTENT_CHOICE: {
+ sdlContentModelPtr *tmp;
+ HashPosition pos;
+ sdlContentModelPtr any = NULL;
+
+ zend_hash_internal_pointer_reset_ex(model->u.content, &pos);
+ while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) {
+ if ((*tmp)->kind == XSD_CONTENT_ANY) {
+ any = *tmp;
+ } else {
+ model_to_zval_object(ret, *tmp, data, sdl TSRMLS_CC);
+ }
+ zend_hash_move_forward_ex(model->u.content, &pos);
+ }
+ if (any) {
+ model_to_zval_any(ret, data->children TSRMLS_CC);
+ }
+ break;
+ }
+ case XSD_CONTENT_GROUP:
+ model_to_zval_object(ret, model->u.group->model, data, sdl TSRMLS_CC);
+ break;
+ default:
+ break;
+ }
+}
+
+/* Struct encode/decode */
+static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_entry *pce)
+{
+ zval *ret;
+ xmlNodePtr trav;
+ sdlPtr sdl;
+ sdlTypePtr sdlType = type->sdl_type;
+ zend_class_entry *ce = ZEND_STANDARD_CLASS_DEF_PTR;
+ zend_bool redo_any = 0;
+ TSRMLS_FETCH();
+
+ if (pce) {
+ ce = pce;
+ } else if (WSF_GLOBAL(class_map) && type->type_str) {
+ zval **classname;
+ zend_class_entry *tmp;
+
+ if (zend_hash_find(WSF_GLOBAL(class_map), type->type_str, strlen(type->type_str)+1, (void**)&classname) == SUCCESS &&
+ Z_TYPE_PP(classname) == IS_STRING &&
+ (tmp = zend_fetch_class(Z_STRVAL_PP(classname), Z_STRLEN_PP(classname), ZEND_FETCH_CLASS_AUTO TSRMLS_CC)) != NULL) {
+ ce = tmp;
+ }
+ }
+ sdl = WSF_GLOBAL(sdl);
+ if (sdlType) {
+ if (sdlType->kind == XSD_TYPEKIND_RESTRICTION &&
+ sdlType->encode && type != &sdlType->encode->details) {
+ encodePtr enc;
+
+ enc = sdlType->encode;
+ while (enc && enc->details.sdl_type &&
+ enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
+ enc->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
+ enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
+ enc = enc->details.sdl_type->encode;
+ }
+ if (enc) {
+ zval *base;
+
+ MAKE_STD_ZVAL(ret);
+
+ object_init_ex(ret, ce);
+ base = master_to_zval_int(enc, data);
+ set_zval_property(ret, "_", base TSRMLS_CC);
+ } else {
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ object_init_ex(ret, ce);
+ }
+ } else if (sdlType->kind == XSD_TYPEKIND_EXTENSION &&
+ sdlType->encode &&
+ type != &sdlType->encode->details) {
+ if (sdlType->encode->details.sdl_type &&
+ sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
+ sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
+ sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
+
+ if (ce != ZEND_STANDARD_CLASS_DEF_PTR &&
+ sdlType->encode->to_zval == sdl_guess_convert_zval &&
+ sdlType->encode->details.sdl_type != NULL &&
+ (sdlType->encode->details.sdl_type->kind == XSD_TYPEKIND_COMPLEX ||
+ sdlType->encode->details.sdl_type->kind == XSD_TYPEKIND_RESTRICTION ||
+ sdlType->encode->details.sdl_type->kind == XSD_TYPEKIND_EXTENSION) &&
+ (sdlType->encode->details.sdl_type->encode == NULL ||
+ (sdlType->encode->details.sdl_type->encode->details.type != IS_ARRAY &&
+ sdlType->encode->details.sdl_type->encode->details.type != SOAP_ENC_ARRAY))) {
+ ret = to_zval_object_ex(&sdlType->encode->details, data, ce);
+ } else {
+ ret = master_to_zval_int(sdlType->encode, data);
+ }
+ FIND_XML_NULL(data, ret);
+ if (get_zval_property(ret, "any" TSRMLS_CC) != NULL) {
+ unset_zval_property(ret, "any" TSRMLS_CC);
+ redo_any = 1;
+ }
+ if (Z_TYPE_P(ret) == IS_OBJECT && ce != ZEND_STANDARD_CLASS_DEF_PTR) {
+ zend_object *zobj = zend_objects_get_address(ret TSRMLS_CC);
+ zobj->ce = ce;
+ }
+ } else {
+ zval *base;
+
+ MAKE_STD_ZVAL(ret);
+
+ object_init_ex(ret, ce);
+ base = master_to_zval_int(sdlType->encode, data);
+ set_zval_property(ret, "_", base TSRMLS_CC);
+ }
+ } else {
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ object_init_ex(ret, ce);
+ }
+ if (sdlType->model) {
+ model_to_zval_object(ret, sdlType->model, data, sdl TSRMLS_CC);
+ if (redo_any && get_zval_property(ret, "any" TSRMLS_CC) == NULL) {
+ model_to_zval_any(ret, data->children TSRMLS_CC);
+ }
+ }
+ if (sdlType->attributes) {
+ sdlAttributePtr *attr;
+ HashPosition pos;
+
+ zend_hash_internal_pointer_reset_ex(sdlType->attributes, &pos);
+ while (zend_hash_get_current_data_ex(sdlType->attributes, (void**)&attr, &pos) == SUCCESS) {
+ if ((*attr)->name) {
+ xmlAttrPtr val = get_attribute(data->properties, (*attr)->name);
+ char *str_val = NULL;
+
+ if (val && val->children && val->children->content) {
+ str_val = (char*)val->children->content;
+ if ((*attr)->fixed && strcmp((*attr)->fixed, str_val) != 0) {
+ soap_error3(E_ERROR, "Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)", (*attr)->name, (*attr)->fixed, str_val);
+ }
+ } else if ((*attr)->fixed) {
+ str_val = (*attr)->fixed;
+ } else if ((*attr)->def) {
+ str_val = (*attr)->def;
+ }
+ if (str_val) {
+ xmlNodePtr dummy, text;
+ zval *data;
+
+ dummy = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ text = xmlNewText(BAD_CAST(str_val));
+ xmlAddChild(dummy, text);
+ data = master_to_zval((*attr)->encode, dummy);
+ xmlFreeNode(dummy);
+ set_zval_property(ret, (*attr)->name, data TSRMLS_CC);
+ }
+ }
+ zend_hash_move_forward_ex(sdlType->attributes, &pos);
+ }
+ }
+ } else {
+
+ MAKE_STD_ZVAL(ret);
+ FIND_XML_NULL(data, ret);
+ object_init_ex(ret, ce);
+
+ trav = data->children;
+
+ while (trav != NULL) {
+ if (trav->type == XML_ELEMENT_NODE) {
+ zval *tmpVal;
+ zval *prop;
+
+ tmpVal = master_to_zval(NULL, trav);
+
+ prop = get_zval_property(ret, (char*)trav->name TSRMLS_CC);
+ if (!prop) {
+ set_zval_property(ret, (char*)trav->name, tmpVal TSRMLS_CC);
+ } else {
+ /* Property already exist - make array */
+ if (Z_TYPE_P(prop) != IS_ARRAY) {
+ /* Convert into array */
+ zval *arr;
+
+ MAKE_STD_ZVAL(arr);
+ array_init(arr);
+ prop->refcount++;
+ add_next_index_zval(arr, prop);
+ set_zval_property(ret, (char*)trav->name, arr TSRMLS_CC);
+ prop = arr;
+ }
+ /* Add array element */
+ add_next_index_zval(prop, tmpVal);
+ }
+ }
+ trav = trav->next;
+ }
+ }
+ return ret;
+}
+
+static zval *to_zval_object(encodeTypePtr type, xmlNodePtr data)
+{
+ return to_zval_object_ex(type, data, NULL);
+}
+
+
+static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *object, int style, int strict TSRMLS_DC)
+{
+ switch (model->kind) {
+ case XSD_CONTENT_ELEMENT: {
+ zval *data;
+ xmlNodePtr property;
+ encodePtr enc;
+
+ data = get_zval_property(object, model->u.element->name TSRMLS_CC);
+ if (data) {
+ enc = model->u.element->encode;
+ if ((model->max_occurs == -1 || model->max_occurs > 1) &&
+ Z_TYPE_P(data) == IS_ARRAY &&
+ !is_map(data)) {
+ HashTable *ht = Z_ARRVAL_P(data);
+ zval **val;
+
+ zend_hash_internal_pointer_reset(ht);
+ while (zend_hash_get_current_data(ht,(void**)&val) == SUCCESS) {
+ if (Z_TYPE_PP(val) == IS_NULL && model->u.element->nillable) {
+ property = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(node, property);
+ set_xsi_nil(property);
+ } else {
+ property = master_to_xml(enc, *val, style, node);
+ if (property->children && property->children->content &&
+ model->u.element->fixed && strcmp(model->u.element->fixed, (char*)property->children->content) != 0) {
+ soap_error3(E_ERROR, "Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)", model->u.element->name, model->u.element->fixed, property->children->content);
+ }
+ }
+ xmlNodeSetName(property, BAD_CAST(model->u.element->name));
+ if (style == SOAP_LITERAL &&
+ model->u.element->namens &&
+ model->u.element->form == XSD_FORM_QUALIFIED) {
+ xmlNsPtr nsp = encode_add_ns(property, model->u.element->namens);
+ xmlSetNs(property, nsp);
+ }
+ zend_hash_move_forward(ht);
+ }
+ } else {
+ if (Z_TYPE_P(data) == IS_NULL && model->u.element->nillable) {
+ property = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(node, property);
+ set_xsi_nil(property);
+ } else {
+ property = master_to_xml(enc, data, style, node);
+ if (property->children && property->children->content &&
+ model->u.element->fixed && strcmp(model->u.element->fixed, (char*)property->children->content) != 0) {
+ soap_error3(E_ERROR, "Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)", model->u.element->name, model->u.element->fixed, property->children->content);
+ }
+ }
+ xmlNodeSetName(property, BAD_CAST(model->u.element->name));
+ if (style == SOAP_LITERAL &&
+ model->u.element->namens &&
+ model->u.element->form == XSD_FORM_QUALIFIED) {
+ xmlNsPtr nsp = encode_add_ns(property, model->u.element->namens);
+ xmlSetNs(property, nsp);
+ }
+ }
+ return 1;
+ } else if (strict && model->u.element->nillable && model->min_occurs > 0) {
+ property = xmlNewNode(NULL, BAD_CAST(model->u.element->name));
+ xmlAddChild(node, property);
+ set_xsi_nil(property);
+ if (style == SOAP_LITERAL &&
+ model->u.element->namens &&
+ model->u.element->form == XSD_FORM_QUALIFIED) {
+ xmlNsPtr nsp = encode_add_ns(property, model->u.element->namens);
+ xmlSetNs(property, nsp);
+ }
+ return 1;
+ } else if (model->min_occurs == 0) {
+ return 2;
+ } else {
+ if (strict) {
+ soap_error1(E_ERROR, "Encoding: object hasn't '%s' property", model->u.element->name);
+ }
+ return 0;
+ }
+ break;
+ }
+ case XSD_CONTENT_ANY: {
+ zval *data;
+ xmlNodePtr property;
+ encodePtr enc;
+
+ data = get_zval_property(object, "any" TSRMLS_CC);
+ if (data) {
+ enc = get_conversion(XSD_ANYXML);
+ if ((model->max_occurs == -1 || model->max_occurs > 1) &&
+ Z_TYPE_P(data) == IS_ARRAY &&
+ !is_map(data)) {
+ HashTable *ht = Z_ARRVAL_P(data);
+ zval **val;
+
+ zend_hash_internal_pointer_reset(ht);
+ while (zend_hash_get_current_data(ht,(void**)&val) == SUCCESS) {
+ property = master_to_xml(enc, *val, style, node);
+ zend_hash_move_forward(ht);
+ }
+ } else {
+ property = master_to_xml(enc, data, style, node);
+ }
+ return 1;
+ } else if (model->min_occurs == 0) {
+ return 2;
+ } else {
+ if (strict) {
+ soap_error0(E_ERROR, "Encoding: object hasn't 'any' property");
+ }
+ return 0;
+ }
+ break;
+ }
+ case XSD_CONTENT_SEQUENCE:
+ case XSD_CONTENT_ALL: {
+ sdlContentModelPtr *tmp;
+ HashPosition pos;
+
+ zend_hash_internal_pointer_reset_ex(model->u.content, &pos);
+ while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) {
+ if (!model_to_xml_object(node, *tmp, object, style, model->min_occurs > 0 TSRMLS_CC)) {
+ return 0;
+ }
+ zend_hash_move_forward_ex(model->u.content, &pos);
+ }
+ return 1;
+ }
+ case XSD_CONTENT_CHOICE: {
+ sdlContentModelPtr *tmp;
+ HashPosition pos;
+ int ret = 0;
+
+ zend_hash_internal_pointer_reset_ex(model->u.content, &pos);
+ while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) {
+ int tmp_ret = model_to_xml_object(node, *tmp, object, style, 0 TSRMLS_CC);
+ if (tmp_ret == 1) {
+ return 1;
+ } else if (tmp_ret != 0) {
+ ret = 1;
+ }
+ zend_hash_move_forward_ex(model->u.content, &pos);
+ }
+ return ret;
+ }
+ case XSD_CONTENT_GROUP: {
+ return model_to_xml_object(node, model->u.group->model, object, style, model->min_occurs > 0 TSRMLS_CC);
+ }
+ default:
+ break;
+ }
+ return 1;
+}
+
+static sdlTypePtr model_array_element(sdlContentModelPtr model)
+{
+ switch (model->kind) {
+ case XSD_CONTENT_ELEMENT: {
+ if (model->max_occurs == -1 || model->max_occurs > 1) {
+ return model->u.element;
+ } else {
+ return NULL;
+ }
+ }
+ case XSD_CONTENT_SEQUENCE:
+ case XSD_CONTENT_ALL:
+ case XSD_CONTENT_CHOICE: {
+ sdlContentModelPtr *tmp;
+ HashPosition pos;
+
+ if (zend_hash_num_elements(model->u.content) != 1) {
+ return NULL;
+ }
+ zend_hash_internal_pointer_reset_ex(model->u.content, &pos);
+ zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos);
+ return model_array_element(*tmp);
+ }
+ case XSD_CONTENT_GROUP: {
+ return model_array_element(model->u.group->model);
+ }
+ default:
+ break;
+ }
+ return NULL;
+}
+
+static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
+{
+ xmlNodePtr xmlParam;
+ HashTable *prop = NULL;
+ int i;
+ sdlTypePtr sdlType = type->sdl_type;
+ TSRMLS_FETCH();
+
+ if (!data || Z_TYPE_P(data) == IS_NULL) {
+ xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, xmlParam);
+ if (style == SOAP_ENCODED) {
+ set_xsi_nil(xmlParam);
+ }
+ return xmlParam;
+ }
+
+ if (Z_TYPE_P(data) == IS_OBJECT) {
+ prop = Z_OBJPROP_P(data);
+ } else if (Z_TYPE_P(data) == IS_ARRAY) {
+ prop = Z_ARRVAL_P(data);
+ }
+
+ if (sdlType) {
+ if (sdlType->kind == XSD_TYPEKIND_RESTRICTION &&
+ sdlType->encode && type != &sdlType->encode->details) {
+ encodePtr enc;
+
+ enc = sdlType->encode;
+ while (enc && enc->details.sdl_type &&
+ enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
+ enc->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
+ enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
+ enc = enc->details.sdl_type->encode;
+ }
+ if (enc) {
+ zval *tmp = get_zval_property(data, "_" TSRMLS_CC);
+ if (tmp) {
+ xmlParam = master_to_xml(enc, tmp, style, parent);
+ } else if (prop == NULL) {
+ xmlParam = master_to_xml(enc, data, style, parent);
+ } else {
+ xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, xmlParam);
+ }
+ } else {
+ xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, xmlParam);
+ }
+ } else if (sdlType->kind == XSD_TYPEKIND_EXTENSION &&
+ sdlType->encode && type != &sdlType->encode->details) {
+ if (sdlType->encode->details.sdl_type &&
+ sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE &&
+ sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_LIST &&
+ sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_UNION) {
+
+ if (prop) prop->nApplyCount++;
+ xmlParam = master_to_xml(sdlType->encode, data, style, parent);
+ if (prop) prop->nApplyCount--;
+ } else {
+ zval *tmp = get_zval_property(data, "_" TSRMLS_CC);
+
+ if (tmp) {
+ xmlParam = master_to_xml(sdlType->encode, tmp, style, parent);
+ } else if (prop == NULL) {
+ xmlParam = master_to_xml(sdlType->encode, data, style, parent);
+ } else {
+ xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS"));
+ xmlAddChild(parent, xmlParam