curl-library
Re: Re: Re: PHP nuSoap (cURL) vs AXIS server
Date: Mon, 7 Mar 2011 16:30:51 +0100
[..cutted..]
>Let me suggest that as you're asking for help about libcurl (which this
list
>is for), making an example that repeats the problem using libcurl directly
[..cutted..]
>These options seem highly relevant. Can you run the curl command line tool
>using that cert + key combination against the target server? The
corresponding
>libcurl option (for one of these) is called CURLOPT_KEYPASSWD and needs to
be
>the key you used for your private key (file).
In one of 1.000.000 of test that I maked, I create a file using libCurl
directly, but there is some other problem with ASIX ("urn:" style method
used).
this is the code:
01. $wsdl =
"../../WS/SoapEdi.wsdl";if(!file_exists($wsdl))file_put_contents($wsdl,ereg_
replace("urn:","",file_get_ontents($wsdl_add)));
02.$client = new SoapClient($wsdl,
03.array(
04.'userid' => $userid, 'password' => $password,
05. "style" => SOAP_RPC,
06. "use" => SOAP_ENCODED,
07. "soap_version" => SOAP_1_1,
08. "uri"=>"urn:SoapEdi",
09. 'local_cert' => "candi2.cer")
10.);
11.var_dump($client->__getFunctions());
12.$result = $client -> getListaDocumenti();
Result: worst of the worst!
<b>Fatal error</b>: Uncaught SoapFault exception: [ns1:Server.NoService]
The AXIS engine could not find a target service to invoke! targetService is
SoapEdi in C:\Program Files (x86)\xampp\htdocs\e-Max\WS\MI.php:66
Stack trace:
#0 [internal function]: SoapClient->__call('getListaDocumen...', Array)
#1 C:\Program Files (x86)\xampp\htdocs\test_cURL.php(66):
SoapClient->getListaDocumenti()
#2 C:\Program Files (x86)\xampp\htdocs\test_cURL(17): require('C:\Program
File...')
#3 C:\Program Files (x86)\xampp\htdocs\test_cURL(1): require('C:\Program
File...')
#4 {main}
thrown in <b>C:\Program Files (x86)\xampp\htdocs\ test_cURL </b> on line
<b>66</b><br />
Sorry but I don't know how use directly cURL from line command to connect at
webService.
Thanks a lot,
Francesco
-----Messaggio originale-----
Da: Supporto Tecnico eMax [mailto:support_at_eMax.it]
Inviato: lunedì 7 marzo 2011 15:44
A: 'curl-library_at_cool.haxx.se'
Cc: 'info_at_bnoordhuis.nl'; 'Supporto Tecnico eMax'
Oggetto: Re: Re: PHP nuSoap (cURL) vs AXIS server
>From: Ben Noordhuis <info_at_bnoordhuis.nl>
>Date: Mon, 7 Mar 2011 12:46:44 +0100
[..cutted..]
>The error message seems to indicate that X.509 / PKCS12 client
>authentication is attempted but it's hard to tell without a more
>complete code sample.
Thanks Ben for help: for me is indispensable, a complete code I think is not
helpfull because I don't use directly cURL but a class that use cURL: nuSoap
(nuSoap homepage here: https://sourceforge.net/projects/nusoap/ ).
Therefore this my code.
<?php
$sql = "SELECT * FROM wsIndirizzi WHERE idWS='".$idWS."' LIMIT 1";
$WSINDIRIZZO = mysql_fetch_array (mysql_query ( $sql )); $wsdl =
$WSINDIRIZZO ['Indirizzo']; //compatibilità pre WSINDIRIZZO //
https://weg.rm.enel.it/axis/rpcEdi.do/urn:SoapEdi?wsdl
$client = new nusoap_client_mime($wsdl, true , false, false, false, false,
300, 300); // Cerco se ci sono errori $err = $client->getError(); if ($err)
{
// Mostro l'errore
echo '<h2>Errore nella costruzione </h2><pre>' . $err . '</pre>'; } if
($WSINDIRIZZO['idTipo']==2) {
$client->setCredentials("","","certificate", array(
"sslcertfile" => realpath("c:\\Program Files
(x86)\\xampp\\htdocs\\candi2.cer"),
// "sslkeyfile" => realpath("c:\\Program Files
(x86)\\xampp\\htdocs\\donthave.key"),
// "passphrase" => "",
// "certpassword" => "paladin",//OPTIONAL
// "verifypeer" => 0, //OPTIONAL - don't work
// "verifyhost" => 0 //OPTIONAL - don't work
)
}
The code that I change is on row 2478
I force : $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0);
$this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0);
the complete class is downlodable on
http://sourceforge.net/projects/nusoap/files/
Thanks,
Francesco
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-07