Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 简单xml加载字符串和xml属性类型_Php_Xml_Soap - Fatal编程技术网

Php 简单xml加载字符串和xml属性类型

Php 简单xml加载字符串和xml属性类型,php,xml,soap,Php,Xml,Soap,我目前正在使用一个API,它在请求中接受XML,但是该XML的属性必须使用特定的格式string、int、boolean、dateTime等。我的XML示例如下: <Property> <Address> <AddressLine1>str1234</AddressLine1> <AddressLine2>str1234</AddressLine2> <Addre

我目前正在使用一个API,它在请求中接受XML,但是该XML的属性必须使用特定的格式string、int、boolean、dateTime等。我的XML示例如下:

<Property>
    <Address>
        <AddressLine1>str1234</AddressLine1>
        <AddressLine2>str1234</AddressLine2>
        <AddressLine3>str1234</AddressLine3>
        <AddressLine4>str1234</AddressLine4>
        <PostCode>po75xa</PostCode>
        <RoyalMailReference>str1234</RoyalMailReference>
    </Address>
    <PropertyType>DetachedHouse</PropertyType>
    <NumberOfBedrooms>3</NumberOfBedrooms>
    <YearBuilt>1970</YearBuilt>
</Property>

然后,我通过SOAP将请求发送到API,我得到的请求显示实际发送的eve显示每个属性都是字符串。如何定义每个属性的类型?或者simplexml\u load\u string会将所有内容转换为字符串吗?

您的SoapClient::\u soapCall方法调用看起来如何?$response=$quote\u soap->调用'GetComparisonSchemaBound',数组'parameters'=>$xml,$service,$action;不能将XML对象作为参数传递。您必须传递一个包含标量数据的paramName=>value数组。因此,我需要将XML转换为数组,并将字符串从XML转换为SOAP服务器所需的数据类型。例如,numberofbeddooms到int。
$xml = simplexml_load_string( View::make('samplerequest') );