I will warn you that i have never used PHP to call a web service but have spent the last 2 days googling with trial and error and think that i have come to a point where i have no idea what to do as nothing is working.

Here is my PHP code...

<?php 
$soapclient = new SoapClient('Link-To-EndPoint');
$params = array('Username' => 'Username', 
                'Password' => 'Password', 
                'clientRequestId' => 1, 
                'projectNumber' => 64111, 
                'requestDateTime' => '2014-03-16T11:05:24.572Z',
                'itemNumber' => 'F00573019120B',
                'projectNumber' => 64111
                );
$response = $soapclient->GetItemDetailInfo($params);
echo '<pre>';
var_dump($response);
echo '</pre>';
?>

And here is the request, probably worth noting that this gives the full response and works when i use SOAP UI to make the request.

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
    <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <UsernameToken>
        <Username>Username</Username>
        <Password>Password</Password>
      </UsernameToken>
    </Security>
  </env:Header>
  <env:Body>
    <getItemDetailInfoRequest>
      <requestHeader>
        <clientRequestId>1</clientRequestId>
        <projectNumber>64111</projectNumber>
        <requestDateTime>2014-03-20T14:05:24.572Z</requestDateTime>
      </requestHeader>
      <getItemDetailInfoList>
        <itemDetailSearchCriteria>
          <itemNumber>F00573019120B</itemNumber>
          <projectNumber>64111</projectNumber>
        </itemDetailSearchCriteria>
      </getItemDetailInfoList>
    </getItemDetailInfoRequest>
  </env:Body>
</env:Envelope>

When i load the page i get a blank screen nothing comes out from $response, I have no idea if i am close to making this work or if i am super far off with this. Using the above code i am able to make a public weather SOAP Web Service work which makes me think i am close.

Any help would be appreciated!

    Anything of interest in your PHP error log file?

    When I call my soap client, I turn on both "trace" and "exceptions" in the $options parameter, which may give you more info.

    Just looking at your example XML, I would expect you'll need to format your data array to match its nested structure, e.g.:

    $params = array(
    	'getItemDetailInfoRequest' => array(
    		'requestHeader' => array(
    			'clientRequestId' => 1,
    			'projectNumber' => 64111,
    			'requestDateTime' => '2014-03-20T14:05:24.572Z'
    		),
    		'getItemDetailInfoList' => array(
    			'itemDetailSearchCriteria' => array(
    				'itemNumber' => 'F00573019120B',
    				'projectNumber' => 64111
    			)
    		)
    	)
    );
    

    WARNING: No guarantee the above is correct, just a quick stab at it to give you the general idea.

      Nothing too helpful in the logs ugghhhh

      I have modified it a bit more taking into account your points on the array i kinda figured that might have been an issue point...

      <?php 
      // Create the client object
      $soapclient = new SoapClient('Link-To-WSDL-End-Point');
      $Header = array(
          'UsernameToken' => array(
                  'Username' => 'Username', 
                  'Password' => 'Password'
              )
      );  
      $Body = array( 'getItemDetailInfoRequest' => array( 'requestHeader' => array( 'clientRequestId' => 1, 'projectNumber' => 64111, 'requestDateTime' => '2014-03-20T14:05:24.572Z' ), 'getItemDetailInfoList' => array( 'itemDetailSearchCriteria' => array( 'itemNumber' => 'F00573019120B', 'projectNumber' => 64111 ) ) ) ); //$response = $client->__soapCall("Header",array($Header), "Body",array($Body)); $response = $soapclient->Header($Header)->Body($Body); echo '<pre>'; var_dump($response); echo '</pre>'; ?>

      Now that the array is straightened our i think the problems is in $response how do you combine what i am now calling header and body? This is the 2 parts that i noticed in the request that works through SOAP UI. Is that even header or is it UsernameToken and same thing below is it Body or getItemDetailInfoRequest.

        I think you want to use setSoapHeaders() for the Header portion, then your actual request will be $soapclient->GetItemDetailInfo($Body).

        By the way, have I mentioned I hate SOAP? 😉

          In all of the googling i have done over the past few days i never stumbled upon setSoapHeaders so thanks for pointing that out!

          And yes i hate SOAP as well if this was REST i dont think i would be having any issues, but that is what our internal web services were created in years ago. We are a Java/.Net shop here with me being there lone PHP dev and i use that term loosely i am a Front End DEV with enough PHP knowledge to be dangerous. Most of my experience is in Wordpress with PHP and there i am great but this whole Web Service concept is nothing i have ever done. But i like a challenge 😕 so i figured i would give it a shot, the end goal of this is to run it on a cron every 15 mintues and see if we get a failure, if we do send an email cause the web service is down. All of that i am comfortable with its just getting that darn response back is where my whole issue lies. UGGGGHHHH!

            Have you looked at the [man]SoapHeader[/man] docs?

            Alongside the actual docs is this comment

            $client = new SoapClient(WSDL,array());
            
            $auth = array(
                    'UserName'=>'USERNAME',
                    'Password'=>'PASSWORD',
                    'SystemId'=> array('_'=>'DATA','Param'=>'PARAM'),
                    );
              $header = new SoapHeader('NAMESPACE','Auth',$auth,false);
              $client->__setSoapHeaders($header);
            

            Gives the following header XML:

              <SOAP-ENV:Header>
                <ns1:Auth>
                  <ns1:SystemId Param="PARAM">DATA</ns1:SystemId>
                  <ns1:UserName>USERNAME</ns1:UserName>
                  <ns1:Password>PASSWORD</ns1:Password>
                </ns1:Auth>
              </SOAP-ENV:Header>
            
              Write a Reply...