Recently I updated to SC 8.1
In 8.1 we can Use SOAP with Macros(sc_webservices)
Can I have any Tutorials for that …
If so I want to add SOAP feature for my existing website. So that I can use it for Mobile applications…
Recently I updated to SC 8.1
In 8.1 we can Use SOAP with Macros(sc_webservices)
Can I have any Tutorials for that …
If so I want to add SOAP feature for my existing website. So that I can use it for Mobile applications…
You can use SOAP with standard PHP, check for http://php.net/manual/de/soapclient.soapclient.php
I have already done that. Since you can place normal php code under a button (for example) it is easy enough.
And php makes it pretty easy to use soap.
An example for using for example a peoplesoft service that was made in peplesoft.
Here I use standard php to send a NR and EMPLID which in my peoplesoft gets read.
There in peoplesoft I get the record mentioned and in peoplesoft I make the changes to the database where needed.
When done it gives a reply back, including any failures.
<?php
/**
* http://php.net/manual/de/soapclient.soapclient.php
*/
$wsdl="http://127.0.0.1/PSIGW/PeopleSoftServiceListeningConnector/MOD_SCRIPTCASE.1.wsdl";
//$ps=new SoapClient($wsdl,array("exception"=>0,"trace"=>TRUE)); //just catch the error instead of causing an exception
try
{
$client=new SoapClient($wsdl,array("trace"=>TRUE)); //just catch the error instead of causing an exception
echo "------------------------------------------
";
echo "trying...
";
$result = $client->MOD_SCRIPTCASE_MUTFPERS(array('NR' => '999999','EMPLID' => '123456')); //call the WSDL with 2 parameters NR and EMPLID
echo "PROCESS done
";
$LastResponse=$client->__getLastresponse();
print_r($LastResponse);
echo "
";
//echo $LastResponse."
"; //string
//echo gettype($LastResponse)."
"; //string
//echo gettype($client) . "
"; //Object
//echo get_class($client) . "
"; //SoapClient
if (is_soap_fault($result)) {
echo "error soap
";
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
var_dump($result);
}else{
//use simplexml it is easier
echo "-------------
";
$xml=simplexml_load_string($LastResponse);
if ($xml===false){
echo "errors in peoplesoft xml handling
";
foreach(libxml_get_errors() as $error) {
echo " ", $error->message;
}
exit;
}
echo "--XML--
";
echo "PeoplesoftReply:-----------
";
echo $xml->asXML();
echo "
";
echo 'Result='.$xml->children('soapenv',TRUE)->children('ns1',TRUE)->children()->Result . "
";
echo 'Status='.$xml->children('soapenv',TRUE)->children('ns1',TRUE)->children()->Status . "
";
//echo 'XML='.$ch1->children()->asXML() . "
";
print_r ($xml);
}
} catch(SoapFault $f) {
echo 'Sorry an error was caught executing your request: ' . $f->getMessage();
}
?>
SO it all depends on what you want.
I advise to make a simple standalone php file (as above but then for your wsdl) and get that running first. Then copy the code over to a scriptcase button or library or so.
RR kinda answered it already.
But there is a new webservice sample project along with 8.1 that might clarify you a little more.
The documentation of the new macros should be released soon.
Mr Cavadinha is possible paste the webservices of your examples? i can see in your examples about webservices this:
$resposta = sc_webservice(“curl”, “http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx/CalcPrecoPrazo”, 80, “POST”, $parms, array(CURLOPT_RETURNTRANSFER => true), 30, true);
I would like to know how was design the webservices in your server for CalcPrecoPrazo.
They are consuming the webservice, didn’t developed. If you see, WS is on correios.com.br, a postal service