dsh8009271 2013-05-07 10:09
浏览 97

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

I'm having a problem with a soapclient call. The soaprequest has to look like:

      <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>

My soap_param is:

$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)));

The soapcall appears to work, however.... I only reveive the last engineOptions element. According to the xsd the element engineOptions can appear multiple times(0 to unbounded). Witin the soapcall this element seems to be overwritten. The index: engineOptions isn't unique.

I can't imagine that i am the only one facing this problem. I hope that there is a (simple) solution for this problem.

  • 写回答

1条回答 默认 最新

  • duanjiaren8188 2013-05-07 13:35
    关注

    With special thanks to: András Szepesházi. The following $soap_param definition:

    $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
            )
        )
    );
    

    Is able to create the following SOAP Request:

        <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>
    

    So problem solved.

    评论

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错