- 论坛徽章:
- 0
|
我写了一个mycat.h的文件用来生成mycat.wsdl- //gsoap ns service name: mycat
- //gsoap ns service namespace: http://192.168.1.144:812/mycat.wsdl
- //gsoap ns service location: http://192.168.1.144:812
- //gsoap ns service executable: mycat
- //gsoap ns service encoding: encoded
- //gsoap ns schema namespace: urn:mycat
- int ns__my_cat_str(char *_str1, char *_str2, char **_result);
复制代码 然后写server端client都成功了。可以部署以后在浏览器访问看不到mycat.wsdl的内容。这个应该怎么做?
- int main(int argc, char **argv)
- {
- int m, s; /* master and slave sockets */
- struct soap mycat_soap;
- soap_init(&mycat_soap);
- soap_init2(&mycat,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE);
- soap_set_namespaces(&mycat_soap, mycat_namespaces);
- if (argc < 2)
- {
- printf("usage: %s <server_port> \n", argv[0]);
- exit(1);
- }
- else
- {
- m = soap_bind(&mycat_soap, NULL, atoi(argv[1]), 100);
- if (m < 0)
- {
- soap_print_fault(&mycat_soap, stderr);
- exit(-1);
- }
- fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
- for ( ; ; )
- {
- s = soap_accept(&mycat_soap);
- if (s < 0)
- {
- soap_print_fault(&mycat_soap, stderr);
- exit(-1);
- }
- fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);
- mycat_serve(&mycat_soap);
- soap_end(&mycat_soap);
- }
- }
- return 0;
- }
- int ns__my_cat_str(struct soap *mycat_soap, char *_str1, char *_str2, char **ret)
- {
- }
复制代码 编译完成后运行./my_cat_str 800
然后在浏览器打开显示
- <SOAP-ENV:Envelope>
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
- <faultcode>SOAP-ENV:Client</faultcode>
- <faultstring>HTTP GET method not implemented</faultstring>
- </SOAP-ENV:Fault>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
复制代码 看到网上有个帖子说是缺少- mycat_soap.fget = http_get;
复制代码
- int http_get(struct soap *soap)
- {
- soap_response(soap, SOAP_HTML);
- soap_send(soap,"<html>My Web sevice is operational.</html>\n");
- soap_end_send(soap);
- return SOAP_OK;
- }
复制代码 我加上以后结果不显示xml了只显示My Web sevice is operational.这一行,也就是http_get定义的内容,
如果我要显示http://192.168.1.144:800/mycat.wsdl 的内容应该怎么实现? |
|