Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>SoapHeader</code> treats arrays rather arbitrarily. If you ever want to use an array, consider using <a href="http://www.fischco.org/blog/2011/3/26/php-soapserver-objects-arrays-and-encoding.html" rel="nofollow"><code>ArrayObject</code> instead of the native construct</a>.</p> <p>However, you don't need an array at all since you're only trying to construct a single element in your header. And because each of your internal elements (eg. <strong>ClientIP</strong>) has a unique namespace, you can't just pass in a basic object. Instead, you have to specify a particular namespace for each element using the <code>SoapVar</code> class, which allows you to wrap normal PHP data in a "SOAP-ready" container that <code>SoapClient</code> can understand and translate.</p> <pre><code>$innerNS = "http://www.w3.org/BaufestProductivityFramework"; $outerNS = "http://schemas.datacontract.org/2004/07/Bpf.Common.Service"; $tag = new stdClass(); $tag-&gt;ClientIP = new SoapVar("200.125.145.10", XSD_STRING, null, null, null, $innerNS); $tag-&gt;CompanyId = new SoapVar(1, XSD_INT, null, null, null, $innerNS); $tag-&gt;UserName = new SoapVar("someUser", XSD_STRING, null, null, null, $innerNS); $client-&gt;__setSoapHeaders(new SoapHeader($outerNS, 'InfoTag', $tag)); </code></pre> <p>Finally, as a rule, <strong>don't manually write XML!</strong> Consider re-writing your SOAP body code like the header code shown here. You ought to be able to deal specifically with the <em>content</em> of the XML, not its structure.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload