PHP SOAP:与c++应用程序的通信
PHP SOAP: Communication to a C++ application
我有一个使用gSOAP的c++ SOAP客户端,我试图构建一个非常简单的PHP服务器(在Debian上的Apache2/PHP5)客户端可以与之交谈。不幸的是,我不明白如何在PHP中使用我的web服务的复杂类型。
我有一个。wsdl看起来像这样:
<definitions name="NumOps"
targetNamespace="http://192.168.2.113/numops.wsdl"
xmlns:tns="http://192.168.2.113/numops.wsdl"
xmlns:xsd1="http://192.168.2.113/testtypes.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="http://192.168.2.113/testtypes.xsd"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="AddValRequest">
<complexType>
<all>
<element name="fVal1" type="float"/>
<element name="fVal2" type="float"/>
</all>
</complexType>
</element>
<element name="AddValResponse">
<complexType>
<all>
<element name="fResult" type="float"/>
</all>
</complexType>
</element>
</schema>
</types>
<message name="AddValInput">
<part name="body" element="xsd1:AddValRequest"/>
</message>
<message name="AddValOutput">
<part name="body" element="xsd1:AddValResponse"/>
</message>
<portType name="NumOpsPortType">
<operation name="AddVal">
<input message="tns:AddValInput"/>
<output message="tns:AddValOutput"/>
</operation>
</portType>
<binding name="NumOpsSoapProxy" type="tns:NumOpsPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="AddVal">
<soap:operation soapAction="http://192.168.2.113/"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="NumOpsService">
<port name="NumOpsPort" binding="tns:NumOpsSoapProxy">
<soap:address location="http://192.168.2.113/"/>
</port>
</service>
</definitions>
我现在的方法是这样的:
<?php
function AddVal($AddValRequest) {
// How to create a AddValResponse?!
}
$server = new SoapServer(NULL, array("uri"=>"http://192.168.2.113/"));
$server->addFunction("AddVal");
$server->handle();
?>
这里的问题是,我没有任何东西可以让我开始,我可能不会解决这个猜测。有人知道我在哪里可以找到材料来深入研究这件事吗?
这行得通:
class AddValRequest {
public $fVal1;
public $fVal2;
}
class AddValResponse {
public $fResult;
}
function AddVal(AddValRequest $request) {
$response = new AddValResponse();
$response->fResult = $request->fVal1 + $request->fVal2;
return $response;
}
$server = new SoapServer("numops.wsdl");
$server->addFunction("AddVal");
$server->handle();
?>
,应该足以让有同样问题的人开始。
相关文章:
- 如何使用winsock在c++应用程序中实现安全套接字通信
- 使用命名管道在 C# 和C++应用程序之间进行持续通信
- C# 和C++应用程序之间的通信
- 如何通过具有通信行参数的procdump启动Windows应用程序?
- Electron应用程序和Win32本机桌面应用程序之间的进程间通信
- 一个使用QtUdpSocket的简单通信c / s应用程序
- 如何实现MATLAB和单独的C++应用程序之间的通信
- VC++和Qt应用程序之间使用共享内存进行通信
- C 和现有PHP应用程序之间的通信
- 使 .Net 3.5 应用程序与 .Net 4.0 应用程序通信的最稳定方法
- 如何通过套接字在PHP和C++应用程序之间进行通信
- 如何在C++服务器应用程序和django web应用程序之间进行通信
- 我可以使用管道与现有应用程序通信吗?
- 通过网络在应用程序之间进行通信
- PHP 脚本与应用程序通信的最佳方法
- 如何使用户级应用程序通过管道与根级应用程序通信
- 构建与 Android 应用程序通信的C++程序的最佳方式
- 获取用于与C++应用程序通信的网页
- 我需要一个Windows 8 WinRT应用程序来与用C编写的独立应用程序通信
- 我如何让我的Qt控制台应用程序与另一个Qt gui应用程序通信