0
我试图使用nusoap
客户端,并与正常SoapClient
调用GetHotels
功能和调用函数时,我有这个问题,它返回以下错误:如何使PHP头部安全性调用PHP SOAP?
Uncaught SoapFault exception: [a: InternalServiceFault] Object reference not set to an instance of an object.
我用这个代码nusoap_client
$client = new nusoap_client("http://amandaws.absolutent.it/Booking.svc" , 'wsdl');
$bodyxml =('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:oas="http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:tem="http://tempuri.org/">
<soapenv:Header>
<oas:Security>
<oas:UsernameToken>
<oas:Username>XXX</oas:Username>
<oas:Password>XXX</oas:Password>
</oas:UsernameToken>
</oas:Security>
</soapenv:Header>
<soapenv:Body>
<tem:BGH_Request Language="IT">
<tem:Criteria HotelCode="FID001" IDRegione="" IDProvincia="" IDComune="" IDLocalita="" IDLineaProdotto="" IDZona="" MaxResults="200" />
</tem:BGH_Request>
</soapenv:Body>
</soapenv:Envelope>');
$client->soap_defencoding = 'utf-8';
$client->operation = "GetHotels";
$result = $client->send($client->serializeEnvelope($bodyxml), "http://tempuri.org/IBooking/GetHotels");
print_r($result);
当我打印$result
,我得到这个阵列消息
Array
(
[faultcode] => a:InternalServiceFault
[faultstring] => Array
(
[!xml:lang] => en-GB
[!] => Object reference not set to an instance of an object.
)
[detail] => Array
(
[ExceptionDetail] => Array
(
[HelpLink] =>
[InnerException] =>
[Message] => Object reference not set to an instance of an object.
[StackTrace] => at Absolute.Web.Common.UoW.TransactionService.InTrasaction(Action actionbeBeforeCommit)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.IBookingProxy.GetHotels(BookingGetHotelsMessageRequest request)
at SyncInvokeGetHotels(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.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
[Type] => System.NullReferenceException
)
)
)
如果有人可以帮助我,我会非常好看
谢谢。我已经解决了这个问题,没有问题发送所有的XML请求与头,我在请求中的语法不好。来自萨尔瓦多的问候 –