Make a soap request
So, I need to make a soap request to connect a webservice with BD in MySQL for webdev
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:getCustomersResponse xmlns:ns1="urn:inworkcustomer"> <getCustomersResult> <ErrorNumber>0</ErrorNumber> <ErrorMessage/> <CustomerID>83</CustomerID> <Codigo>C0080</Codigo> <Nome>David Bruno Pereira da Costa Durão </Nome> <NIF>205816266</NIF> <Morada>Av. Madre Rita de Jesus, Lt 120 R/c Dto </Morada> <CPostal>3500-179</CPostal> <Pais>Portugal</Pais> <PWD>BoW6</PWD> </getCustomersResult> <getCustomersResult> <ErrorNumber>0</ErrorNumber> <ErrorMessage/> <CustomerID>1767</CustomerID> <Codigo>C1789</Codigo> <Nome>RUI MARQUES</Nome> <NIF>219323640</NIF> <Morada>Av. Principal, 12 Masgalos</Morada> <CPostal>3510-605</CPostal> <Pais>Portugal</Pais> <PWD>BoW6</PWD> </getCustomersResult> </ns1:getCustomersResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
As my first soap request I research a lot information and try to make it my onw but is keep telling me the query is empty, This is the request I came with
$dataFromTheForm = $_POST['GetCustomer']; // request data from the form $soapUrl = "http://david/INWORK_WEB/awws/inworkcustomer.awws?wsdl"; $GetCustomer = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd = "http://www.w3.org/1999/XMLSchema\" xmlns:soap = "http://schemas.xmlsoap.org/soap/envelope/" > <soap:Body> <GetCustomer xmlns="urn:inworkcustomer\"> <Customer>$dataFromTheForm</Customer> </GetCustomer> </soap:Body> </soap:Envelope>; $headers = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "SOAPAction: http://David/INWORK_WEB/awws/inworkcustomer.awws", "Content-length: ".strlen($GetCustomer), ); $url = $soapUrl; function get_web_page( $url ){ $options = array() CURLOPT_FILE => true, CURLOPT_READFUNCTION => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_USERAGENT => "spider", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, CURLOPT_SSL_VERIFYPEER => false ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; return $header; }
Can anybody help me? This request is to put in webdev and to call the values to a BD in MySQL