duanping1920 2014-09-23 08:24
浏览 41

通过PHP将对象传递给.NET Web服务

We have .Net soap service, we need to call one of the services method in that. I've tried creating an instance of stdClass() and assigning the required properties of the .NET. Am unable to pass the object to .Net service.

I have used Nusoap here but if you have a SOAP PHP class solution it is also invited.

$client_card = new nusoap_client('https://uatapi.viad.com/ges/v1/orderService.svc?wsdl', 'WSDL');
$obj = new stdClass();
$obj->CreditCardNumber = "4518169332998699";
$obj->ExpireMonth = 05;
$obj->ExpireYear = 2025;
$obj->CardNickname = "Test";
$obj->CardholderName = "test";
$obj->Address = "test";
$obj->City = "Anywhere";
$obj->State = "test";
$obj->PostalCode = "test";
$obj->Country ="test";
$parameter= array("CreditCardSubmission" => $obj);

$obj1 = $client_card->call('SubmitCreditCardInformation',  
                                            array("applicationSessionId" => $id, $parameter));

Here is my method signature.

string SubmitCreditCardInformation(string applicationSessionId, CreditCardSubmission request)


[DataContract(Namespace = "www.xxx.com")]
  public class CreditCardSubmission
  { 
     [DataMember] public string CreditCardNumber { get; set; } 
     [DataMember] public int ExpireMonth { get; set; }
    ........
  }

My xml code

<wsdl:operation name="SubmitCreditCardInformation">
<soap:operation soapAction="www.viad.com/v1/IOrderService/SubmitCreditCardInformation" style="document"/>
<wsdl:input><soap:body use="literal"/></wsdl:input>
<wsdl:output><soap:body use="literal"/></wsdl:output>
<wsdl:fault name="DictionaryOf_String_StringFault">
<soap:fault name="DictionaryOf_String_StringFault" use="literal"/></wsdl:fault></wsdl:operation>

Below is my error

 Array
(
    [faultcode] => a:InternalServiceFault
    [faultstring] => Array
        (
            [!xml:lang] => en-US
            [!] => 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 Viad.Services.Public.GES.v1.OrderService.SubmitCreditCardInformation(String applicationSessionId, CreditCardSubmission request) in c:\SVN\Viad.GES.Services\Branches\PublicServices_v1\Viad.Services.Public.GES\v1\OrderService.svc.cs:line 1248
   at SyncInvokeSubmitCreditCardInformation(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)
                    [Type] => System.NullReferenceException
                )

        )

)

Any help would be appreciated. Thx.......

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大