Philip :

Try this:


$client = new SoapClient( null, array( 'encoding' => 'utf-8', 'soap_version'
=> SOAP_1_2, 'trace' => 1, 
                                 'uri' => 'tns: Server', 'location' => 'php
server URL here'));

// Cut off <?xml version="1.0" encoding="utf-8"?>, to not have two xml start
tag in the soap message.
$xmlres = $client->__soapCall( 'ProXML', array( str_replace( '<?xml
version="1.0" encoding="utf-8"?>'."\n", '', $sXml )));

echo '<pre>', $xmlres, '</pre>'; // print the xml output or
var_export($xmlres, true) if $xmlres is an array.


class Receiver
    public function ProXML ( $sXML )

        libxml_use_internal_errors(true); // enabled use libxml errors

        // try..catch to cacth simplexmlelement errors
            $xml = new SimpleXMLElement( '<?xml version="1.0"
encoding="utf-8"?>' . $sXML ); // Try to create a xml object with the string
        } catch (Exception $e) {
            $aErrors = libxml_get_errors(); // get errors

                        foreach ( $aErros as $oErro )
                    switch ( $oErro->level )
                        case LIBXML_ERR_WARNING:
                            $sCod .= '<return><code>' . $oErro->code .
'</code><menssage>' . utf8_encode( 'warning: ' . $oErro->message ) .
                case LIBXML_ERR_ERROR:
                    $sCod .= '<resposta><codigo>' . $oErro->code .
'</code><menssage>' . utf8_encode( 'Error: ' . $oErro->message ) .
                 case LIBXML_ERR_FATAL:
                    $sCod .= '<resposta><codigo>' . $oErro->code .
'</code><menssage>' . utf8_encode( ' Fatal Error: ' . $oErro->message ) .

        work here ...



$server = new SoapServer(null, array( 'uri' => 'tns: Server' ));



Alejandro M.S

-----Mensagem original-----
De: Phillip Baker [] 
Enviada em: quarta-feira, 8 de agosto de 2012 19:12
Assunto: [PHP] XML/PHP web service

Greetings all,

I am looking for some options here.

I am in need of creating a service on our web server that will always be
available and automated.
It will accept an XML file.

I will be checking to see if the XML file is valid and then passing it on to
another server.
But I need to accept this file without using a submit form.
I have never done anything like this and looking for ideas.

I am using a lamp environment and looking for suggestions.

I am looking to set this up so that our vendors can set up scripts to
automatically post XML files to our servers.

Blessed Be


"In the Jim Crow South, for example, government failed and indeed refused to
protect blacks from extra-legal violence. Given our history, it's stunning
we fail to question those who would force upon us a total reliance on the
state for defense."
-- Robert J. Cottrol

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to