I have this code in SOAP and XML-RPC and can't make any sense from it. Could anybody "translate" it to classsic ASP? I'm guessing I have to do some requests with XMLHTTP, but can't figure out what to pass and how to pass
我在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";
1 个解决方案
#1
0
Tweak this to your specific needs:
根据您的具体需求调整:
<%
'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
%>
#1
0
Tweak this to your specific needs:
根据您的具体需求调整:
<%
'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
%>