Jump to content

immortallch

Members
  • Posts

    4
  • Joined

  • Last visited

immortallch's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I can't do like this - my WSDL file orders me to have one object as input. When i try yours idea, I've got this SOAP fault: Error, cannott find parameter Here is function prototype: RegisterResponse Register(Register $parameters)
  2. Hi, I can send SoapVar from my client to my server and from my server to my client - it works ok. The SOAP requests and responses seem to be ok. Everything is ok, until i try make it more "dynamic". How can I access to "Identifier" and "Status" ? Below is the code for client and server. Thanks for your time! <?php header('Content-type: application/xml'); try{ $sClient = new SoapClient('mywsdl.wsdl', array('trace'=>1)); $Identifier = "123456"; $Status = "Hey, how are you today?"; $part_request = array(); $part_request[] = new SoapVar($Identifier,XSD_STRING,NULL,NULL,"Identifier"); $part_request[] = new SoapVar($Status,XSD_STRING,NULL,NULL,"Status"); $request = new SoapVar($part_request, SOAP_ENC_OBJECT, NULL, NULL,"RegisterRequest"); $response = $sClient->Register($request); print_r ($sClient->__getLastRequest()); print_r ($sClient->__getLastResponse()); } catch(SoapFault $e){ var_dump($e); } ?> <?php //ini_set("soap.wsdl_cache_enabled","0"); $server = new SoapServer("wsdl.wsdl"); function Register($request) { /* How to access to "Identifier and Status?" $request->Identifier or $request->RegisterRequest->Identifier dont work ;/ */ /* BELOW THIS EVERYTHING WORKS, but it's static */ $ResponseId = "1234"; $Status = "Fine"; $part_response = array(); $part_response[] = new SoapVar($ResponseId,XSD_STRING,NULL,NULL,"ResponseId"); $part_response[] = new SoapVar($Status,XSD_STRING,NULL,NULL,"Status"); $response = new SoapVar($part_response,SOAP_ENC_OBJECT,NULL,NULL,"RegistrationResponse"); return $response; } $server->AddFunction("Register"); $server->handle(); ?>
  3. Well, I would say it is "cosmetic" problem. The response has to be parsable by external parser (I can't modify it) and without xmlns="http://tempuri.org" there are parse errors. Additionally I would also like to know how to change this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> to this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org">
  4. Hey! How to add namespace on response? I need to get <RegisterResponse xmlns="http://tempuri.org"> but I only get <RegisterResponse> I would be greatful, If someone could help me (it's realy important to me) Here is PHP code, my SOAP response and proper response im looking into: function Register($TimeStamp) { $output = '<ns1:RegisterResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:RegistrationResponse"><ns1:TimeStamp>'.$nTimeStamp."</ns1:TimeStamp</ns1:RegisterResult>"; $response = '<ns1:RegisterResponse xmlns="http://tempuri.org">'.$output.' </ns1:RegisterResponse>'; $response = new SoapVar($output,XSD_ANYXML); return $response; } $server = new SoapServer(null, array('uri'=>'http://tempuri.org', 'soap_version' => SOAP_1_1, "style" => SOAP_DOCUMENT,"use" => SOAP_LITERAL)); $server->addFunction("Register"); $server->handle(); ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:RegisterResponse> <ns1:RegisterResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:RegistrationResponse"> <ns1:TimeStamp>2013303T142249</ns1:TimeStamp> </ns1:RegisterResult> </ns1:RegisterResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:RegisterResponse xmlns:="http;//tempuri.org"> <ns1:RegisterResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:RegistrationResponse"> <ns1:TimeStamp>2013303T142249</ns1:TimeStamp> </ns1:RegisterResult> </ns1:RegisterResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.