PHP SoapClient:在soapcall中覆盖多个复杂类型

时间:2013-05-07 10:09:50

标签: php soap-client complextype

我遇到了soapclient电话的问题。 soaprequest必须看起来像:

      <eng:Compose>
     <!--Optional:-->
     <EWSComposeRequest>
        <!--Optional:-->
        <driver>
           <!--Optional:-->
           <driver>base64</driver>
           <!--Optional:-->
           <fileName>INPUT</fileName>
        </driver>
         <engineOptions>   
            <name>FILEMAP</name>
            <value>DLFOUT.dlf,dummy.dlf</value>
         </engineOptions>
         <engineOptions>
            <name>FILEMAP</name>
            <value>PDFOUT.pdf,dummy.pdf</value>     
         </engineOptions>
         <engineOptions>
            <name>RUNMODE</name>
        <value>PRODUCTION</value>           
        </engineOptions>
        <!--Optional:-->
        <fileReturnRegEx>^.*.(dlf|pdf)$</fileReturnRegEx>
        <includeHeader>True</includeHeader>
        <includeMessageFile>True</includeMessageFile>
        <!--Optional:-->
        <pubFile>TestLive.pub</pubFile>
     </EWSComposeRequest>
  </eng:Compose>

我的soap_param是:

$soap_param = array("Compose"=> array("EWSComposeRequest" => 
        array( "driver" => array( "driver" => $post_Driver, 
        "fileName" => $post_FileName), 
        "engineOptions" => array( "name" => "KEY", "value" => $INI['encodedkey']),
        "engineOptions" => array( "name" => "RUNMODE", "value" => $INI['runmode']), 
        "fileReturnRegEx" => $post_FileReturnRegEx, "includeHeader" => $post_IncludeHeader,
        "includeMessageFile" => $post_IncludeMessage, "pubFile" => $post_PubFile)));

soapcall似乎有效,但是......我只会看到最后一个engineOptions元素。 根据xsd,元素engineOptions可以多次出现(0到无界)。在肥皂调用中,这个元素似乎被覆盖了。索引:engineOptions不是唯一的。

我无法想象我是唯一一个面临这个问题的人。我希望有一个(简单)解决这个问题的方法。

1 个答案:

答案 0 :(得分:0)

特别感谢:AndrásSzepesházi。以下$soap_param定义:

$soap_param => array(
    'Compose' => array(
        'EWSComposeRequest' => array(
            'driver' => array( 
                'driver' => $post_Driver, 
                'fileName' => $post_FileName
            ),
            'engineOptions' => array(
                array(
                    'name' => 'KEY', 
                    'value' => $INI['encodedkey']
                ), 
                array(                     
                    'name' => 'RUNMODE', 
                    'value' => $INI['runmode']
                ), 
                array(
                    'name' => 'FILEMAP', 
                    'value' => "DLFOUT.dlf,dummy.dlf"
                ), 
                array(
                    'name' => 'FILEMAP',
                    'value' => "PDFOUT.pdf,dummy.pdf"
                ),
            ),
            'fileReturnRegEx' => $post_fileReturnPattern, 
            'includeHeader' => $post_IncludeHeader, 
            'includeMessageFile' => $post_IncludeMessage, 
            'pubFile' => $post_PubFile
        )
    )
);

能够创建以下SOAP请求:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:hpexstream-services/Engine">
    <SOAP-ENV:Header>
        <ns1:n>n</ns1:n>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:Compose>
            <EWSComposeRequest>
                <driver>
                    <driver>base64</driver>
                    <fileName>INPUT</fileName>
                </driver>
                <engineOptions>
                    <name>KEY</name>
                    <value>base64</value>
                </engineOptions>
                <engineOptions>
                    <name>RUNMODE</name>
                    <value>PRODUCTION</value>
                </engineOptions>
                <engineOptions>
                    <name>FILEMAP</name>
                    <value>DLFOUT.dlf,dummy.dlf</value>
                </engineOptions>
                <engineOptions>
                    <name>FILEMAP</name>
                    <value>PDFOUT.pdf,dummy.pdf</value>
                </engineOptions>
                <includeHeader>true</includeHeader>
                <includeMessageFile>true</includeMessageFile>
                <pubFile>TestLive.pub</pubFile>
            </EWSComposeRequest>
        </ns1:Compose>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

问题解决了。