0

我在 SOAP 和 XML-RPC 中有这段代码,因此没有任何意义。任何人都可以将其“翻译”成经典的 ASP 吗?我猜我必须用 XMLHTTP 做一些请求,但不知道要传递什么以及如何传递

Examples
SOAP
$client = new SoapClient( "http://www.mailagent.ro/MailAgentService.wsdl");
try{
$response = $client->deleteSubscription( "projectcode", 18,
"user@example.com"
);
} catch ( SoapFault $e )
{
die( "Exception: " . $e->getMessage() );
}
echo "Exit code: " . $response['op_status'] . "\n";
echo "Response message: " . $response['op_message'] . "\n";

XML-RPC

require_once( "nw.genericclient.php");
$params = array(
"cod" => "projectcode",
"campaign_id" => 18,
"email" => "user@example.com"
);
$client = new NWGClient();
try{
$response = $client->deleteSubscription( $params );
} catch ( Exception $e )
{
die( "Exception: " . $e->getMessage() );
}
echo "Exit code: " . $response['op_status'] . "\n";
echo "Response message: " . $response['op_message'] . "\n";
4

1 回答 1

0

根据您的特定需求进行调整:

<%
'set the object
set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0") 

'URL to SOAP namespace and connection URL
strNamespace = "name_space"
strURL = "http://the.SOAP.service.url"

'function you want to call
strFunction = "function_name"

'the SOAP Request valid XML
strRequest ="<?xml version=""1.0"" encoding=""utf-8""?>" _
& "<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/""  xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/""" _
& "        xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" _
& "    <SOAP-ENV:Body>" _
& "        <put your valid request xml body here/>" _
& "    </SOAP-ENV:Body>" _
& "</SOAP-ENV:Envelope>"

objXMLHTTP.open "post", "" & strURL & "", False

objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.setRequestHeader "SOAPAction", strNamespace & "/" & strFunction

'send the request and capture the result
Call objXMLHTTP.send(strRequest)
strResult = objXMLHTTP.responseText

'display the response
response.write strResult

%>

于 2013-11-12T16:49:50.207 回答