我一直在尝试将一些XML内容发布到WSDL URL。当我尝试发布内容时,我收到以下错误(SOAP-ERROR:编码:对象没有'core_submission'属性)。在下面的XML内容中,核心提交区域中有内容。如果有人能够帮助我解决这个问题,我将不胜感激。
<?php
$post_string = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:roof="http://www.energystar.gov/schema/Roof_Products_2_x/" xmlns:core="http://www.energystar.gov/schema/core/">
<soapenv:Body>
<roof:Roof_Products_submission>
<core_submission>
<core:Authentication_UserName>xx</core:Authentication_UserName>
<core:Authentication_Password>xx</core:Authentication_Password>
<core:Certification_Body_EPA_Issued_Organization_Id>xx</core:Certification_Body_EPA_Issued_Organization_Id>
<core:Is_Test_Submission>Yes</core:Is_Test_Submission>
</core_submission>
<roof:Roof_Products>
<core:core_product_data>
<core:ENERGY_STAR_Manufacturing_Partner>QPX Active Partner</core:ENERGY_STAR_Manufacturing_Partner>
<core:ENERGY_STAR_Manufacturing_Partner_s_EPA_issued_Organization_ID>xx</core:ENERGY_STAR_Manufacturing_Partner_s_EPA_issued_Organization_ID>
<core:Partner_Contact_Name_For_This_Model>Benny</core:Partner_Contact_Name_For_This_Model>
<core:Type_of_Transaction>Initial Certification</core:Type_of_Transaction>
<core:Reason_for_Transaction>Initial Certification: Model Meets ENERGY STAR Requirements</core:Reason_for_Transaction>
<core:Date_of_Transaction_Type>2010-12-31</core:Date_of_Transaction_Type>
<core:ENERGY_STAR_Model_Identifier>TestID2929</core:ENERGY_STAR_Model_Identifier>
<core:Certification_ID>TestCertID123</core:Certification_ID>
<core:Family_ID>TestFamID123</core:Family_ID>
<core:Model_Name>Model_Name1234</core:Model_Name>
<core:Model_Number>Model_Number33453</core:Model_Number>
<core:Brand_Name>Brand_Name1</core:Brand_Name>
<core:Tested_Model_Name>Tested_Model_Name1</core:Tested_Model_Name>
<core:Tested_Model_Number>Tested_Model_Number1</core:Tested_Model_Number>
<core:Additional_Models_Represented_by_Family_Series_or_DOE_Basic>
<core:Additional_Model_Name>test</core:Additional_Model_Name>
<core:Additional_Model_Number>12345</core:Additional_Model_Number>
<core:Additional_Identifying_Information>non</core:Additional_Identifying_Information>
</core:Additional_Models_Represented_by_Family_Series_or_DOE_Basic>
<core:Is_the_Partner_Listed_the_Original_Equipment_Manufacturer_OEM>Yes</core:Is_the_Partner_Listed_the_Original_Equipment_Manufacturer_OEM>
<core:If_the_Partner_is_Not_the_Original_Equipment_Manufacturer_Who_is>test</core:If_the_Partner_is_Not_the_Original_Equipment_Manufacturer_Who_is>
<core:Currently_Available_on_Market>Yes</core:Currently_Available_on_Market>
<core:Date_Available_On_Market>2010-12-31</core:Date_Available_On_Market>
<core:Date_Tested>2010-12-31</core:Date_Tested>
<core:Date_CB_Notified_Partner_of_Model_Qualification>2010-12-31</core:Date_CB_Notified_Partner_of_Model_Qualification>
<core:Certification_Body_Contact_Name_for_This_Model>QPX Certification Body 1</core:Certification_Body_Contact_Name_for_This_Model>
<core:Laboratory>
<core:Laboratory_EPA_issued_Organization_ID>1114629</core:Laboratory_EPA_issued_Organization_ID>
<core:Laboratory_Contact_for_This_Model>QPX Laboratory Test</core:Laboratory_Contact_for_This_Model>
</core:Laboratory>
<core:To_What_Major_Markets_is_This_Model_Sold>United States</core:To_What_Major_Markets_is_This_Model_Sold>
<core:Notes>notes on the product</core:Notes>
</core:core_product_data>
<roof:ENERGY_STAR_Specification_Version>2.2</roof:ENERGY_STAR_Specification_Version>
<roof:Product_Type>Single-Ply</roof:Product_Type>
<roof:Measured_Initial_Solar_Reflectance>0.25</roof:Measured_Initial_Solar_Reflectance>
<roof:Reported_Initial_Solar_Reflectance>0.26</roof:Reported_Initial_Solar_Reflectance>
<roof:Initial_Solar_Reflectance_Test_Method>ASTM E903-96</roof:Initial_Solar_Reflectance_Test_Method>
<roof:Measured_Solar_Reflectance_After_Three_Years>0.15</roof:Measured_Solar_Reflectance_After_Three_Years>
<roof:Reported_Reflectance_After_Three_Years>0.16</roof:Reported_Reflectance_After_Three_Years>
<roof:Solar_Reflectance_After_Three_Years_Test_Method>ASTM C1549-09</roof:Solar_Reflectance_After_Three_Years_Test_Method>
<roof:Measured_Initial_Emissivity>0.01</roof:Measured_Initial_Emissivity>
<roof:Reported_Initial_Emissivity>0.02</roof:Reported_Initial_Emissivity>
<roof:Initial_Emissivity_Test_Method_Used>ASTM E408-71(1996) e1</roof:Initial_Emissivity_Test_Method_Used>
<roof:Low_Slope>Yes</roof:Low_Slope>
<roof:Steep_Slope>Yes</roof:Steep_Slope>
<roof:Roof_Cleaned_Prior_to_Third_Year_Test>No</roof:Roof_Cleaned_Prior_to_Third_Year_Test>
<roof:Warranty_Period>abcdefg</roof:Warranty_Period>
</roof:Roof_Products>
</roof:Roof_Products_submission>
</soapenv:Body>
</soapenv:Envelope>';
$url = "https://esws.energystar.gov:443/DataServices/servlet/webservices?ver=1.1";
$client = new SoapClient($url,
array(
'trace' => 1,
'exceptions' => 1,
'soap_version' => SOAP_1_1,
'encoding' => 'utf-8',
'features' => SOAP_SINGLE_ELEMENT_ARRAYS
)
);
$xmlvar = new SoapVar(
'<ns1:xmlDocument>'.$post_string.'</ns1:xmlDocument>',
XSD_ANYXML
);
try
{
$params->post_string = (object)$xmlvar;
$save_result = $client->Submit_Roof_Products_2_x($params);
echo "<pre>\n\n";
echo "Result1 :\n";
var_dump($save_result);
echo "</pre>";
}
catch (SoapFault $e)
{
echo "SOAP Fault: ".$e->getMessage()."<br />\n";
}
echo "<pre>\n\n";
echo "Request2 :\n";
echo htmlspecialchars($soap->__getLastRequest())."\n";
echo "</pre>";
?>
答案 0 :(得分:0)
看起来core_submission属性需要在Roof_products_submission标记之外。请参阅此处以获取有关如何实施的一个很好的示例:
希望有所帮助。