vra6183 Posted March 10, 2009 Share Posted March 10, 2009 Code : <HTML> <?php // -------------------- // SessionServices call // -------------------- try { $wsdl1='http://169.254.25.129/SelligentXatWebServices/SessionServices.asmx?WSDL'; $client1=new soapclient($wsdl1, array('trace'=>1)); $param1=array('database'=>'VRADEMANXAT', 'user'=>'TT', 'password'=>'', 'domain'=>''); $result1=$client1->Login($param1); } catch (SoapFault $fault1) { trigger_error("SOAP FAULT: $fault1",E_USER_ERROR); } $response1= $client1->__getLastResponse(); echo "SessionServices contacted (function Login) : No SOAP FAULT returned.<BR>"; echo gettype($response1); echo " : "; echo $response1; echo "<BR>"; // -------------------- // ChapterServices call // -------------------- try { $wsdl2='http://169.254.25.129/SelligentXatWebServices/ChapterServices.asmx?WSDL'; $client2=new soapclient($wsdl2, array('trace'=>1)); // $param2=array('sessionParams'=>'vrademanxat-tt-256b0126-aacd-475f-87', 'chapter'=>'Cpy', 'nrid'=>'13921644623442'); $param2=array('sessionParams'=>$response1, 'chapter'=>'Cpy', 'nrid'=>'13921644623442'); $result2=$client2->Open($param2); } catch (SoapFault $fault2) { trigger_error("SOAP FAULT: $fault2",E_USER_ERROR); } $response2=$client2->__getLastResponse(); echo "ChapterServices contacted (function Open) : No SOAP FAULT returned.<BR>"; echo gettype($response2); echo " : "; echo $response; echo "<BR>" ?> </HTML> Output: SessionServices contacted (function Login) : No SOAP FAULT returned. string : vrademanxat-tt-00aecb69-c36f-4dd0-aa ChapterServices contacted (function Open) : No SOAP FAULT returned. string : <Warns Count="1" FullCount="1" Range="-1" WindowTitle=""><Warn Message="Session not found or expired !" ChapterLN="" id="1" Type="Error" /></Warns> The problem is at the ChapterServices call, when I submit $response1. If I comment this line and uncomment the one just above, the page is working correctly. The SessionServices response is the following when I use it directly in IE with the URL : <?xml version="1.0" encoding="utf-8" ?> <string xmlns="http://selligent.com/webservices/">vrademanxat-tt-b90c9ecf-ad0d-4588-a7</string> the string vrademanxat-tt-b90c9ecf-ad0d-4588-a7 is the first parameter to pass to the second webservice. Session not found or expired ! is returned by the second service if I enter <?xml version="1.0" encoding="utf-8" ?><string xmlns="http://selligent.com/webservices/">vrademanxat-tt-b90c9ecf-ad0d-4588-a7</string> in place of only vrademanxat-tt-b90c9ecf-ad0d-4588-a7. Eventhough $response1 is displayed as the string I need, it seems to be passed as "with the tags". Is there any function who helps ??? Thanks by advance. Vincent. Quote Link to comment https://forums.phpfreaks.com/topic/148765-php-cnet-webservices/ Share on other sites More sharing options...
vra6183 Posted March 12, 2009 Author Share Posted March 12, 2009 Hello, I relaunch you all on this subject $response1=$client1->__getLastResponse() gives the following result <?xml version="1.0" encoding="utf-8" ?><string xmlns="http://selligent.com/webservices/">vrademanxat-tt-b90c9ecf-ad0d-4588-a7</string> How can I extract the vrademanxat-tt-b90c9ecf-ad0d-4588-a7 Quote Link to comment https://forums.phpfreaks.com/topic/148765-php-cnet-webservices/#findComment-782919 Share on other sites More sharing options...
codestips Posted March 25, 2009 Share Posted March 25, 2009 use explode function . Quote Link to comment https://forums.phpfreaks.com/topic/148765-php-cnet-webservices/#findComment-793253 Share on other sites More sharing options...
phpian Posted April 7, 2009 Share Posted April 7, 2009 if this is always going to be the result, you could use str_replace to strip away the parts you don't need. $response1 = str_replace('<?xml version="1.0" encoding="utf-8" ?><string xmlns="http://selligent.com/webservices/">', '', $response1); $response1 = str_replace('</string>', '', $response1); just a suggestion but there's probably a more robust way of doing this using strpos() Quote Link to comment https://forums.phpfreaks.com/topic/148765-php-cnet-webservices/#findComment-803726 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.