473,608 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to parse XML from PHP

132 New Member
I was not able to find same problem,Ihave Issue below.The Target is to show xml attributes values using soap message.PHP code looks like:
Expand|Select|Wrap|Line Numbers
  1.  $client = new SoapClient("https://domain.com/xml/listener.asmx?WSDL");
  2. $Getresults = $client->GetFab(array('Username' => "anyuser", 'Password' => "anypassword", 'code' => "1108324"));
  3. print_r($Getresults);
The XML I get from SOAP UI using same request has different structure:
Expand|Select|Wrap|Line Numbers
  1. <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">GetJobResponse xmlns="http://www....>
  2. <GetJobResult>
  3.             <Number>79593</JobNumber>
  4.             <Status>INVOICED</JobStatus>
  5.             <Code>CB0071</ThirdPartyCode>
I get Warning: simplexml_load_ string() expects parameter 1 to be string, object given in.?
Expand|Select|Wrap|Line Numbers
  1. <pre class='xdebug-var-dump' dir='ltr'>
  2. <b>object</b>(<i>stdClass</i>)[<i>94</i>]
  3.   <i>public</i> 'JobNumber' <font color='#888a85'>=&gt;</font> <small>int</small> <font color='#4e9a06'>79593</font>
  4.   <i>public</i> 'JobStatus' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'INVOICED'</font> <i>(length=8)</i>
  5.   <i>public</i> 'ThirdPartyCode' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'CB0071'</font> <i>(length=6)</i>
  6.   <i>public</i> 'CustomerName' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'BECK CRESPEL'</font> <i>(length=12)</i>
  7.   <i>public</i> 'CustomerName_' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i>
  8.   <i>public</i> 'Reference' <font color='#888a85'>=&gt;</font> <small>int</small> <font color='#4e9a06'>1169910</font>
  9.   <i>public</i> 'ContactSeq' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'106798'</font> <i>(length=6)</i>
  10.   <i>public</i> 'Date' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'2015-04-08T00:00:00'</font> <i>(length=19)</i>
  11.   <i>public</i> 'DateCompleted' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'0001-01-01T00:00:00'</font> <i>(length=19)</i>
  12.   <i>public</i> 'Title' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'E : LIVRET D ACCUEIL - WIREO - 70 PAGES (35 FEUILLETS) - 21 X 14.8 CM - Q RV'</font> <i>(length=76)</i>
  13.   <i>public</i> 'Quantity' <font color='#888a85'>=&gt;</font> <small>int</small> <font color='#4e9a06'>200</font>
  14.   <i>public</i> 'Product' <font color='#888a85'>=&gt;</font> 
Thanks for you help
Jun 4 '15 #1
26 2556
Dormilich
8,658 Recognized Expert Moderator Expert
your soap call does not return you an XML but an already parsed result object. SOAP would be quite pointless if you had to parse the XML each time yourself.
Jun 5 '15 #2
manjava
132 New Member
Thanks how can i resolve this issue

Thanks in advance
Jun 5 '15 #3
Dormilich
8,658 Recognized Expert Moderator Expert
just use the object you get. it holds the same information as the XML.
Jun 5 '15 #4
manjava
132 New Member
i don't know how can i do with simple xml i do that
Expand|Select|Wrap|Line Numbers
  1. $xml=simple_load_string($GetJobresult);
i have this warning simple_load_str ing() expects parameter 1 to be string ,object given

Thanks for you help
Jun 5 '15 #5
Dormilich
8,658 Recognized Expert Moderator Expert
scrap that line, you don’t need it.
Jun 5 '15 #6
manjava
132 New Member
so please can you tell by code what i put because i need parse with simple xml

Thanks in advance
Jun 5 '15 #7
Dormilich
8,658 Recognized Expert Moderator Expert
i need parse with simple xml
no you don’t.
Jun 5 '15 #8
manjava
132 New Member
i am not understand please can you tell me what can i do so if possible by code script

Thanks in advance
Jun 5 '15 #9
Dormilich
8,658 Recognized Expert Moderator Expert
here’s the code:
Expand|Select|Wrap|Line Numbers
  1. $Getresults = $client->GetFab(array('Username' => "anyuser", 'Password' => "anypassword", 'code' => "1108324"));
  2.  
  3. $JobNumber = $Getresults->JobNumber;
  4.  
Jun 5 '15 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

23
2565
by: Charles Law | last post by:
Does anyone have a regex pattern to parse HTML from a stream? I have a well structured file, where each line is of the form <sometag someattribute='attr'>text</sometag> for example <SPAN CLASS='myclass'>A bit of text</SPAN>, or Just some text, without tags
4
2551
by: Chris Bower | last post by:
Reposted from aspnet.buildingcontrols: Ok, I've got a bunch of derived controls that all have a property Rights of type Rights (Rights is an Enumerator). I wrote a custom TypeConverter so that I can use comma separated values in design-time. The TypeConverter works great in design-time. It converts to and from just fine... However, when I try to load any page in the site now I get the following error (Following the error is code for the...
29
2882
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
0
789
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
3
14049
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
1
5528
by: sandeepsangshetty | last post by:
Hi Friends, I'm unable find check box control in my webpage. When building the page I'm getting "checkbox null" and "false". Can any help me to find the solution. I'm pasting the code here. ------------------------------------------------------------------------------- _BigCart.ascx
4
11838
by: JJMcClaw | last post by:
Hi All, Wonder if anyone can shed any light on this error I am getting. I have the following error when trying to access my site: "Parse error: syntax error, unexpected '(', expecting T_STRING in /dev/lookatme/_config/config.php on line 145" I've looked at the code again but I can't figure out what is wrong... Here is the code.
0
1968
by: J4Nch | last post by:
Hi, I've two network cards(ethernet). They have their own sub-network. I've to do some discovery on those subnetwork. This discovery will be made with a c# implementation of DNS-SD(Bonjour). I've currently an issue with socket/UdpClient of c#: If I bind the socket or udpClient on IPAddress.Any, I receive only messages coming from one network card. Here is a small example of what I tried:
12
5061
oll3i
by: oll3i | last post by:
I am trying to run hello world app but i get an error Error: Unable to parse SDK content Please help
0
8087
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8025
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8509
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6847
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3993
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1620
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1363
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.