Sunday, January 2, 2011

WSO2 Integration With SpexLive

GetCategories Example:


$requestPayloadString =

<<

XML;

try {


$requestMessage = new WSMessage($requestPayloadString,
array("to" => "http://ws.spexlive.net/service/soap/catalog?appId="));

$client = new WSClient(array("useMTOM" => TRUE,"useSOAP"=>1.1));

$responseMessage = $client->request($requestMessage);

printf("Response = %s
", htmlspecialchars($responseMessage->str));


} catch (Exception $e) {
if ($e instanceof WSFault) {
printf("Soap Fault: %s\n", $e->Reason);
} else {
printf("Message = %s\n",$e->getMessage());
}
}
?>

Upload File Using MTOM:


$requestPayloadString = <<

$requestMessage = new WSMessage($requestPayloadString,
array("to" => "http://ws.spexlive.net/service/soap/catalog?appId=",
"attachments" => array("myid1" => $f)));

$client = new WSClient(array("useMTOM" => TRUE,"useSOAP"=>1.1));

$responseMessage = $client->request($requestMessage);

echo $responseMessage->str;

} catch (Exception $e) {
if ($e instanceof WSFault) {
printf("Soap Fault: %s\n", $e->Reason);
} else {
printf("Message = %s\n",$e->getMessage());
}
}
?>

No comments:

Post a Comment