2012-06-12 46 views
0

我试图创建一个SOAP请求,将在部分具备以下条件:PHP SOAP客户端的请求元素

<com:locale language="?" country="?"> 
        <com:descriptions> 

         <com:description type="?">This is a description</com:description> 
        </com:descriptions> 
        <com:marketingDescription>This is a marketing des</com:marketingDescription> 

我能够就好使用以下添加的属性:

function buildTask($db, $id=1) { 
$task = array(
    'id' => $id++, 
    'insertCustomProduct' => array(
            'manufacturerId' => "1234567", 
            'manufacturerPartNo' => "ABC12345", 

            'categoryId' => 10000000, 
            'categoryType' => 'default', 
            'skus' => array(
                'sku' => array(
                    'type' => 'Internal', 
                    'number' => "123456ff", 
                    ), 
                ), 
            'locales' => array(
                'locale' => array(
                    'language' => 'EN', 
                    'country' => 'US', 
                    'descriptions' => array(
                          'description' => array("type"=>1, 
                                "CustomDescription"=>"This is a test") 
                        ), 
      'marketingDescription' => "This is the test Marketing Text", 
     ), 
    ), 
    ) 
); 

我遇到了传递非属性值(如实际说明和营销文本)的问题

我将不胜感激任何帮助

回答

0

少量记录的“_”数组键可以为您提供部分XML的价值(可在here的评论中找到,并在SO here上提及)。在你的榜样东西沿着这些路线 - 未经测试的课程:

function buildTask($db, $id=1) { 
$task = array(
    'id' => $id++, 
    'insertCustomProduct' => array(
     'manufacturerId' => "1234567", 
     'manufacturerPartNo' => "ABC12345", 
     'categoryId' => 10000000, 
     'categoryType' => 'default', 
     'skus' => array(
      'sku' => array(
       'type' => 'Internal', 
       'number' => "123456ff", 
       ), 
      ), 
     'locales' => array(
       'locale' => array(
       'language' => 'EN', 
       'country' => 'US', 
       'descriptions' => array(
        'description' => array("type"=>1, 
            "_"=>"This is a test") 
              ), 
       'marketingDescription' => array("_" => "This is the test Marketing Text"), 
      ), 
     ), 
    ) 
); 
+0

我已经试过这一点 - 但它似乎并没有在所有 '“描述” =>阵列( “描述” =>阵列工作( '_'=>'test Desc', 'type'=>'11') ), 'marketingDescription'=> array('_'=>“这是测试营销文本”)' –

+0

也许一些更多有关如何构建SOAP请求的信息将有所帮助?你在使用SoapClient吗?是否有WSDL? –

+0

是的我正在使用SOAP客户端以及wsdl - 除了这一点,我能够让其他所有工作都能够正常工作 - XML属性生成良好 - 这只是我遇到问题时的非属性值 –