Link to home
Start Free TrialLog in
Avatar of lharrispv
lharrispvFlag for United States of America

asked on

Parse Soap Response with SimpleXML problem

So I am making a soap call in PHP using fopen.  I cannot figure out how to parse to a specific value in the soap env response to save my life.

I have been Topekaing( errr Googleing) this for hours and have tried everything from declare namespaces to removing the colons etc...

Any help woudl be appreciated!
//soap req env

$contents = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <payRequest>
      <actionType>PAY</actionType>
      <cancelUrl>http://myCancelUrl.com</cancelUrl>
      <currencyCode>USD</currencyCode>
      <returnUrl>http://myReturnUrl.com</returnUrl>
      <receiverList>
        <receiver>
          <amount>10</amount>
          <email>newsel_1245945819_biz@leezacentral.com</email>
        </receiver>
      </receiverList>
      <requestEnvelope>
        <errorLanguage>en_US</errorLanguage>
      </requestEnvelope>
    </payRequest>
  </soapenv:Body>
</soapenv:Envelope>';

//Soap Response

<?xml version='1.0' encoding='utf-8'?>
	<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
		<soapenv:Header />
		<soapenv:Body>
			<ns2:PayResponse xmlns:ns2="http://svcs.paypal.com/types/ap">
				<responseEnvelope>
					<timestamp>2010-04-02T10:07:57.246-07:00</timestamp>
					<ack>Success</ack>
					<correlationId>7fe65d08e725a</correlationId>
					<build>1238639</build>
				</responseEnvelope>
				<payKey>AP-32D204908S5562638</payKey>
				<paymentExecStatus>CREATED</paymentExecStatus>
			</ns2:PayResponse>
		</soapenv:Body>
	</soapenv:Envelope>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial