如何将此XML值编码为PHP文本?
在WS-Development的上下文中,我使用以下模式:如何将此XML值编码为PHP文本?,php,xml,web-services,wsdl,Php,Xml,Web Services,Wsdl,在WS-Development的上下文中,我使用以下模式: <xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Apporteurs"> <xs:complexType name="namedValue_t"> <xs:simpleContent> <xs:extension base="xs:string"> &l
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Apporteurs">
<xs:complexType name="namedValue_t">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="Prospect">
<xs:sequence>
<xs:element name="values" type="namedValue_t" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="origine" type="xs:string" />
<xs:attribute name="prenom" type="xs:string" />
<xs:attribute name="nom" type="xs:string" />
<xs:attribute name="departement" type="xs:int" />
</xs:complexType>
</xs:schema>
注释最后两行时,请求成功执行。由于,WS-Client变成:
<?php
ini_set( 'soap.wsdl_cache_enabled', '0' );
ini_set( 'display_errors' , '1' );
$prospect = array(
'origine' => 'test-origine',
'prenom' => 'test prenom',
'nom' => 'test nom',
'departement' => 33,
'values' => array(
(object)array( 'name' => 'prenom', 'value' => 'Aubin' ),
(object)array( 'name' => 'nom' , 'value' => 'MAHE' ),
)
);
$lfinance = new SoapClient( 'http://xxxxxxxxxxxxx/Apporteurs.wsdl' );
$lfinance->AjouterUnProspect( $prospect );
?>
$prospect = array(
'origine' => 'test-origine',
'prenom' => 'Aubin',
'nom' => 'MAHE',
'departement' => 33,
'values' => array());
$prospect['values'][] = array( 'name' => 'Prénom', 'value' => 'Aubin' );
$prospect['values'][] = array( 'name' => 'Nom' , 'value' => 'MAHE' );
<?php
ini_set( 'soap.wsdl_cache_enabled', '0' );
ini_set( 'display_errors' , '1' );
$prospect = array(
'origine' => 'test-origine',
'prenom' => 'test prenom',
'nom' => 'test nom',
'departement' => 33,
'values' => array(
(object)array( 'name' => 'prenom', 'value' => 'Aubin' ),
(object)array( 'name' => 'nom' , 'value' => 'MAHE' ),
)
);
$lfinance = new SoapClient( 'http://xxxxxxxxxxxxx/Apporteurs.wsdl' );
$lfinance->AjouterUnProspect( $prospect );
?>