0
votes

I have wsdl with a single function getProd() that takes a string parameter and has a SOAPaction getProd. I have been able to consume the webservice using NuSoap and SoapClient. But anytime I try to consume it using curl, I keep geeting the error Missing argument 1 for getProd(). Please help. I've used curl to consume other web services before so I don't know what the issue Is.

Here is my code

$soap_do = curl_init();
$post_string = "books";
curl_setopt($soap_do, CURLOPT_URL,            "http://localhost/wsdl/post.php?wsdl" );   
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); 
curl_setopt($soap_do, CURLOPT_TIMEOUT,        10); 
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);  
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt($soap_do, CURLOPT_POST,           true ); 
curl_setopt($soap_do, CURLOPT_POSTFIELDS,  $post_string); 
curl_setopt($soap_do, CURLOPT_HTTPHEADER,     array(   
            'Content-Type: string; charset=utf-8', 
        "Cache-Control: no-cache", 
        "Pragma: no-cache", 
    "SOAPAction: getProd",
    'Content-Length: '.strlen($post_string)
    ) );
$response = curl_exec($soap_do);
echo $response;
echo curl_error($soap_do);
1

1 Answers

0
votes

Solved. I realized that NuSoap and SoapClient adds the required soap envelope automatically. While you'd have to do that manually when using Curl