当我将XML传递给未进一步指定的XML时,从远程获得错误消息.用.net和PHP编写的web服务


Getting an error message from remote as I pass XML to a not further specified XML Customer prefix="ECON" web service written in some .Net with PHP

我正在尝试访问web服务上的一个方法,当提交以下格式的XML文档时,该方法应该返回'客户ID':

<?xml version="1.0"?>
<Customers>
  <Customer prefix="ECON">
    <Property Name="First Name" Value="test"/>
    <Property Name="Surname" Value="user"/>
    <Property Name="Company" Value="company"/>
    <Property Name="Telephone" Value="123456"/>
  </Customer>
</Customers>

我正在创建这样的XML文档:

    try {
      // a new dom object, make tidy // 
        $dom = new domDocument; 
        $dom->formatOutput = true;
      // create the root and simple xml elements // 
        $root = $dom->appendChild($dom->createElement( "Customers" ));
        $sxe = simplexml_import_dom( $dom );
      // add the customer node with prefix //
        $customer = $sxe->addchild("Customer");
        $customer->addAttribute("prefix", "ECON");
      // add first name element //
        $firstname = $customer->addChild("Property");
        $firstname->addAttribute("Name", "Title");
        $firstname->addAttribute("Value", $first_name);
      // add surname element //
        $surname = $customer->addChild("Property");
        $surname->addAttribute("Name", "Surname");
        $surname->addAttribute("Value", $last_name);
      // add company element //
        $company = $customer->addChild("Property");
        $company->addAttribute("Name", "Postcode");
        $company->addAttribute("Value", $company_name);
      // add telephone element //
        $phone = $customer->addChild("Property");
        $phone->addAttribute("Name", "Telephone");
        $phone->addAttribute("Value", $telephone);
} 
catch( Exception $e ) 
{ 
    echo $e->getMessage(); 
}

并将其提交给方法,使用前一个方法的认证,如下所示:

$result = $client2->call('InsertCustomer', array('AuthenticationString' => $authenticate['AuthenticateUserResult'], 'Customers' => $sxe->asXML()));

但是它一直抛出可怕的"对象引用未设置为对象的实例"错误,我想我需要提交不同的XML来说明服务是基于。net的,但没有多少谷歌搜索指向正确的方向。有人能帮忙吗?

这是一个简单的XML属性用错大小写的例子,我没有意识到这对。net有多重要,因为我习惯了经常原谅的PHP。

如果你正在编写与。net或ASP通信的PHP脚本,请确保检查所有的资本化,如果你遇到了一个没有意义的问题