PHP SOAP server

I'm trying to build a server for another soap server to call and give back a soap response in PHP and NuSoap.

The soap service that will be sending the request is here https://supplieruatsp.testpartstrader.us.com/v2.0/services/InventoryOptionsService.svc
Now, this service will send me a request that I'm supposed to parse, then query some data and send back a response.

I have built a simple server and client for testing but I'm getting nowhere, nothing but errors from NuSoap. I am also seeing this as an error:
wsdl error: Bad path to WSDL file ://IBMSSimpleTypes.xsd

I cannot find IBMSSimpleTypes in any file on my local web server.

Not sure what the problem is as I have never written this in PHP before.

Can anyone help out here?


Server:
<?php
require_once "./lib/nusoap.php";

$server = new soap_server('InventoryOptionsService.wsdl'); // contains a local copy of the wsdl from the service

$server->service(file_get_contents("php://input"));

    function SubmitInventory($request) {
        echo $request;
        exit;
}        

Open in new window


Client
<?php
require_once "./lib/nusoap.php";
$client = new nusoap_client("InventoryOptionsService.wsdl", true);

$error = $client->getError();
if ($error) {
    echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}
$request = file_get_contents("RequestExample.xml");

$result = $client->call("SubmitInventory", $request);

if ($client->fault) {
    echo "<h2>Fault</h2><pre>";
    print_r($result);
    echo "</pre>";
}
else {
    $error = $client->getError();
    if ($error) {
        echo "<h2>Error</h2><pre>" . $error . "</pre>";
    }
    else {
        echo "<pre>";
        echo $result;
        echo "</pre>";
    }
}

echo "<h2>Request</h2>";
echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
echo "<h2>Response</h2>";
echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";

Open in new window

LVL 26
Eddie ShipmanAll-around developerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Does this file exist and is it in the same folder as the server script?
InventoryOptionsService.wsdl

Open in new window

Same for client.
0
Eddie ShipmanAll-around developerAuthor Commented:
Yes to both, all in same folder
0
Eddie ShipmanAll-around developerAuthor Commented:
I actually downloaded all the XSD files into that directory, too
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Julian HansenCommented:
Can you post it so we can test.

Also confirm you have the latest NuSoap library from here (https://sourceforge.net/projects/nusoap/)

What version of PHP are you on

Need the above to replicate issue.
0
Eddie ShipmanAll-around developerAuthor Commented:
I have downloaded latest NuSoap, PHP version is 5.6.31.
I'm sorry but I cannot post to public because I don't have access, yet. I'm developing locally on WAMP and then testing on LAMP in VirtualBox before deployment.

What's funny is it says it can't find file://IBMSSimpleTypes.xsd

I did download a file named BMSSimpleTypes.xsd...
0
Julian HansenCommented:
I meant can you post the wsdl file - the one that defines your SOAP interfaces.
0
Eddie ShipmanAll-around developerAuthor Commented:
It is essentially the one you would get by visiting the service URI:
https://supplieruatsp.testpartstrader.us.com/v2.0/services/InventoryOptionsService.svc?wsdl

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
  xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
  xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
  xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
  xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
  xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
  xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
  xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:tns="http://tempuri.org/" 
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
  name="InventoryOptionsService" 
  targetNamespace="http://tempuri.org/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://tempuri.org/Imports">      
        <xsd:import id="methodSchema" schemaLocation="InventoryOptionsServiceXsd0.xsd"  namespace="http://tempuri.org/"/>
        <xsd:import id="dataSchema" schemaLocation="BMSProcurementMessages.xsd"  namespace="http://www.cieca.com/BMS"/>
        <xsd:import id="procurementCommonTypes" schemaLocation="BMSProcurementCommonTypes.xsd"  namespace="http://www.cieca.com/BMS"/>
        <xsd:import id="commonGlobalTypes" schemaLocation="BMSCommonGlobalTypes.xsd"  namespace="http://www.cieca.com/BMS"/>
        <xsd:import id="classicCodeLists" schemaLocation="BMSClassicCodeLists.xsd"  namespace="http://www.cieca.com/BMS"/>
        <xsd:import id="simpleTypes" schemaLocation="BMSSimpleTypes.xsd"  namespace="http://www.cieca.com/BMS"/>
    </xsd:schema>
  </wsdl:types>
  
  <wsdl:message name="InventoryOptionsService_SubmitInventory_InputMessage">
    <wsdl:part name="parameters" element="tns:SubmitInventory"/>
  </wsdl:message>
  
  <wsdl:message name="InventoryOptionsService_SubmitInventory_OutputMessage">
    <wsdl:part name="parameters" element="tns:SubmitInventoryResponse"/>
  </wsdl:message>
  
  <wsdl:portType name="InventoryOptionsService">
    <wsdl:operation name="SubmitInventory">
      <wsdl:input wsaw:Action="http://tempuri.org/InventoryOptionsService/SubmitInventory" message="tns:InventoryOptionsService_SubmitInventory_InputMessage"/>
      <wsdl:output wsaw:Action="http://tempuri.org/InventoryOptionsService/SubmitInventoryResponse" message="tns:InventoryOptionsService_SubmitInventory_OutputMessage"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="BasicHttpBinding_InventoryOptionsService" type="tns:InventoryOptionsService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="SubmitInventory">
        <soap:operation soapAction="http://tempuri.org/InventoryOptionsService/SubmitInventory" style="document"/>
        <wsdl:input>
          <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
          <soap:body use="literal"/>
        </wsdl:output>
      </wsdl:operation>
  </wsdl:binding>
  
  <wsdl:service name="InventoryOptionsService">
    <wsdl:port name="BasicHttpBinding_InventoryOptionsService" binding="tns:BasicHttpBinding_InventoryOptionsService">
	  <soap:address location="https://supplieruatsp.testpartstrader.us.com/v2.0/services/InventoryOptionsService.svc"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Open in new window

0
Eddie ShipmanAll-around developerAuthor Commented:
Julian, I'm going to close this question as I've decided to use the Zend SOAP extension due to Exception handling. do you have any experience with it?
0
Julian HansenCommented:
Apologies for late reply.

Using the PHP SoapClient with this code
<?php
$soap = new SoapClient("https://supplieruatsp.testpartstrader.us.com/v2.0/services/WSDL/InventoryOptionsService.wsdl");
var_dump($soap->__getFunctions()); 

Open in new window

I get this returned
array(1) { [0]=> string(68) "SubmitInventoryResponse SubmitInventory(SubmitInventory $parameters)" } 

Open in new window

I  imagine you would want to do something like this
<?php
$client = new SoapClient("https://supplieruatsp.testpartstrader.us.com/v2.0/services/WSDL/InventoryOptionsService.wsdl");
var_dump($client->__getFunctions()); 
$params = 'set up your call parameters here';
$response = $client->__soapCall("SubmitInventory", array($params));

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.