[英]webservice : convert xml to php array
使用 SoapUI,我從我的 webService 得到了正確的響應。 但是,當我從 php 嘗試時出現異常
這是我的代碼:
$mysoap = new SoapClient($wsdlFile,array('trace' => 1));
$result = $mysoap->__call("Myfunction", array("parameters" => array('Entry' => $Entry,'Parm' => $data)));
這是我的 $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>]]>'
)
)
);
我怎么能在 php 上轉換 'InfoValue' 。
這是 infoValue 請求,
<ns3:Info> <ns3:InfoNom>CLIENT_LAYOUT</ns3:InfoNom> <ns3:InfoValue> <![CDATA[ <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"> <cartSessionSettings> <operationType>createCart</operationType> <lazyLoading>YES</lazyLoading> <cartDomainId>-</cartDomainId> <cartId>CATALOGUE_EN_LIGNE</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> <userName>The administrator</userName> <ownerGroup>SalesRep</ownerGroup> <ownerId>admin</ownerId> <ownerName>The administrator</ownerName> <applyDate>20161129 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>]]></ns3:InfoValeur>
infoValue 在沒有轉義的 xml 代碼的情況下被替換
非常感謝最后它的工作我剛剛刪除,用於轉義的xml。 祝你今天過得愉快
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.