我正在嘗試使用PHP和nusoap將數據提交到Web服務。我打電話Web服務操作位於:http://service.leads360.com/ClientService.asmx?op=AddLeads什麼是XmlNode?
操作的預期參數username
字符串,password
字符串,並作爲leads
XmlNode的。對於此的XmlNode他們給出的架構和XML文檔的例子:
http://service.leads360.com/Documentation/Schemas/Client/Leads.Request.xsd
http://service.leads360.com/Documentation/Examples/Client/AddLeads.leads.xml
所以我複製他們給了XML文檔,並把它變成一個數組,把該數組內的另一個數組稱爲$params
隨着username
和password
和執行
$result = $client->call('AddLeads', $params);
不幸的是它給我以下錯誤:
[faultcode] => soap:Server
[faultstring] => System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at LeadManager.Business.XmlHelper.RemoveNamespace(XmlNode xml, Boolean asElement) in c:\Code\DEV\LeadManager_Business\Utilities\XmlHelper.cs:line 323
at LeadManagerService.ClientService.InsertSerializedLeads(XmlNode descriptors)
at LeadManagerService.ClientService.InsertLeads(XmlNode descriptor)
at LeadManagerService.Invoker 1.Invoke(ServiceContext context, String methodName, ICredentials credentials, Object parameters, Requestor requestor)
at LeadManagerService.ClientService.AddLeads(String username, String password, XmlNode leads)
--- End of inner exception stack trace ---
我粘貼我的代碼在:http://pastebin.com/7jbPGuqn。
我也在粘貼我作爲下面的引線參數傳遞的數組。請告訴我該數組是否代表示例中的xml文檔,以及它是否是有效的XmlNode
。
Array
(
[Leads] => Array
(
[Lead] => Array
(
[0] => Array
(
[Status] => Array
(
)
[Status_attr] => Array
(
[StatusId] => 2
)
[Campaign] => Array
(
)
[Campaign_attr] => Array
(
[CampaignId] => 3
)
[Agent] => Array
(
)
[Agent_attr] => Array
(
[AgentId] => 1
)
[Fields] => Array
(
[Field] => Array
(
[0] => Array
(
)
[1] => Array
(
)
[0_attr] => Array
(
[FieldId] => 2
[Value] => F1Name
)
[1_attr] => Array
(
[FieldId] => 3
[Value] => L1Name
)
[2] => Array
(
)
[2_attr] => Array
(
[FieldId] => 4
[Value] => [email protected]
)
[3] => Array
(
)
[3_attr] => Array
(
[FieldId] => 5
[Value] => 111111111
)
[4] => Array
(
)
[4_attr] => Array
(
[FieldId] => 6
[Value] =>
)
)
)
)
[1] => Array
(
[Fields] => Array
(
[Field] => Array
(
[0] => Array
(
)
[1] => Array
(
)
[0_attr] => Array
(
[FieldId] => 2
[Value] => F2Name
)
[1_attr] => Array
(
[FieldId] => 3
[Value] => L2Name
)
[2] => Array
(
)
[2_attr] => Array
(
[FieldId] => 4
[Value] => [email protected]
)
[3] => Array
(
)
[3_attr] => Array
(
[FieldId] => 5
[Value] => 222222222
)
)
)
)
[2] => Array
(
[Fields] => Array
(
[Field] => Array
(
[0] => Array
(
)
[1] => Array
(
)
[0_attr] => Array
(
[FieldId] => 2
[Value] => F3Name
)
[1_attr] => Array
(
[FieldId] => 3
[Value] => L3Name
)
[2] => Array
(
)
[2_attr] => Array
(
[FieldId] => 4
[Value] => [email protected]
)
[3] => Array
(
)
[3_attr] => Array
(
[FieldId] => -9999999
[Value] => 333333333
)
)
)
)
)
)
)