Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing an Object or XML result returned by a stdClass

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
0
0
US
given
Code:
<Signers>
<Signer>
<DocumentID>SPCJxPNnNeQ=</DocumentID>
<Status>Signed</Status>
<Email>signer1@sertifi.com</Email>
<NameSigned>John Doe</NameSigned>
<IpAddress>192.168.150.100</IpAddress>
<SignMethod>Electronic</SignMethod>
<DateSigned>2/12/2007 3:11:16PM</DateSigned>
</Signer>
<Signer>
<DocumentID>Ejbgjqq9Kk0=</DocumentID>
<Status>Unsigned</Status>
<Email>signer2@sertifi.com</Email>
<NameSigned />
<IpAddress />
<SignMethod>Electronic</SignMethod>
<DateSigned>1/1/0001 12:00:00AM</DateSigned>
</Signer>
</Signers>
in stdClass as $source, how do I point to <NameSigned> and get its content?

As per the API documentation:

Code:
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /AppBase/services/gateway.asmx HTTP/1.1
Host: apps.domain.net
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xmlns:xsd="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] xmlns:soap12="[URL unfurl="true"]http://www.w3.org/2003/05/soap-envelope">[/URL]
  <soap12:Body>
    <GetFileSigners xmlns="[URL unfurl="true"]http://apps.domain.net/services/">[/URL]
      <pstr_APICode>string</pstr_APICode>
      <pstr_FileID>string</pstr_FileID>
    </GetFileSigners>
  </soap12:Body>
</soap12:Envelope>

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xmlns:xsd="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] xmlns:soap12="[URL unfurl="true"]http://www.w3.org/2003/05/soap-envelope">[/URL]
  <soap12:Body>
    <GetFileSignersResponse xmlns="[URL unfurl="true"]http://apps.domain.net/services/">[/URL]
      <GetFileSignersResult>string</GetFileSignersResult>
    </GetFileSignersResponse>
  </soap12:Body>
</soap12:Envelope>

I connect, I fetch and get the stdClass object but I've tried every combination

$response->Signers->Signer->NameSigned
$response->GetFileSignersResult->Signers->Signer->NameSigned

and keep getting undefined property error messages.

Your help is true appreciated!



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
a few questions

1. why do you think this is being returned as a stdclass?
2. in any event, what is the code you are using to retrieve this xml and transform it?

 
More to the point is $source a string or an actual XML object? i.e one you would get after running it through something like simplexml_load_string()

If its just a string, you need it to parse it first. If its already an object, a direct access should work i.e $source->Signer[0]->NameSigned->__toString();






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
hence my question about seeing the code ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top