美好的一天,讀者。Php Soap Server檢索vb WinHttp.WinHttpRequest
我的任務是構建一個PHP SOAP服務器來接收由VB客戶端通過WinHttp.WinHttpRequest對象發送的xml。我正在使用PHP服務器的nuSoap,它到目前爲止還沒有工作。
vb客戶端發送的xml包含需要與其他nessecary變量一起使用的已定義的webservice,這就是爲什麼沒有在vb代碼中植入soapaction的東西。 '他們' 要這樣說:'(
SOAP服務器併發送到VB這樣的迴應:
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultactor xsi:type="xsd:string"></faultactor>
<faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring>
<detail xsi:type="xsd:string"></detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
VB的客戶端發送的XML:
Private Sub Command2_Click()
mydata = "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf
mydata = mydata & "<root>" & vbCrLf
mydata = mydata & "<SERVICE>SayHello</SERVICE>" & vbCrLf
mydata = mydata & "<NAME>Noobula</NAME>" & vbCrLf
mydata = mydata & "</root>" & vbCrLf
Set w = CreateObject("WinHttp.WinHttpRequest.5.1")
w.Open "POST", "http://127.0.0.1:80/soapvb/terimaxml.php"
w.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
w.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = 13056
w.Send mydata
respo = w.ResponseText
Text1 = respo
End Sub
而且最後,服務器本身:
require_once "lib/nusoap.php";
$debug = 0;
$server = new soap_server();
$server->configureWSDL('terimaxml', 'urn:terimaxml');
function SayHello($xml){
//messing with xml taking NAME and say Olaa
echo "Olaaa :D";
}
$server->register('SayHello()',
array('xml' =>'xsd:array'),
'urn: terimaxml',
'urn: terimaxml#__construct()',
'rpc',
'encoded',
'-----'
);
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)
? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
我一直在互聯網上漫遊一段時間t o解決這個問題。所以任何幫助將不勝感激,在此先感謝。 :d
嗨,我也遇到這個錯誤,,但它仍然不起作用:S – Errorhere 2015-10-27 03:51:58