0
votes

I have a wsdl :

<?xml version="1.0" encoding="UTF-8"?>

  <wsdl:part element="impl:getIMIPremiumResponse" name="parameters">

  </wsdl:part>

  <wsdl:part element="impl:getIMIPremium" name="parameters">

  </wsdl:part>

  <wsdl:operation name="getIMIPremium">

     <wsdl:input message="impl:getIMIPremiumRequest" name="getIMIPremiumRequest">

   </wsdl:input>

     <wsdl:output message="impl:getIMIPremiumResponse" name="getIMIPremiumResponse">

   </wsdl:output>

  </wsdl:operation>

  <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

  <wsdl:operation name="getIMIPremium">

     <wsdlsoap:operation soapAction=""/>

     <wsdl:input name="getIMIPremiumRequest">

        <wsdlsoap:body use="literal"/>

     </wsdl:input>

     <wsdl:output name="getIMIPremiumResponse">

        <wsdlsoap:body use="literal"/>

     </wsdl:output>

  </wsdl:operation>

  <wsdl:port binding="impl:IMIPremiumWebServiceSoapBinding" name="IMIPremiumWebService">

     <wsdlsoap:address location="http://mysite.com/nsoap/IMIPremiumWebService.wsdl"/>

  </wsdl:port>

And I want to submit information to get response. I created client.php which goes as follows :

    <?php

try{
$client = new SoapClient("http://mysite.com/nsoap/IMIPremiumWebService.wsdl");


$args= array("expiryDate"=>'25',"imiInsured"=>'N',"inceptionDate"=>'43',"noOfInsured"=>'23',"partnerCode"=>'21',"stateCode"=>'MP' );
$something =  $client->getIMIPremium($args);
echo $client->responseData;

}
catch (Exception $e)
{
    print_r($e);
}

?>

But it is showing error in browser :

SoapFault Object ( [message:protected] => SOAP-ERROR: Encoding: object has no 'imiPolicy' property [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\nsoap\phpclient.php [line:protected] => 8 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 8 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => getIMIPremium [1] => Array ( [0] => Array ( [expiryDate] => 25 [imiInsured] => N [inceptionDate] => 43 [noOfInsured] => 23 [partnerCode] => 21 [stateCode] => MP ) ) ) ) [1] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 8 [function] => getIMIPremium [class] => SoapClient [type] => -> [args] => Array ( [0] => Array ( [expiryDate] => 25 [imiInsured] => N [inceptionDate] => 43 [noOfInsured] => 23 [partnerCode] => 21 [stateCode] => MP ) ) ) ) [previous:Exception:private] => [faultstring] => SOAP-ERROR: Encoding: object has no 'imiPolicy' property [faultcode] => Client [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: SOAP-ERROR: Encoding: object has no 'imiPolicy' property in C:\wamp\www\nsoap\phpclient.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php:0 20.0104698552SoapClient->getIMIPremium( )..\phpclient.php:8 )

Where am I wrong ? What should be possible solution for this?

Edit :

I have create a php file : client.php

    <?php
require_once('nusoap.php');

$client = new nusoap_client('http://localhost/nsoap/IMIPremiumWebService.wsdl', True);


$err = $client->getError();
if ($err) {
// Display the error
echo 'client construction error: ' . $err ;
} else {
$args= array("imiPolicy" => array("expiryDate" => "23-09-2013", "imiInsured" =>array("item" => array("item" => array("age"=>'23', "basicSumInsured"=>'33233', "coverRageType"=>'12',"dateOfBirth"=>'26-09-1986',"preExistingDisease" => 'no'))), "inceptionDate"=>"12-09-2009" ,"noOfInsured"=>'1',"partnerCode" => '2121', "stateCode" => '233'));

$answer = $client->call('getIMIPremium',
$args);

$err = $client->getError();
if ($err) {
// Display the error
echo 'Call error: ' . $err;
 echo $client->response;
//print_r($client->response);
//print_r($client->getDebug());
} else {
    echo "*******************";
print_r($answer);
}
}
?>

But it is generating this error :

Call error: Response not of type text/xml: application/wsdl+xmlHTTP/1.1 200 OK Date: Tue, 17 Sep 2013 15:10:38 GMT Server: Apache/2.2.22 (Win64) PHP/5.3.13 Last-Modified: Tue, 17 Sep 2013 13:18:39 GMT ETag: "a0000000a818c-12e9-4e69428b54054" Accept-Ranges: bytes Content-Length: 4841 Connection: close Content-Type: application/wsdl+xml

As per suggestion, I have added imiPolicy in $args :

$args= array("imiPolicy" => array("expiryDate" => "23-09-2013", "imiInsured" =>array("item" => array("item" => array("age"=>'23', "basicSumInsured"=>'33233', "coverRageType"=>'12',"dateOfBirth"=>'26-09-1986',"preExistingDisease" => 'no'))), "inceptionDate"=>"12-09-2009" ,"noOfInsured"=>'1',"partnerCode" => '2121', "stateCode" => '233'));

But now error becomes:

SoapFault Object ( [message:protected] => Wrong Version [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\nsoap\phpclient.php [line:protected] => 10 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => getIMIPremium [1] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [1] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => getIMIPremium [class] => SoapClient [type] => -> [args] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [previous:Exception:private] => [faultstring] => Wrong Version [faultcode] => VersionMismatch [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: Wrong Version in C:\wamp\www\nsoap\phpclient.php on line 10 Call Stack #TimeMemoryFunctionLocation 10.0012674576{main}( )..\phpclient.php:0 20.0184702744SoapClient->getIMIPremium( )..\phpclient.php:10 )

1
Looks like your request is missing a imiPolicy propertytlenss
can you please throw some light on it.akshayb

1 Answers

0
votes

Like what was previously said..

The error is surrounding the follwoing:

[xdebug_message] => ( ! ) SoapFault: SOAP-ERROR: Encoding: object has no 'imiPolicy' property in C:\wamp\www\nsoap\phpclient.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php:0 20.0104698552SoapClient->getIMIPremium( )..\phpclient.php:8 ) 

Let's pick this apart:

OAP-ERROR: Encoding: object has no 'imiPolicy' property in C:\wamp\www\nsoap\phpclient.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php

and this breaks down to:

C:\wamp\www\nsoap\phpclient.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php

Is there a line/setting in the php file for: 'imiPolicy'

I think once that is set, you should be good-to-go.

Hope this helps.

Kent