1

PHPからのWS呼び出しは初めてです。この WS からデータを読み取る方法を教えてください。

これが私のコードです

$wsdl = "https://test.saljfinans.handelsbanken.se/xml/netxservice.wsdl";

$username       = 'user';
$password       = 'password';
$contractNumber = XXXXXX;
$orderNumber    = '7871';
$call = array("contractNumber" => $contractNumber, "orderNumber" => $orderNumber);


$client = new SoapClient( $wsdl, array('cache_wsdl' => WSDL_CACHE_NONE, 'trace' => 1) );
//var_dump($client->__getFunctions());
//var_dump($client->__getTypes());



$name = 'namespace';
$text = '';
$text .= '<authHeaderRequest><credentials><username>'.$username.'</username><password>'.$password.'</password></credentials></authHeaderRequest>';
$var = new SoapVar( $text, XSD_ANYXML, null, null, null );
$header = new SoapHeader( $name, 'authHeaderRequest', $var );
$client->__setSoapHeaders($header);

$response = $client->__soapCall("getInvoiceOrder", array("getInvoiceOrderRequest_t" => $call), null, $header);

Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has not 'request' プロパティが表示されます

それを機能させるにはどうすればよいですか?

4

1 に答える 1

0

もう少し情報が得られましたが、とにかく機能しません。私はただ得る

リクエスト = soapenv:Server.generalException

class getInvoiceOrder {
    public $request;
}

class getInvoiceOrderRequest_t {
    public $contractNumber;
    public $orderNumber;
}



ini_set("soap.wsdl_cache_enabled", 0);
$wsdl = "https://test.saljfinans.handelsbanken.se/xml/netxservice.wsdl";

$username       = 'user';
$password       = 'password';
$contractNumber = 550158;
$orderNumber    = '7871';

$params = new getInvoiceOrder(); 
$params->request = new getInvoiceOrderRequest_t;
$params->request->orderNumber = $orderNumber;
$params->request->contractNumber = $contractNumber;
$param[] = $params;


$client = new SoapClient( $wsdl, array('cache_wsdl' => WSDL_CACHE_NONE, 'trace' => 1) );


$name = 'namespace';
$text = '';
$text .= '<authHeaderRequest><credentials><username>'.$username.'</username><password>'.$password.'</password></credentials></authHeaderRequest>';
$var = new SoapVar( $text, XSD_ANYXML, null, null, null );
$header = new SoapHeader( $name, 'authHeaderRequest', $var );
try { 
    $client->__setSoapHeaders($header);
} catch(SoapFault $client) { 
    printf("<br/> Request = %s </br>", htmlspecialchars($client->faultcode));
    print $client->getMessage(); 
    print $client->getTraceAsString(); 
}


try { 
    $response = $client->__soapCall("getInvoiceOrder", $param, null, $header);
} catch(SoapFault $client) { 
    printf("<br/> Request = %s </br>", htmlspecialchars($client->faultcode));
    print $client->getMessage(); 
    print $client->getTraceAsString(); 
}
于 2013-01-08T08:20:26.497 に答える