zenag Posted May 16, 2012 Share Posted May 16, 2012 Hi I am trying to retrieve soap response as xml string. I have tried to parse the soap response xml string using simplexml. I am getting the error XML Parsing Error: junk after document element Here is my response. I have a problem in this response as you can see <br /> tag get added to the last of this xml string. I haver tried to remove using str_replace but with no luck. <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882' xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882' xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'> <rs:data ItemCount="4"> <z:row ows_Attachments='0' ows_LinkTitle='test' ows_Name='test' ows_Email='[email protected]' ows_MetaInfo='1;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='test' ows_ID='1' ows_owshiddenversion='2' ows_UniqueId='1;#{B6AEA147-BD2F-4157-8F46-57B86277EAA5}' ows_FSObjType='1;#0' ows_Created_x0020_Date='1;#2012-05-15 12:09:57' ows_Created='2012-05-15 12:09:57' ows_FileLeafRef='1;#1_.000' ows_FileRef='1;#Lists/CustomerInfo/1_.000' /> <z:row ows_Attachments='0' ows_LinkTitle='Test2' ows_Name='test' ows_MetaInfo='2;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='Test2' ows_ID='2' ows_owshiddenversion='1' ows_UniqueId='2;#{4EC49195-F4D6-483F-B762-0F1DEEDBF2E5}' ows_FSObjType='2;#0' ows_Created_x0020_Date='2;#2012-05-15 12:11:00' ows_Created='2012-05-15 12:11:00' ows_FileLeafRef='2;#2_.000' ows_FileRef='2;#Lists/CustomerInfo/2_.000' /> <z:row ows_Attachments='0' ows_LinkTitle='My Title' ows_MetaInfo='3;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='My Title' ows_ID='3' ows_owshiddenversion='1' ows_UniqueId='3;#{E4E5854A-2263-45D0-85D1-02AD65B6006E}' ows_FSObjType='3;#0' ows_Created_x0020_Date='3;#2012-05-15 15:49:58' ows_Created='2012-05-15 15:49:58' ows_FileLeafRef='3;#3_.000' ows_FileRef='3;#Lists/CustomerInfo/3_.000' /> <z:row ows_Attachments='0' ows_LinkTitle='My Title' ows_MetaInfo='4;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='My Title' ows_ID='4' ows_owshiddenversion='1' ows_UniqueId='4;#{59C287EA-F92E-4F57-80A7-30E453124DD8}' ows_FSObjType='4;#0' ows_Created_x0020_Date='4;#2012-05-15 15:50:50' ows_Created='2012-05-15 15:50:50' ows_FileLeafRef='4;#4_.000' ows_FileRef='4;#Lists/CustomerInfo/4_.000' /> </rs:data> </listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope><br /> Quote Link to comment https://forums.phpfreaks.com/topic/262592-unformatted-soap-responsexml-parsing-error/ Share on other sites More sharing options...
silkfire Posted May 16, 2012 Share Posted May 16, 2012 Try cutting of the last 6 chars: $string = substr($string, 0, -6); Quote Link to comment https://forums.phpfreaks.com/topic/262592-unformatted-soap-responsexml-parsing-error/#findComment-1345861 Share on other sites More sharing options...
zenag Posted May 16, 2012 Author Share Posted May 16, 2012 Thank you . how to parse this soap response .any help please. <soap:Envelope> − <soap:Body> − <GetListItemsResponse> − <GetListItemsResult> − <listitems> − <rs:data ItemCount="4"> <z:row ows_Attachments="0" ows_LinkTitle="test" ows_Name="test" ows_Email="[email protected]" ows_MetaInfo="1;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="test" ows_ID="1" ows_owshiddenversion="2" ows_UniqueId="1;#{B6AEA147-BD2F-4157-8F46-57B86277EAA5}" ows_FSObjType="1;#0" ows_Created_x0020_Date="1;#2012-05-15 12:09:57" ows_Created="2012-05-15 12:09:57" ows_FileLeafRef="1;#1_.000" ows_FileRef="1;#Lists/CustomerInfo/1_.000"/> <z:row ows_Attachments="0" ows_LinkTitle="Test2" ows_Name="test" ows_MetaInfo="2;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="Test2" ows_ID="2" ows_owshiddenversion="1" ows_UniqueId="2;#{4EC49195-F4D6-483F-B762-0F1DEEDBF2E5}" ows_FSObjType="2;#0" ows_Created_x0020_Date="2;#2012-05-15 12:11:00" ows_Created="2012-05-15 12:11:00" ows_FileLeafRef="2;#2_.000" ows_FileRef="2;#Lists/CustomerInfo/2_.000"/> <z:row ows_Attachments="0" ows_LinkTitle="My Title" ows_MetaInfo="3;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="My Title" ows_ID="3" ows_owshiddenversion="1" ows_UniqueId="3;#{E4E5854A-2263-45D0-85D1-02AD65B6006E}" ows_FSObjType="3;#0" ows_Created_x0020_Date="3;#2012-05-15 15:49:58" ows_Created="2012-05-15 15:49:58" ows_FileLeafRef="3;#3_.000" ows_FileRef="3;#Lists/CustomerInfo/3_.000"/> <z:row ows_Attachments="0" ows_LinkTitle="My Title" ows_MetaInfo="4;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="My Title" ows_ID="4" ows_owshiddenversion="1" ows_UniqueId="4;#{59C287EA-F92E-4F57-80A7-30E453124DD8}" ows_FSObjType="4;#0" ows_Created_x0020_Date="4;#2012-05-15 15:50:50" ows_Created="2012-05-15 15:50:50" ows_FileLeafRef="4;#4_.000" ows_FileRef="4;#Lists/CustomerInfo/4_.000"/> </rs:data> </listitems> </GetListItemsResult> </GetListItemsResponse> </soap:Body> </soap:Envelope> Quote Link to comment https://forums.phpfreaks.com/topic/262592-unformatted-soap-responsexml-parsing-error/#findComment-1345870 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.