我一直在阅读有关SOAP的知识,到目前为止,我已经设法编写了一个客户端和服务器代码来回发送消息。我使用邮差应用程序作为客户端,并在我的AWS实例中将服务器代码写为.C。文件。 我得到的只是终端中的一条消息。我希望将其显示在网页中。但是如何将该功能添加到网页中?我应该对SOAP应用程序进行哪些更改?我应该在哪里找?我也喜欢使用C语言,因为我不懂Java。我已经提到了服务器和客户端代码。 非常感谢你!
//header file nano.h
int ns__hello(char* in,char **result );
// helloServe.c file
#include "ns.nsmap" // XML namespace mapping table (only needed once at the
global level)
#include "soapH.h" // server stubs, serializers, etc.
int main()
{
struct soap *soap = soap_new1(SOAP_XML_INDENT);
if (!soap_valid_socket(soap_bind(soap, NULL, 8080, 100)))
exit(EXIT_FAILURE);
while (soap_valid_socket(soap_accept(soap)))
{
if (soap_serve(soap) != SOAP_OK)
break;
soap_destroy(soap); // delete deserialized objects
soap_end(soap); // delete allocated (deserialized) data
}
soap_print_fault(soap, stderr);
soap_free(soap); // free the soap struct context data
}
int ns__hello(struct soap *soap, char *in, char **result)
{
printf("Received %s\n\r",in);
*result = "Hello Client";
return SOAP_OK;
}
//Client code in postman
<?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:ns="http://tempuri.org/ns.xsd">
<SOAP-ENV:Body>
<ns:hello>
<in></in>
</ns:hello>
</SOAP-ENV:Body>