i have problem interaction unistream service soap-client , curl too.
my environment: ubuntu 15.04, php 5.64
some history: unistream's support asked generate certifiate: makecert.exe -n "cn=some_name" -ss -r -m 120 -pe -sky exchange -a sha1, export mmc end send certificate them. ok, , got certificate generated on side. convert certificate pem-format , try use php soapclient:
$soap = new soapclient("http://test2.unistream.com:82/wcflib-tc/service.svc?wsdl", [ 'encoding' => 'utf-8', 'trace' => true, 'local_cert' => $cert_path, 'soap_version' => soap_1_2, 'connection_timeout' => 180, 'cache_wsdl' => wsdl_cache_none ]); $data = $soap->getcountrieschanges(['requestmessage'=>[ 'authenticationheader'=>[ 'appkey'=>'*', 'password'=>'*', 'username'=>'*', ], 'updatecount'=>1000 ]]);
and got nothing. try same python soap library, soapui , got nothing too, timeout. ok, wireshark, , saw soap client recieve xsd schemas , etc , connection interrupt after post request url: http://test2.unistream.com:82/wcflib-tc/service.svc, timeout. , saw plain http xml, no packets ssl. ok, try send post-request on url:
ini_set('default_socket_timeout', 30); $request_string = '<?xml version="1.0" encoding="utf-8"?> <env:envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://schemas.datacontract.org/2004/07/wcfservicelib" xmlns:ns2="http://schemas.datacontract.org/2004/07/wcfservicelib.utils" xmlns:ns3="http://schemas.datacontract.org/2004/07/wcfservicelib.dictionaries.country" xmlns:ns4="http://test.unistream.com/wcflib/"> <env:body> <ns4:getcountrieschanges> <ns4:requestmessage> <ns2:authenticationheader> <ns1:appkey>*</ns1:appkey> <ns1:password>*</ns1:password> <ns1:username>*</ns1:username> </ns2:authenticationheader> <ns3:updatecount>1000</ns3:updatecount> </ns4:requestmessage> </ns4:getcountrieschanges> </env:body> </env:envelope> '; $url = 'http://test2.unistream.com:82/wcflib-tc/service.svc'; $ch = curl_init(); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, ['content-type: application/soap+xml;', 'charset=utf-8']); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_capath, "/path"); //my cert curl_setopt($ch, curlopt_sslcert, "/path/local_cert.pem"); //my private key curl_setopt($ch, curlopt_sslkey, "/path/local_key.pem"); curl_setopt($ch, curlopt_sslkeypasswd, 'passwd'); //api's cert curl_setopt($ch, curlopt_cainfo, '/path/api_cert.cer'); curl_setopt($ch, curlopt_connecttimeout, 30); curl_setopt($ch, curlopt_postfields, $request_string); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_certinfo, true); curl_setopt($ch, curlopt_verbose, 1); curl_setopt($ch, curlopt_url, $url); $result = curl_exec($ch); print_r($result); echo "\n"; $error = curl_error($ch); print_r($error); echo "\n";
and xml error: "an error occurred when verifying security message." if try send request url: https://test2.unistream.com:82/wcflib-tc/service.svc got plain html error 400 , curl error: "error:140770fc:ssl routines:ssl23_get_server_hello:unknown protocol"
support can't me. said "we have 10000 working clients, consult high-level api problems , bussines-logic".
can give me right direction?
i don't have docs unistream.
i know certificates transport layer. means occur before else. you're connecting http url, not https url , means you're not using encryption.
certificates , encryption not problem.
however, url pasted not listening connections on port.
$ curl -v http://test2.unistream.com:82/wcflib-tc/service.svc?wsdl * trying 94.127.155.67... * connection timed out after 60001 milliseconds * closing connection 0 curl: (28) connection timed out after 60001 milliseconds
you're not using right address/port number @ all.
next
- get right url endpoint
- don't bother client certificate unless endpoint using https
Comments
Post a Comment