Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP SOAP request all lowercase
    primarykey
    data
    text
    <p>I have created a web service and have used soapUI to verify that it works correctly. However, the PHP client is getting a fatal error when attempting to access it. </p> <p>I have a try/catch set up so that I can view the output SOAP Request and do a <code>var_dump</code>. When I view the request and <code>var_dump</code>, it shows it as all lowercase (even the custom header I typed the XML for manually).</p> <p>I know XML is case-sensitive, and when I put the request back into soapUI and change the case correctly, I get the correct response from the web service.</p> <p>What could be causing the SOAP Request to change to everything to lowercase?</p> <pre><code>//The WSDL url $wsurl = "http://domain:port/mywebservice.wsdl"; //Custom header setup $ws_username = 'myuser'; $ws_password = 'mypass'; $ws_authheader = '&lt;wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt; &lt;wsse:UsernameToken&gt; &lt;wsse:Username&gt;'.$ws_username.'&lt;/wsse:Username&gt; &lt;wsse:Password&gt;'.$ws_password.'&lt;/wsse:Password&gt; &lt;/wsse:UsernameToken&gt; &lt;/wsse:Security&gt;'; //XML SOAP Security variable $ws_authvars = new SoapVar($ws_authheader,XSD_ANYXML); //SOAP Security header $ws_header = new SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security",$ws_authvars); //SOAP client - trace is set to true so faults can be backtraced $ws_client = new SoapClient($wsurl, array('trace'=&gt;true)); //SOAP client parameters $params = array('PARAM1'=&gt;'123456', 'PARAM2'=&gt;'ABCDE', 'PARAM3'=&gt;'ABCD'); try { //SOAP response $messages = $ws_client-&gt;__soapCall('WSMETHOD',array('parameters'=&gt;$params),NULL, $ws_header); //print_r($messages); } catch (SoapFault $fault) { echo "\n"; print_r($ws_client-&gt;__getLastRequest()); echo "\n"; var_dump($ws_client); } </code></pre> <p>My __getLastRequest returns this (note that field values remain in their proper case):</p> <pre><code>&lt;!--?xml version="1.0" encoding="UTF-8"?--&gt; &lt;soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="mynamespaceurl" xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt; &lt;soap-env:header&gt; &lt;wsse:security soap:mustunderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt; &lt;wsse:usernametoken&gt; &lt;wsse:username&gt;myuser&lt;/wsse:username&gt; &lt;wsse:password&gt;mypass&lt;/wsse:password&gt; &lt;/wsse:usernametoken&gt; &lt;/wsse:security&gt; &lt;/soap-env:header&gt; &lt;soap-env:body&gt; &lt;ns1:wsmethod&gt; &lt;ns1:param1&gt;123456&lt;/ns1:param1&gt; &lt;ns1:param2&gt;ABCDE&lt;/ns1:param2&gt; &lt;ns1:param3&gt;ABCD&lt;/ns1:param3&gt; &lt;/ns1:wsmethod&gt; &lt;/soap-env:body&gt; &lt;/soap-env:envelope&gt; </code></pre> <p>The exact SoapFault:</p> <pre><code>SoapFault exception: [SOAP-ENV:Server] null in C:\inetpub\wwwroot\mydirs\mypage.php:458 Stack trace: #0 C:\inetpub\wwwroot\mydirs\mypage.php(458): SoapClient &amp;gt;__soapCall('wsmeth...', Array, NULL, Object(SoapHeader)) #1 {main} </code></pre> <p>The line it is indicating (458) is the $messages = $ws_client->__soapCall</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. 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