Hi, Ok, I'll look into those restricted types. I now have a SoapClient for basic test and I can connect to this SoapServer and get the test soap fault ok: <?php ini_set("soap.wsdl_cache_enabled", "0"); $server = new SoapServer("http://localhost/ProblemReportService.wsdl", array('soap_version' => SOAP_1_1)); $server->addFunction("submitProblemReport"); $server->handle(); function submitProblemReport($problem) { throw new SoapFault('-1', "Hello from ProblemTestServerOne.php!", 'actor', 'detail', 'name', 'header'); } ?> but _cannot_ connect to this basic test SoapServer: <?php ini_set("soap.wsdl_cache_enabled", "0"); class ProblemReport { public $BodyPartType; // BodyPartType } class BodyPartType { } class ProblemReportService extends SoapClient { private static $classmap = array( 'ProblemReport' => 'ProblemReport', 'BodyPartType' => 'BodyPartType'); function ProblemReportService($wsdl = "http://localhost/ProblemReportService.wsdl", $options = array('soap_version' => SOAP_1_1)) { foreach(self::$classmap as $key => $value) { if(!isset($options['classmap'][$key])) { $options['classmap'][$key] = $value; } } parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->addFunction('submitProblemReport'); $this->server->handle(); } function submitProblemReport(ProblemReport $request) { throw new SoapFault('-1', "Hello from ProblemTestServerTwo.php!", 'actor', 'detail', 'name', 'header'); } } // end class ProblemReportService ?> Any ideas why? Cheers, Brendan -----Original Message----- From: Richard Quadling [mailto:rquadling@gmail.com] Sent: 10 March 2011 10:56 To: Crowley, Brendan - Dell Team Cc: soap@lists.php.net Subject: Re: SOAP wsdl:part name="request" element type question On 10 March 2011 10:37, Richard Quadling <rquadling@gmail.com> wrote: > On 9 March 2011 15:56, Â<Brendan_Crowley@dellteam.com> wrote: >> Hi Richard, >> >> Thanks for your reply, my files are now up on pastebin: >> >> ProblemReportService.wsdl: Â Â Âhttp://pastebin.com/m9q5tDaN >> ProblemReport.xsd: Â Â Â Â Â Â Âhttp://pastebin.com/01YPU6Dn >> dropdownvalues.xsd: Â Â Â Â Â Â http://pastebin.com/1Kvbvf5U >> >> I've used the wsdl2php.php from http://pastebin.com/r1BfRysT to create this php file: >> ProblemReportService.php: Â Â Â http://pastebin.com/Txyc1mQM >> >> I understand that this ProblemReportService.php file needs to be utilised both by SoapClient and SoapServer, but how can I use this ProblemReportService.php file to handle the contents of my ProblemReport.xml to create the $request object for the Client? >> >> Cheers, >> Brendan >> >> -----Original Message----- >> From: Richard Quadling [mailto:rquadling@gmail.com] >> Sent: 09 March 2011 11:22 >> To: Crowley, Brendan - Dell Team >> Cc: soap@lists.php.net >> Subject: Re: SOAP wsdl:part name="request" element type >> question >> >> On 9 March 2011 10:53, Â<Brendan_Crowley@dellteam.com> wrote: >>> I have a WSDL (ProblemReportService.wsdl) that is defined as follows: >>> >>> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" >>> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" >>> xmlns:xs="http://www.w3.org/2001/XMLSchema" >>> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >>> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xmlns:tns="http://localhost/ProblemReportService.wsdl" >>> xmlns:ha1="http://localhost/ProblemReport.xsd" >>> name="ProblemReportService" >>> targetNamespace="http://localhost/ProblemReportService.wsdl"> >>> <wsdl:types> >>> Â Â Â Â Â Â<xs:schema attributeFormDefault="unqualified" >>> elementFormDefault="qualified" >>> xmlns:ha1="http://localhost/ProblemReport.xsd" >>> xmlns:xs="http://www.w3.org/2001/XMLSchema"> >>> Â Â Â Â Â Â Â Â Â<xs:import >>> namespace="http://localhost/ProblemReport.xsd" >>> schemaLocation="ProblemReport.xsd"/> >>> Â Â Â Â Â Â Â Â Â<xs:import >>> namespace="http://localhost/dropdownvalues.xsd" >>> schemaLocation="dropdownvalues.xsd"/> >>> Â Â Â Â Â Â</xs:schema> >>> Â Â Â</wsdl:types> >>> <wsdl:message name="NewProblemReportRequest"> >>> Â Â Â Â Â Â<wsdl:part name="request" element="ha1:ProblemReport"/> >>> Â Â Â</wsdl:message> >>> <wsdl:message name="ProblemReportResponse"> >>> Â Â Â Â Â Â<wsdl:part name="parameter" type="xs:string"/> >>> Â Â Â</wsdl:message> >>> <wsdl:portType name="ProblemReportPortType"> >>> Â Â Â Â Â Â<wsdl:operation name="submitProblemReport"> >>> Â Â Â Â Â Â Â Â Â<wsdl:input message="tns:NewProblemReportRequest"/> >>> Â Â Â Â Â Â Â Â Â<wsdl:output message="tns:ProblemReportResponse"/> >>> Â Â Â Â Â Â</wsdl:operation> >>> Â Â Â</wsdl:portType> >>> .. >>> >>> I've created an xml file (ProblemReport.xml) that validates to ProblemReport.xsd. >>> >>> I now have a SOAP Client php file that needs to send this request to the SOAP Server, how would I write the client and server side in php? >>> >>> Client: >>> try { >>> Â Â Â$client = new SoapClient("ProblemReportService.wsdl", >>> array('soap_version' => SOAP_1_1,'trace' => 1 )); >>> Â Â Â// How would I define $request from the contents of ProblemReport.xml file? >>> Â Â Â$return = $client->__soapCall("submitProblemReport", $request); >>> } catch (SoapFault $fault) { >>> Â Â Âtrigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, >>> faultstring: {$fault->faultstring})", E_USER_ERROR); } >>> >>> Server: >>> ini_set("soap.wsdl_cache_enabled", "0"); $server = new >>> SoapServer("http://localhost/ProblemReportService.wsdl", >>> array('soap_version' => SOAP_1_1)); >>> $server->addFunction("submitProblemReport"); >>> $server->handle(); >>> function submitProblemReport($problem) { >>> Â Â Â// How can I validate the $problem against a XSD schema? >>> Â Â Â// and how can I unmarshal the $problem to access the data contained within the original xml file? >>> } >>> >>> Any assistance appreciated. >>> >>> Thanks, >>> Brendan >>> >>> >> >> Do you have the complete wsdl file? >> >> My solution for the client is always the same. >> >> Wrap the WSDL and SOAPClient into an easy to use set of classes, essentially hiding the XML and SOAP aspects away and providing a normal OOP front end. >> >> I use Sourceforge's wsdl2php for that (combined with RazorsEdgeUK's patches). >> >> Take a look through the last few posts I've made on http://news.php.net/php.soap to see the sort of thing I'm talking about. There are links to some pastebin code too so you can see the code I'm creating/using as well as the output being generated. >> >> >> The SOAPServer's I've created have always been via Zend Framework which simplifies the creation of the WSDL file - I write the PHP code I want to expose, I add appropriate DocBlocks to that code and then I use ZF's AutoDiscover to create the WSDL file. >> >> Then I use wsdl2php to create client classes. >> >> I never write the WSDL file or create XML files or make HTTP requests. >> >> I use OOP and DocBlock documentation. >> >> But with the full wsdl file it should be a relatively simple process to construct the server classes. >> >> Of course, you _can_ do all of this without any of the ideas/suggestions I've made. But, for me, that seems to be missing out on the simplicity that comes with using PHP's SOAPClient and wsdl2php. >> >> Let me know what you need. >> >> Richard. >> >> -- >> Richard Quadling >> Twitter : EE : Zend >> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY >> > > Oh. Interesting. > > It seems that wsdl2php doesn't support the translation of restricted > types to anything concrete. > > So, currently wsdl2php is only giving you half the story. > > I don't think there is an instant fix here. I've not had to use a > restriction on any of my code or in any of the services I've > interacted with. > > How soon do you need this working? > > I have an idea on what to do to get wsdl2php working for restrictions, > but I'm not able to do anything on it today. > > Richard. > > > -- > Richard Quadling > Twitter : EE : Zend > @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY > An interesting comment on http://social.msdn.microsoft.com/Forums/en/asmxandxml/thread/4d5b1e36-21b9-454b-b155-3d14bba49b82 The wsdl file _MAY_ be invalid. See the comments later on regarding XMLSpy. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY