webservice:将xml转换为php数组

时间:2017-01-22 14:35:03

标签: php xml web-services soap

使用SoapUI,我的webService获得了正确的响应。 但是当我从php

尝试它时,我有一个异常

这是我的代码:

$mysoap = new SoapClient($wsdlFile,array('trace' => 1));

$result = $mysoap->__call("Myfunction", array("parameters" => array('Entry' => $Entry,'Parm' => $data)));

我的$数据不正确(InfoValue)

$data   = array('appName' => 'Globe',
                'exitUrl' => '' ,
                'redirectError' => '',
                'sessionId' => '' ,
                'addInfo' => array(
                    'Info'=> array(
                            'InfoName' => 'CLIENT_LAYOUT',
                            'InfoValue' => '
                                    <![CDATA[
                                    <cartSession xmlns:ns2="com.camel.business.xml.settingsTree-7.1.0.0" xmlns:ns4="com.camel.business.xml.cameleonTree-7.2.0.0" xmlns:ns3="com.camel.business.xml.configurationTree-7.1.0.0">
                                       <cartSessionSettings>
                                          <operationType>createCart</operationType> 
                                          <lazyLoading>YES</lazyLoading>
                                          <cartDomainId>-</cartDomainId>
                                          <cartId>CATALOGUE_ON_LINE</cartId>
                                          <cartRelease>1</cartRelease> 
                                          <modelName>Default</modelName>
                                          <modelRelease>1</modelRelease>
                                          <layout>cpqUI</layout> 
                                          <language>FR</language>
                                          <currency>EUR</currency>
                                          <targetURL>/cartApp.do</targetURL> 
                                          <redirectModeOnClose>inside</redirectModeOnClose> 
                                          <userGroup>SalesRep</userGroup> 
                                          <userId>admin</userId> 
                                          <admin</userName> 
                                          <ownerGroup>SalesRep</ownerGroup>
                                          <ownerId>admin</ownerId> 
                                          <ownerName>admin</ownerName> 
                                          <applyDate>20161020 120000</applyDate> 
                                          <initAction name="CatalogList">
                                             <param id="catalogServiceNames" value="CATALOGUE_PRODUITS"/> 
                                          </initAction>
                                       </cartSessionSettings>
                                       <customSettings>
                                       </customSettings>
                                       <connectorsData>
                                          <services>
                                             <service id="CATALOGUE_PRODUITS" type="edgeConfigurator"> 
                                                <param id="CPE.Settings.Session.ModelVersion" value=""/>
                                             </service>
                                          </services>
                                       </connectorsData>
                                    </cartSession>]]>'
                    )
                )
        );

我如何转换&#39; InfoValue&#39;在php。

这是infoValue请求,

 <ns3:Info> <ns3:InfoNom>CLIENT_LAYOUT</ns3:InfoNom> <ns3:InfoValue>&#13; &lt;![CDATA[&#13; &lt;cartSession xmlns:ns2="com.camel.business.xml.settingsTree-7.1.0.0" xmlns:ns4="com.camel.business.xml.camelTree-7.2.0.0" xmlns:ns3="com.camel.business.xml.configurationTree-7.1.0.0"&gt;&#13; &lt;cartSessionSettings&gt;&#13; &lt;operationType&gt;createCart&lt;/operationType&gt; &#13; &lt;lazyLoading&gt;YES&lt;/lazyLoading&gt;&#13; &lt;cartDomainId&gt;-&lt;/cartDomainId&gt;&#13; &lt;cartId&gt;CATALOGUE_EN_LIGNE&lt;/cartId&gt;&#13; &lt;cartRelease&gt;1&lt;/cartRelease&gt; &#13; &lt;modelName&gt;Default&lt;/modelName&gt;&#13; &lt;modelRelease&gt;1&lt;/modelRelease&gt;&#13; &lt;layout&gt;cpqUI&lt;/layout&gt; &#13; &lt;language&gt;FR&lt;/language&gt;&#13; &lt;currency&gt;EUR&lt;/currency&gt;&#13; &lt;targetURL&gt;/cartApp.do&lt;/targetURL&gt; &#13; &lt;redirectModeOnClose&gt;inside&lt;/redirectModeOnClose&gt; &#13; &lt;userGroup&gt;SalesRep&lt;/userGroup&gt; &#13; &lt;userId&gt;admin&lt;/userId&gt; &#13; &lt;userName&gt;The administrator&lt;/userName&gt; &#13; &lt;ownerGroup&gt;SalesRep&lt;/ownerGroup&gt;&#13; &lt;ownerId&gt;admin&lt;/ownerId&gt; &#13; &lt;ownerName&gt;The administrator&lt;/ownerName&gt; &#13; &lt;applyDate&gt;20161129 120000&lt;/applyDate&gt; &#13; &lt;initAction name="CatalogList"&gt;&#13; &lt;param id="catalogServiceNames" value="CATALOGUE_PRODUITS"/&gt; &#13; &lt;/initAction&gt;&#13; &lt;/cartSessionSettings&gt;&#13; &lt;customSettings&gt;&#13; &lt;/customSettings&gt;&#13; &lt;connectorsData&gt;&#13; &lt;services&gt;&#13; &lt;service id="CATALOGUE_PRODUITS" type="edgeConfigurator"&gt; &#13; &lt;param id="CPE.Settings.Session.ModelVersion" value=""/&gt;&#13; &lt;/service&gt;&#13; &lt;/services&gt;&#13; &lt;/connectorsData&gt;&#13; &lt;/cartSession&gt;]]&gt;</ns3:InfoValeur>

infoValue是在没有转义的xml代码的情况下重新播放的

1 个答案:

答案 0 :(得分:0)

非常感谢 最后它的工作 我刚删除,用于转义的xml。 祝你有愉快的一天