我在gsoap中创建了一个Web服务,但服务器不接受请求。没有错误,但我不明白为什么它不接受来自客户端的请求。我在这里粘贴我的客户端和服务器代码
客户代码
EnrollmentServiceSOAPProxy proxy;
_ns1__performRequest *req = new _ns1__performRequest();
_ns1__performRequestResponse *res = new _ns1__performRequestResponse();
if(proxy.performRequest(req, res) == SOAP_OK)
print "OK" // pseudo code for print.
else
print "Not Ok"
服务器代码:
int __ns1__performRequest(soap *, _ns1__performRequest *ns1__performRequest, _ns1__performRequestResponse *ns1__performRequestResponse)
{
ns1__performRequestResponse->jobID = "1011";
return SOAP_OK;
}
服务器正在侦听localhost。但是请求没有到达服务器。
这是WSDL文件:https://www.dropbox.com/s/n2sdv51qmttp7vb/EnrollmentService.wsdl
我调试了代码,但它没有帮助我。
答案 0 :(得分:0)
服务端点可能不会设置为您的服务器,而是设置为WSDL定义为服务器地址的任何内容。在端口8000上运行本地服务器时,应使用EnrollmentServiceSOAPProxy proxy("URL");
作为服务器端点地址的URL(http://hostaddr
或http://localhost:8000
)。
答案 1 :(得分:0)
之前和我在一起。在服务定义中,我使用了不同的端口,而服务器正在侦听不同的端口。这似乎也是你的问题。