我打电话时遇到错误:
soap_call___ns1__Sumar(soap,NULL,NULL,&oper,&resp)
错误400故障源[无子码]" HTTP错误:400错误请求" 细节:[没有细节]
ASMX服务发布在IIS上,位于同一台PC的本地网络上。我可以毫无问题地从c#客户端使用该服务,但是当我尝试通过gSOAP客户端使用该服务时,它会显示错误。
我正在使用gSOAP 2.8.29,我认为使用wsdl2h和soapcpp2工具构建文件没有问题。这是我的代码。
如果有人知道此错误的原因,请帮助我。 谢谢大家。
gSOAP客户端
#include "stdio.h"
#include "WCdataSoap.nsmap"
#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
struct _ns1__SumarResponse sum;
struct _ns1__Sumar oper;
oper.a = 2;
oper.b = 2;
printf("a = %d\n", oper.a);
printf("b = %d\n", oper.b);
if (soap_call___ns1__Sumar(soap, NULL, NULL, &oper, &sum) == SOAP_OK)
printf("Sum = %d\n", sum);
else
soap_print_fault(soap, stderr);
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
}
soapClientC.c
#if defined(__BORLANDC__)
#pragma option push -w-8060
#pragma option push -w-8004
#endif
#include "soapH.h"
#ifdef __cplusplus
extern "C" {
#endif
SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.8.29 2016-04-20 02:44:39 GMT")
SOAP_FMAC5 int SOAP_FMAC6 soap_call___ns1__Sumar(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct _ns1__Sumar *ns1__Sumar, struct _ns1__SumarResponse *ns1__SumarResponse)
{ struct __ns1__Sumar soap_tmp___ns1__Sumar;
if (soap_endpoint == NULL)
soap_endpoint = "http://localhost/MyService/WCdata.asmx";
if (soap_action == NULL)
soap_action = "http://localhost/MyService/Sumar";
soap_tmp___ns1__Sumar.ns1__Sumar = ns1__Sumar;
soap_begin(soap);
soap->encodingStyle = NULL;
soap_serializeheader(soap);
soap_serialize___ns1__Sumar(soap, &soap_tmp___ns1__Sumar);
if (soap_begin_count(soap))
return soap->error;
if (soap->mode & SOAP_IO_LENGTH)
{ if (soap_envelope_begin_out(soap)
|| soap_putheader(soap)
|| soap_body_begin_out(soap)
|| soap_put___ns1__Sumar(soap, &soap_tmp___ns1__Sumar, "-ns1:Sumar", NULL)
|| soap_body_end_out(soap)
|| soap_envelope_end_out(soap))
return soap->error;
}
if (soap_end_count(soap))
return soap->error;
if (soap_connect(soap, soap_endpoint, soap_action)
|| soap_envelope_begin_out(soap)
|| soap_putheader(soap)
|| soap_body_begin_out(soap)
|| soap_put___ns1__Sumar(soap, &soap_tmp___ns1__Sumar, "-ns1:Sumar", NULL)
|| soap_body_end_out(soap)
|| soap_envelope_end_out(soap)
|| soap_end_send(soap))
return soap_closesock(soap);
if (!ns1__SumarResponse)
return soap_closesock(soap);
soap_default__ns1__SumarResponse(soap, ns1__SumarResponse);
if (soap_begin_recv(soap)
|| soap_envelope_begin_in(soap)
|| soap_recv_header(soap)
|| soap_body_begin_in(soap))
return soap_closesock(soap);
soap_get__ns1__SumarResponse(soap, ns1__SumarResponse, "ns1:SumarResponse", NULL);
if (soap->error)
return soap_recv_fault(soap, 0);
if (soap_body_end_in(soap)
|| soap_envelope_end_in(soap)
|| soap_end_recv(soap))
return soap_closesock(soap);
return soap_closesock(soap);
}
#ifdef __cplusplus
}
#endif
#if defined(__BORLANDC__)
#pragma option pop
#pragma option pop
#endif
soapH.h
#ifndef soapH_H
#define soapH_H
#include "soapStub.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITH_NOIDREF
SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int);
SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap*);
SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap*);
#endif
SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap*, int*);
SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int);
SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*);
SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap);
#ifndef SOAP_TYPE_byte_DEFINED
#define SOAP_TYPE_byte_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap*, const char*, int, const char *, const char*);
SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap*, const char*, char *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap*, const char *, const char*, const char*);
#ifndef soap_write_byte
#define soap_write_byte(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || soap_put_byte(soap, data, "byte", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap*, char *, const char*, const char*);
#ifndef soap_read_byte
#define soap_read_byte(soap, data) ( soap_begin_recv(soap) || !soap_get_byte(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#ifndef SOAP_TYPE_int_DEFINED
#define SOAP_TYPE_int_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap*, int *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap*, const char*, int, const int *, const char*);
SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap*, const char*, int *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap*, const int *, const char*, const char*);
#ifndef soap_write_int
#define soap_write_int(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || soap_put_int(soap, data, "int", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap*, int *, const char*, const char*);
#ifndef soap_read_int
#define soap_read_int(soap, data) ( soap_begin_recv(soap) || !soap_get_int(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Fault_DEFINED
#define SOAP_TYPE_SOAP_ENV__Fault_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap*, const char*, struct SOAP_ENV__Fault *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *, const char*, const char*);
#ifndef soap_write_SOAP_ENV__Fault
#define soap_write_SOAP_ENV__Fault(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize_SOAP_ENV__Fault(soap, data), 0) || soap_put_SOAP_ENV__Fault(soap, data, "SOAP-ENV:Fault", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *, const char*, const char*);
#ifndef soap_read_SOAP_ENV__Fault
#define soap_read_SOAP_ENV__Fault(soap, data) ( ((data) ? (soap_default_SOAP_ENV__Fault(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get_SOAP_ENV__Fault(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Reason_DEFINED
#define SOAP_TYPE_SOAP_ENV__Reason_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *, const char*, const char*);
#ifndef soap_write_SOAP_ENV__Reason
#define soap_write_SOAP_ENV__Reason(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize_SOAP_ENV__Reason(soap, data), 0) || soap_put_SOAP_ENV__Reason(soap, data, "SOAP-ENV:Reason", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *, const char*, const char*);
#ifndef soap_read_SOAP_ENV__Reason
#define soap_read_SOAP_ENV__Reason(soap, data) ( ((data) ? (soap_default_SOAP_ENV__Reason(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get_SOAP_ENV__Reason(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Detail_DEFINED
#define SOAP_TYPE_SOAP_ENV__Detail_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *, const char*, const char*);
#ifndef soap_write_SOAP_ENV__Detail
#define soap_write_SOAP_ENV__Detail(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize_SOAP_ENV__Detail(soap, data), 0) || soap_put_SOAP_ENV__Detail(soap, data, "SOAP-ENV:Detail", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *, const char*, const char*);
#ifndef soap_read_SOAP_ENV__Detail
#define soap_read_SOAP_ENV__Detail(soap, data) ( ((data) ? (soap_default_SOAP_ENV__Detail(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get_SOAP_ENV__Detail(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Code_DEFINED
#define SOAP_TYPE_SOAP_ENV__Code_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *, const char*, const char*);
#ifndef soap_write_SOAP_ENV__Code
#define soap_write_SOAP_ENV__Code(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize_SOAP_ENV__Code(soap, data), 0) || soap_put_SOAP_ENV__Code(soap, data, "SOAP-ENV:Code", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *, const char*, const char*);
#ifndef soap_read_SOAP_ENV__Code
#define soap_read_SOAP_ENV__Code(soap, data) ( ((data) ? (soap_default_SOAP_ENV__Code(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get_SOAP_ENV__Code(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_SOAP_ENV__Header_DEFINED
#define SOAP_TYPE_SOAP_ENV__Header_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header *, const char*);
SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap*, const char*, struct SOAP_ENV__Header *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *, const char*, const char*);
#ifndef soap_write_SOAP_ENV__Header
#define soap_write_SOAP_ENV__Header(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize_SOAP_ENV__Header(soap, data), 0) || soap_put_SOAP_ENV__Header(soap, data, "SOAP-ENV:Header", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *, const char*, const char*);
#ifndef soap_read_SOAP_ENV__Header
#define soap_read_SOAP_ENV__Header(soap, data) ( ((data) ? (soap_default_SOAP_ENV__Header(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get_SOAP_ENV__Header(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#endif
#ifndef SOAP_TYPE___ns1__Sumar_DEFINED
#define SOAP_TYPE___ns1__Sumar_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default___ns1__Sumar(struct soap*, struct __ns1__Sumar *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize___ns1__Sumar(struct soap*, const struct __ns1__Sumar *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out___ns1__Sumar(struct soap*, const char*, int, const struct __ns1__Sumar *, const char*);
SOAP_FMAC3 struct __ns1__Sumar * SOAP_FMAC4 soap_in___ns1__Sumar(struct soap*, const char*, struct __ns1__Sumar *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put___ns1__Sumar(struct soap*, const struct __ns1__Sumar *, const char*, const char*);
#ifndef soap_write___ns1__Sumar
#define soap_write___ns1__Sumar(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize___ns1__Sumar(soap, data), 0) || soap_put___ns1__Sumar(soap, data, "-ns1:Sumar", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct __ns1__Sumar * SOAP_FMAC4 soap_get___ns1__Sumar(struct soap*, struct __ns1__Sumar *, const char*, const char*);
#ifndef soap_read___ns1__Sumar
#define soap_read___ns1__Sumar(soap, data) ( ((data) ? (soap_default___ns1__Sumar(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get___ns1__Sumar(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#ifndef SOAP_TYPE__ns1__SumarResponse_DEFINED
#define SOAP_TYPE__ns1__SumarResponse_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default__ns1__SumarResponse(struct soap*, struct _ns1__SumarResponse *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__ns1__SumarResponse(struct soap*, const struct _ns1__SumarResponse *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out__ns1__SumarResponse(struct soap*, const char*, int, const struct _ns1__SumarResponse *, const char*);
SOAP_FMAC3 struct _ns1__SumarResponse * SOAP_FMAC4 soap_in__ns1__SumarResponse(struct soap*, const char*, struct _ns1__SumarResponse *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put__ns1__SumarResponse(struct soap*, const struct _ns1__SumarResponse *, const char*, const char*);
#ifndef soap_write__ns1__SumarResponse
#define soap_write__ns1__SumarResponse(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize__ns1__SumarResponse(soap, data), 0) || soap_put__ns1__SumarResponse(soap, data, "ns1:SumarResponse", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct _ns1__SumarResponse * SOAP_FMAC4 soap_get__ns1__SumarResponse(struct soap*, struct _ns1__SumarResponse *, const char*, const char*);
#ifndef soap_read__ns1__SumarResponse
#define soap_read__ns1__SumarResponse(soap, data) ( ((data) ? (soap_default__ns1__SumarResponse(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get__ns1__SumarResponse(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#ifndef SOAP_TYPE__ns1__Sumar_DEFINED
#define SOAP_TYPE__ns1__Sumar_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default__ns1__Sumar(struct soap*, struct _ns1__Sumar *);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__ns1__Sumar(struct soap*, const struct _ns1__Sumar *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out__ns1__Sumar(struct soap*, const char*, int, const struct _ns1__Sumar *, const char*);
SOAP_FMAC3 struct _ns1__Sumar * SOAP_FMAC4 soap_in__ns1__Sumar(struct soap*, const char*, struct _ns1__Sumar *, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put__ns1__Sumar(struct soap*, const struct _ns1__Sumar *, const char*, const char*);
#ifndef soap_write__ns1__Sumar
#define soap_write__ns1__Sumar(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || (soap_serialize__ns1__Sumar(soap, data), 0) || soap_put__ns1__Sumar(soap, data, "ns1:Sumar", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 struct _ns1__Sumar * SOAP_FMAC4 soap_get__ns1__Sumar(struct soap*, struct _ns1__Sumar *, const char*, const char*);
#ifndef soap_read__ns1__Sumar
#define soap_read__ns1__Sumar(soap, data) ( ((data) ? (soap_default__ns1__Sumar(soap, (data)), 0) : 0) || soap_begin_recv(soap) || !soap_get__ns1__Sumar(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason_DEFINED
#define SOAP_TYPE_PointerToSOAP_ENV__Reason_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char *, int, struct SOAP_ENV__Reason *const*, const char *);
SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason **, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason **, const char*, const char*);
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail_DEFINED
#define SOAP_TYPE_PointerToSOAP_ENV__Detail_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap*, const char *, int, struct SOAP_ENV__Detail *const*, const char *);
SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail **, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail **, const char*, const char*);
#endif
#endif
#ifndef WITH_NOGLOBAL
#ifndef SOAP_TYPE_PointerToSOAP_ENV__Code_DEFINED
#define SOAP_TYPE_PointerToSOAP_ENV__Code_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap*, const char *, int, struct SOAP_ENV__Code *const*, const char *);
SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code **, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*, const char*, const char*);
SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code **, const char*, const char*);
#endif
#endif
#ifndef SOAP_TYPE_PointerTo_ns1__SumarResponse_DEFINED
#define SOAP_TYPE_PointerTo_ns1__SumarResponse_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTo_ns1__SumarResponse(struct soap*, struct _ns1__SumarResponse *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTo_ns1__SumarResponse(struct soap*, const char *, int, struct _ns1__SumarResponse *const*, const char *);
SOAP_FMAC3 struct _ns1__SumarResponse ** SOAP_FMAC4 soap_in_PointerTo_ns1__SumarResponse(struct soap*, const char*, struct _ns1__SumarResponse **, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTo_ns1__SumarResponse(struct soap*, struct _ns1__SumarResponse *const*, const char*, const char*);
SOAP_FMAC3 struct _ns1__SumarResponse ** SOAP_FMAC4 soap_get_PointerTo_ns1__SumarResponse(struct soap*, struct _ns1__SumarResponse **, const char*, const char*);
#endif
#ifndef SOAP_TYPE_PointerTo_ns1__Sumar_DEFINED
#define SOAP_TYPE_PointerTo_ns1__Sumar_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTo_ns1__Sumar(struct soap*, struct _ns1__Sumar *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTo_ns1__Sumar(struct soap*, const char *, int, struct _ns1__Sumar *const*, const char *);
SOAP_FMAC3 struct _ns1__Sumar ** SOAP_FMAC4 soap_in_PointerTo_ns1__Sumar(struct soap*, const char*, struct _ns1__Sumar **, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTo_ns1__Sumar(struct soap*, struct _ns1__Sumar *const*, const char*, const char*);
SOAP_FMAC3 struct _ns1__Sumar ** SOAP_FMAC4 soap_get_PointerTo_ns1__Sumar(struct soap*, struct _ns1__Sumar **, const char*, const char*);
#endif
#ifndef SOAP_TYPE__XML_DEFINED
#define SOAP_TYPE__XML_DEFINED
#endif
#ifndef SOAP_TYPE__QName_DEFINED
#define SOAP_TYPE__QName_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap*, char **);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap*, char *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap*, const char*, int, char*const*, const char*);
SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap*, const char*, char **, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap*, char *const*, const char*, const char*);
#ifndef soap_write__QName
#define soap_write__QName(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || soap_put__QName(soap, data, "QName", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap*, char **, const char*, const char*);
#ifndef soap_read__QName
#define soap_read__QName(soap, data) ( soap_begin_recv(soap) || !soap_get__QName(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#ifndef SOAP_TYPE_string_DEFINED
#define SOAP_TYPE_string_DEFINED
SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char **);
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap*, char *const*);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap*, const char*, int, char*const*, const char*);
SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap*, const char*, char **, const char*);
SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap*, char *const*, const char*, const char*);
#ifndef soap_write_string
#define soap_write_string(soap, data) ( soap_free_temp(soap), soap_begin_send(soap) || soap_put_string(soap, data, "string", NULL) || soap_end_send(soap), (soap)->error )
#endif
SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap*, char **, const char*, const char*);
#ifndef soap_read_string
#define soap_read_string(soap, data) ( soap_begin_recv(soap) || !soap_get_string(soap, (data), NULL, NULL) || soap_end_recv(soap), (soap)->error )
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif
最后是我的ASMX文件
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace MyService
{
/// <summary>
/// Summary description for WCdata
/// </summary>
[WebService(Namespace = "http://localhost/MyService/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WCdata : System.Web.Services.WebService
{
[WebMethod]
public int Sumar(int a, int b)
{
return (a + b);
}
}
}
答案 0 :(得分:0)
最后我解决了这个问题。我必须做一些事情,现在我解释一下。
如果我的英语不完美,请在开始发帖之前抱歉。
首先,您必须注意您正在使用的编译器。编译器存在一些问题,您应该尝试在SO中只安装一个并在Global Path Variable中设置。
也许您必须关闭防火墙并停止使用某些代理,如果您使用的是为了丢弃这个可能的错误。
然后请确保使用gsoap工具(wsdl2h,soapcpp2)的所有生成文件处理都可以。
如果您完成了所有步骤,则会出现错误:
&#34; stdsoap2.c对wctomb_s&#34;
的未定义引用
你必须在12626和12839行编辑stdsoap2.c文件,注释代码
//m = 0;
//wctomb_s(&m, buf, sizeof(buf), (wchar_t)(c & 0x7FFFFFFF));
并添加行代码
m = wctomb(buf, (wchar_t)(c & 0x7FFFFFFF));
结果:
m = wctomb(buf, (wchar_t)(c & 0x7FFFFFFF));
//m = 0;
//wctomb_s(&m, buf, sizeof(buf), (wchar_t)(c & 0x7FFFFFFF));
然后你应该有更多问题,第二部分就是你得到错误415。
如果您有错误415,则是comunicate客户端 - 服务器之间的冲突错误,因此您必须确定客户端请求和服务器端接收,客户端接收和服务器端响应是否使用相同的SOAP协议版本(1.1, 1.2)所以你可能需要更改你的SOAP命名空间文件&#34; xxxxxx.nsmap&#34;。
SOAP_NMAC struct Namespace namespaces[] = {
{"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org/2003/05/soap-envelope", NULL},
{"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org/2003/05/soap-encoding", NULL},
{"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL},
{"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL},
{"arr", "http://schemas.microsoft.com/2003/10/Serialization/Arrays", NULL, NULL},
{"tempuri", "http://tempuri.org/", NULL, NULL},
{NULL, NULL, NULL, NULL}
};
看这个命名空间等于肥皂1.1
"http://schemas.xmlsoap.org/soap/envelope/"
"http://schemas.xmlsoap.org/soap/encoding/"
另一个等于肥皂1.2
"http://www.w3.org/2003/05/soap-envelope"
"http://www.w3.org/2001/XMLSchema-instance"
解决错误415,你应该改变名称空间的顺序或使用de -1命令更改gsoap文件编译模式以强制使用1.1版本。像这个例子:
soapcpp2 -CL -I(gsoap /Import path) -1 (file generated wsdl2h).h
总而言之,在完成所有步骤之后,您最终可以毫无问题地使用您的服务方法。