Jump to content

PHP & C#.NET webservices.


vra6183

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

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()

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.