希望有人可以从PHP
中帮助我求职我需要致电SOAP服务并发送服务插入
的DTO对象肥皂文档就像以下
public virtual resultValidation validateInvoice(
Invoice invoice
)
invoice:
Type: invoiceWebService.DTO.invoice
我需要在发票对象中传递以下"变量"
"productNameInvoice" (VALUE: "Produkt 1")
"amount" (VALUE: 500)
"type" (VALUE: 1)
我试图执行以下代码(我用于接听电话),但是它可以使用。我想这是因为我将"变量"作为数组而不是DTO对象(InvoiceWebService.dto.invoice)发送了 - 但是可以找出要更改的内容
获取此错误:未接收的SOAPFAULT异常 - 非静态方法需要一个目标
这是我尝试过的代码
$client = new soapClient(...) // As I use to when getting from service (is working)
$params = array(
"productNameInvoice"=>"Product 1",
"amount"=>500,
"type"=>1
);
$response = $client->__soapCall("validateInvoice", array($params))
希望有人可以帮助我:)
提前 - 谢谢Kim
怎么样?
$client = new soapClient(...)
$validateInvoice = new stdClass();
$validateInvoice->productNameInvoice = "Product 1";
$validateInvoice->amount = 500;
$validateInvoice->type = 1;
$response = $client->validateInvoice($validateInvoice);
通过使用miknik的答案找到解决方案
$client = new soapClient(...)
$validateInvoice = new stdClass();
$validateInvoice->productNameInvoice = "Product 1";
$validateInvoice->amount = 500;
$validateInvoice->type = 1;
$params = array(
"invoice" => $validateInvoice
);
$response = $client->__soapCall("validateInvoice", array($params));