You are here:  » Commission Junction Web Services/ SOAP and MagicParser


Commission Junction Web Services/ SOAP and MagicParser

Submitted by mastereyes on Wed, 2009-09-09 19:31 in

Is there any example to fetch the data from Commission Junction's (cj.com) web services? They are using SOAP.

Regards,

Matt

Submitted by support on Thu, 2009-09-10 09:05

Hi Matt,

There's isn't a specific Commission Junction + SOAP example; however the general principle is to use Magic Parser with an appropriate Format String to parse the response records (presumably a list of PRODUCT records) directly from with the SOAP envelope.

If you're running PHP > 5.0.01, SOAP is now included, and should be as straight forward as creating a SOAPClient object with the WSDL that describes the service.

With that in place; you should be able to call a function with the required parameters that will return an XML document as a string; and that XML document can then be passed to MagicParser_parse() using string:// and the appropriate Format String.

The easiest way to establish the Format String might be to use the demo tool here on the Magic Parser website; or during development of your script, obtain the XML into a string and then use:

  $formatString = MagicParser_getFormat("string://".$xml);
  print $formatString;

Based on other SOAP example, you might expect something like:

xml|SOAP:ENVELOPE/SOAP:BODY/M:GETPRODUCTSRESPONSE/PRODUCTS/PRODUCT

...and then in your live application (this just saves Magic Parser having to auto-detect each time)..

  MagicParser_parse("string://".$xml,"myRecordHandler","xml|SOAP:ENVELOPE/SOAP:BODY/M:GETPRODUCTSRESPONSE/PRODUCTS/PRODUCT");

Hope this helps!
Cheers,
David.