wireshark抓包,电脑发出的包protocol是IP?,本该是HTTP/XML的嘛,它的xml包也正常。
代码贴在一楼。
求教,怎样修改才能发出 HTTP/XML包呢?
int UserGetCapabilities( )
{
int retval = 0;
struct soap *soap = NULL;
struct tds_GetCapabilities capa_req;
struct tds_GetCapabilitiesResponse capa_resp;
enum tt__CapabilityCategory temp_category;
struct SOAP_ENV__Header header;
soap = soap_new(); //初始化soap
if(soap==NULL)
printf("Soap初始化失败!");
soap_set_namespaces(soap, namespaces); //设置命名空间
soap_default_SOAP_ENV__Header(soap, &header);
soap->header = &header;
char *soap_endpoint = (char *)malloc(256);
memset(soap_endpoint, '\0', 256);
sprintf(soap_endpoint, "http://%s:%d/onvif/device_service", "10.0.10.207", 80);
capa_req.Category = (enum tt__CapabilityCategory *)soap_malloc(soap, sizeof(int));
capa_req.__sizeCategory = 1;
temp_category = tt__CapabilityCategory__Media;
capa_req.Category = &temp_category;
//此句也可以不要,因为在接口soap_call___tds__GetCapabilities中判断了,如果此值为NULL,则会给它赋值
const char *soap_action = "http://www.onvif.org/ver10/device/wsdl/GetCapabilities";
soap_wsse_add_UsernameTokenDigest(soap,"user", ONVIF_USER, ONVIF_PASSWORD);
do
{
soap_call___tds__GetCapabilities(soap, soap_endpoint, soap_action, &capa_req, &capa_resp);
if (soap->error)
{
printf(" soap error: %d, %s, %s\n", soap->error, *soap_faultcode(soap), *soap_faultstring(soap));
retval = soap->error;
break;
}
else //获取参数成功
{
printf("Get capabilities success !\n");
printf("\n%s\n", capa_resp.Capabilities->Media->XAddr);
}
}while(0);
free(soap_endpoint);
soap_endpoint = NULL;
soap_destroy(soap);
return retval;
}
这是代码,没有C币了...
希望了解的能帮帮忙!!