From: WebServices <web...@ma...> - 2002-11-29 21:01:54
|
Hi all, I try to use a free SMS service for demo purpose and I have some problems for using the PHP client ... I tried with the basic client (the one you have further), the WSDL client and the Proxy from WSDL client ... The actual Web service I want to reach is : http://webservices.tiscali.com/SMSServices.asmx?op=SendFreeSMS So I have created this NuSoap client : <?php include_once("../lib/nusoap.php"); $phonenumber = "1234567890"; // Your phone number here !! $message = "mytext"; // Your text here !! $hostname = "http://webservices.tiscali.com"; $url = "SMSServices.asmx"; $servicename = "SendFreeSMS"; $mynamespace = $hostname."/"; $soapaction = "http://webservices.tiscali.com/" . $servicename; $parameters = array( 'phoneNumber' => $phonenumber, 'message' => $message); $endpoint = $hostname ."/". $url; $soapclient = new soapclient($endpoint); $return = $soapclient->call($servicename, $parameters, $mynamespace, $soapaction, ''); echo "" . $soapclient->request . "\n"; echo "" . $soapclient->response . "\n"; ?> ---------------------------------- The request SOAP envelop is : ----------------------------------- POST /SMSServices.asmx HTTP/1.0 User-Agent: NuSOAP/0.6.3 Host: webservices.tiscali.com Content-Type: text/xml; charset="ISO-8859-1" Content-Length: 627 SOAPAction: "http://webservices.tiscali.com/SendFreeSMS" <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP -ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd"><SOAP-ENV:Body><ns1:SendFreeSMS xmlns:ns1="http://webservices.tiscali.com/"> <phoneNumber xsi:type="xsd:string">1234567890</phoneNumber><message xsi:type="xsd:string">mytext</message></ns1:SendFreeSMS> </SOAP-ENV:Body></SOAP-ENV:Envelope> ---------------------- The response is ----------------------- HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Fri, 29 Nov 2002 20:52:11 GMT Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 485 <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/200 1/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><SendFreeSMSResponse xmlns="http://webservices.tiscali.com/">< SendFreeSMSResult><Error>InvalidMessage: The 'message' parameter should contain a minumum of 1 and a maximum of 160 characters.</Error></SendFreeSMSResult></SendFreeSMSResponse></soap:Body></s oap:Envelope> -------------------------- Now as indicated on the web site the request should be -------------------------- POST /SMSServices.asmx HTTP/1.1 Host: webservices.tiscali.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://webservices.tiscali.com/SendFreeSMS" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <SendFreeSMS xmlns="http://webservices.tiscali.com/"> <phoneNumber>string</phoneNumber> <message>string</message> </SendFreeSMS> </soap:Body> </soap:Envelope> ------------------------- And the response should be ------------------------- HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <SendFreeSMSResponse xmlns="http://webservices.tiscali.com/"> <SendFreeSMSResult> <SmsSentId>string</SmsSentId> <Error>string</Error> </SendFreeSMSResult> </SendFreeSMSResponse> </soap:Body> </soap:Envelope> So what's up ????? Is it this MS.net Web Service not working correctly ??? Or something else ??? Thanks !!! Guillaume |