0

私は 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>

そして、回答を得るために情報を送信したいと思います。次のように client.php を作成しました。

    <?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);
}

?>

しかし、ブラウザにエラーが表示されています:

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 [行:保護] => 8 [トレース:例外:プライベート] => 配列 ( [0] => 配列 ( [ファイル] => C:\wamp\www\nsoap\phpclient .php [行] => 8 [関数] => __call [クラス] => SoapClient [型] => -> [引数] => 配列 ( [0] => getIMIPremium [1] => 配列 ( [0] => Array ( [expiryDate] => 25 [imiInsured] => N [inceptionDate] => 43 [noOfInsured] => 23 [partnerCode] => 21 [stateCode] => MP ) ) ) ) [1] => 配列( [ファイル] => C:\wamp\www\nsoap\phpclient.php [行] => 8 [関数] => getIMIPremium [クラス] => SoapClient [型] => -> [引数] => 配列 ( [0] =>配列 ( [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 8行目 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php:0 20.0104698552SoapClient->getIMIPremium( ..\phpclient.php:8 )

どこが間違っていますか?これに対する可能な解決策は何ですか?

編集 :

私はphpファイルを作成しました: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);
}
}
?>

しかし、それはこのエラーを生成しています:

呼び出しエラー: text/xml 型の応答ではありません: application/wsdl+xmlHTTP/1.1 200 OK 日付: 2013 年 9 月 17 日 (火) 15:10:38 GMT サーバー: 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

提案に従って、 $args に imiPolicy を追加しました:

$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'));

しかし、エラーは次のようになります。

SoapFault Object ( [message:protected] => 間違ったバージョン [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 [行] => 10 [関数] => __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] =>配列 ( [ファイル] => C:\wamp\www\nsoap\phpclient.php [行] => 10 [関数] => getIMIPremium [クラス] => SoapClient [タイプ] => -> [引数] => 配列( [0] => 配列 ( [imiPolicy] => 配列 ( [expiryDate] => 23-09-2013 [imiInsured] => 配列 ( [アイテム] => 配列 ( [アイテム] => 配列 ( [年齢] = > 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] => 間違ったバージョン [faultcode] => VersionMismatch [faultcodens] =>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] => 間違ったバージョン [faultcode] => VersionMismatch [faultcodens] =>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] => 間違ったバージョン [faultcode] => VersionMismatch [faultcodens] =>233 ) ) ) ) [previous:Exception:private] => [faultstring] => 間違ったバージョン [faultcode] => VersionMismatch [faultcodens] =>233 ) ) ) ) [previous:Exception:private] => [faultstring] => 間違ったバージョン [faultcode] => VersionMismatch [faultcodens] =>http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: 10 行目の C:\wamp\www\nsoap\phpclient.php の間違ったバージョン コール スタック #TimeMemoryFunctionLocation 10.0012674576{main} ( )..\phpclient.php:0 20.0184702744SoapClient->getIMIPremium( )..\phpclient.php:10 )

4

1 に答える 1

0

前に言われたことのように..

エラーは次の周囲にあります。

[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 ) 

これを分けてみましょう:

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

これは次のように分類されます。

C:\wamp\www\nsoap\phpclient.php 8 行目 コール スタック #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php

PHP ファイルに「imiPolicy」の行/設定はありますか?

それが設定されたら、すぐに使えるはずだと思います。

お役に立てれば。

ケント

于 2013-09-17T17:07:40.133 に答える