我们有.Net soap服务,我们需要调用其中一种服务方法。我试过创建一个stdClass()实例并分配.NET的必需属性。无法将对象传递给.Net服务。
我在这里使用过Nusoap但是如果你有一个SOAP PHP类解决方案,它也会被邀请。
$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));
这是我的方法签名。
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; }
........
}
我的xml代码
<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>
以下是我的错误
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
)
)
)
任何帮助将不胜感激。 THX .......