Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get quotes with soap 1.2 in php?
    primarykey
    data
    text
    <p>I'm a complete noob in XML and SOAP,</p> <p>Could you give some advice on at least where to start, or some example?</p> <p>(I'm not begging to write code for me)</p> <p>Here are the specs: </p> <p>I just expect to receive two <em>double</em> values. What is an easiest way to do it?</p> <pre><code>POST /CurrencyConvertor.asmx HTTP/1.1 Host: www.webservicex.net Content-Type: application/soap+xml; charset=utf-8 Content-Length: length &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;soap12:Body&gt; &lt;ConversionRate xmlns="http://www.webserviceX.NET/"&gt; &lt;FromCurrency&gt;PHP&lt;/FromCurrency&gt; &lt;ToCurrency&gt;USD or EUR&lt;/ToCurrency&gt; &lt;/ConversionRate&gt; &lt;/soap12:Body&gt; &lt;/soap12:Envelope&gt; HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;soap12:Body&gt; &lt;ConversionRateResponse xmlns="http://www.webserviceX.NET/"&gt; &lt;ConversionRateResult&gt;double&lt;/ConversionRateResult&gt; &lt;/ConversionRateResponse&gt; &lt;/soap12:Body&gt; &lt;/soap12:Envelope&gt; </code></pre> <p>The above specs's origin: <a href="http://www.webservicex.net/CurrencyConvertor.asmx?op=ConversionRate" rel="nofollow">http://www.webservicex.net/CurrencyConvertor.asmx?op=ConversionRate</a></p> <p>The first block is supposed to be a request, and the other response...</p> <p><strong>EDIT</strong></p> <p>Alright, I stopped at a standard PHP class, but I don't quite understand what is being asked for in this <code>__doRequest</code> method:</p> <pre><code>$client = new SoapClient(); $client-&gt;__doRequest ( &lt;&lt;&lt;EOD &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;soap12:Body&gt; &lt;ConversionRate xmlns="http://www.webserviceX.NET/"&gt; &lt;FromCurrency&gt;PHP&lt;/FromCurrency&gt; &lt;ToCurrency&gt;USD or EUR&lt;/ToCurrency&gt; &lt;/ConversionRate&gt; &lt;/soap12:Body&gt; &lt;/soap12:Envelope&gt; EOD , "http://www.webservicex.net/CurrencyConvertor.asmx" , $???, $??? ); </code></pre> <p><a href="http://www.php.net/manual/en/soapclient.dorequest.php" rel="nofollow">http://www.php.net/manual/en/soapclient.dorequest.php</a></p> <p>What is action, and what should I put as version, I know - a soap version 1.2 but the parameter is <code>int</code> so it cannot be assigned a <code>1.2</code> value lol...</p> <p><strong>EDIT2:</strong></p> <p>Alright, this is what I've got so far, but it gets me an empty string...</p> <pre><code>$client = new SoapClient(null, array('location'=&gt;'http://www.webservicex.net/CurrencyConvertor.asmx','uri'=&gt;'')); $client-&gt;__doRequest ( &lt;&lt;&lt;EOD &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;soap12:Body&gt; &lt;ConversionRate xmlns="http://www.webserviceX.NET/"&gt; &lt;FromCurrency&gt;PHP&lt;/FromCurrency&gt; &lt;ToCurrency&gt;USD or EUR&lt;/ToCurrency&gt; &lt;/ConversionRate&gt; &lt;/soap12:Body&gt; &lt;/soap12:Envelope&gt; EOD , "http://www.webservicex.net/CurrencyConvertor.asmx" , "ConversionRate", 2 ); echo "Response :&lt;br&gt;", htmlentities($client-&gt;__getLastResponse()); </code></pre> <p>...I just dont get this 'uri' thing - beyond my understanding. It makes me want to hit my head to the wall.</p>
    singulars
    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. 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