Inspect XML created by PHP SoapClient call before/without sending the request

Upfront remark: In order to use the __getLastRequest() method successfully, you have to set the ‘trace’ option to true on client construction: $client = new SoapClient(‘wsdldoc.asmx?WSDL’, array(‘trace’ => TRUE)); This way, your request will still be sent (and therefore still fail), but you can inspect the sent xml afterwards by calling $client->__getLastRequest(). Main answer: To … Read more

How to add HTTP Header to SOAP Client

Try to use this: SoapServiceClient client = new SoapServiceClient(); using(new OperationContextScope(client.InnerChannel)) { // // Add a SOAP Header (Header property in the envelope) to an outgoing request. // MessageHeader aMessageHeader = MessageHeader // .CreateHeader(“MySOAPHeader”, “http://tempuri.org”, “MySOAPHeaderValue”); // OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader); // Add a HTTP Header to an outgoing request HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty(); requestMessage.Headers[“MyHttpHeader”] = “MyHttpHeaderValue”; … Read more

How to convert SOAP response to PHP Array?

The following SOAP response structure can be easily converted in an array using a combination of the previous methods. Using only the the function “simplexml_load_string” removing the colon “:” it returned null in some cases. SOAP Response <S:Envelope xmlns:S=”http://schemas.xmlsoap.org/soap/envelope/”> <S:Body> <ns2:transaccionResponse xmlns:ns2=”http://ws.iatai.com/”> <respuestaTransaccion> <idTransaccion>94567</idTransaccion> <referencia>3958</referencia> <idEstado>3</idEstado> <nombreEstado>Declinada</nombreEstado> <codigoRespuesta>202</codigoRespuesta> <valor>93815.0</valor> <iva>86815.0</iva> <baseDevolucion>0.0</baseDevolucion> <isoMoneda>COP</isoMoneda> <fechaProcesamiento>24-07-2015 12:18:40 PM</fechaProcesamiento> … Read more

Disable certificate verification in PHP SoapClient

SoapClient takes a stream context in its parameters, which you can create yourself. That way you can control almost every aspect of the transport layer: $context = stream_context_create([ ‘ssl’ => [ // set some SSL/TLS specific options ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true ] ]); $client = new SoapClient(null, [ ‘location’ => … Read more

What SOAP client libraries exist for Python, and where is the documentation for them? [closed]

Update (2016): If you only need SOAP client, there is well maintained library called zeep. It supports both Python 2 and 3 🙂 Update: Additionally to what is mentioned above, I will refer to Python WebServices page which is always up-to-date with all actively maintained and recommended modules to SOAP and all other webservice types. … Read more