0

I need to generate the following XML with SOAP:

<MetaDataConstraint class="topics">
     <Value>FRX</Value>
</MetaDataConstraint>

I am not sure how to generate the attributes.

Based on: Using SOAP to generate XML attributes in PHP, I tried to do the following, but unfortunatelly it does not work.

$myFilter = array("MetaDataConstraint" => array("_" => array("Value" => "FRX")), "class" => "topics");

How can I solve it ?

3
  • Do you simply need to create the XML structure to send via a SOAP operation?? In other words, are you only really needing this XML layout in a simple PHP string variable? Apologies if I have misunderstood, but I am trying to get more clarity on the questions. Commented Aug 12, 2010 at 12:46
  • I seem to have misunderstood, sorry, after reading the link you posted I get where you're coming from, and will see what I can muster up. Commented Aug 12, 2010 at 12:48
  • Well, what I need to do is the following: $headlinesArray = array( 'TimeOut' => "600", 'MaxCount' => "10", 'MaxCountPerFilter' => "true", 'StartTime' => "2010-08-10T00:00:00", 'EndTime' => "2010-08-12T00:00:00", 'Direction' => "Newer", 'Filter' => $myFilter ); $myRequest = array( 'HeadlineMLRequest' => $headlinesArray ); and then: $myResponse = $client2->__soapCall('RetrieveHeadlineML_1', array('parameters' => $myRequest), null, $myHeaders); Commented Aug 12, 2010 at 13:15

1 Answer 1

0

Try:

$obj = new stdClass();
$obj->class = "topics";
$obj->Value = "FRX";
$myfilter = $obj;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.