我明白這個「對象引用沒有設置爲對象的實例」已經出現了很多,但我所看到的所有答案似乎都沒有幫助我。未將對象引用設置爲對象的實例。 php
這裏是我的WSDL:https://app.20-20insights.com/testepos/servicetrx.svc?wsdl
我想調用的BeginTrx()函數,但我得到一個錯誤。
任何意見或幫助,非常感謝。
謝謝, 馬丁。
設置TrxIdentifier對象
$trxIdentifier = new TrxIdentifier;
$trxIdentifier->ClientId = 9372490002639296;
$trxIdentifier->DeviceId = "123";
$trxIdentifier->OpId = "123";
$trxIdentifier->PosDescription = "123";
$trxIdentifier->PosId = "123";
$trxIdentifier->PosTxnId = "123";
$trxIdentifier->SiteId = "12312";
$trxIdentifier->Token = "3";
$trxIdentifier->TrxdateTime = new DateTime;
進行電話...
$client = new SoapClient($wsdl, array('trace'=>true,
'exceptions'=>true,
'classmap'=>array('TrxIdentifier'=>"TrxIdentifier", 'MemberInfo'=>"MemberInfo", 'Response'=>"Response", 'MemberDetail'=>"MemberDetail")));
$response = $client->BeginTrx($trxIdentifier);
錯誤:發生
Object reference not set to an instance of an object.
a:InternalServiceFaultObject reference not set to an instance of an object.Object reference not set to an instance of an object. at CatalystSpsTrx.Contracts.Service.ServiceTrx.BeginTrx(MemberInfo& mem, TrxIdentifier conTrx) in C:\Projects\2010\CatTrxServices\CatalystSpsTrx.Contracts\Service\ServiceTrx.cs:line 38
at _dynamic_CatalystSpsTrx.Contracts.Service.ServiceTrx.BeginTrx(Object , Object[])
at Spring.Reflection.Dynamic.SafeMethod.Invoke(Object target, Object[] arguments)
at Spring.Aop.Framework.DynamicMethodInvocation.InvokeJoinpoint()
at Spring.Aop.Framework.Adapter.AfterReturningAdviceInterceptor.Invoke(IMethodInvocation invocation)
at Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptor.Invoke(IMethodInvocation invocation)
at CompositionAopProxy_d0e73463863e4ccd9c2db0a96530bd0d.BeginTrx(MemberInfo& mem, TrxIdentifier conTrx)
at ServiceTrx.BeginTrx(MemberInfo& mem, TrxIdentifier conTrx)
at SyncInvokeBeginTrx(Object , Object[] , Object[])
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)System.NullReferenceException
由服務器,而不是PHP產生的錯誤:
繼再次WSDL作爲,
TrxIdentifier
定義。您必須查看服務器代碼或通知API管理員您正在使用的服務。 – drew010謝謝,我給他們發了一封電子郵件,我正在等待他們回覆。 – Martin