Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ gSoap客户端中的分段错误_C++_Segmentation Fault_Gsoap - Fatal编程技术网

C++ gSoap客户端中的分段错误

C++ gSoap客户端中的分段错误,c++,segmentation-fault,gsoap,C++,Segmentation Fault,Gsoap,我正在使用gSoap从exchange server获取服务器的时区,我的客户端代码是: #include "soapExchangeServiceBindingProxy.h" #include "ExchangeServiceBinding.nsmap" int main() { ExchangeServiceBindingProxy service; service.soap_endpoint = "https://outlook.office365.com/ews/e

我正在使用gSoap从exchange server获取服务器的时区,我的客户端代码是:

#include "soapExchangeServiceBindingProxy.h"
#include "ExchangeServiceBinding.nsmap"


int main()
{
    ExchangeServiceBindingProxy service;
    service.soap_endpoint = "https://outlook.office365.com/ews/exchange.asmx";

    ns1__GetServerTimeZonesType request;
    __ns1__GetServerTimeZonesResponse response;


    const std::string s("Eastern Standard Time");
    request.Ids = (ns2__NonEmptyArrayOfTimeZoneIdType *)&s;



    if(service.GetServerTimeZones(&request , response) == SOAP_OK){

        std::cout << "Success Response: "<< response.ns1__GetServerTimeZonesResponse << std::endl;
    }
    else
      service.soap_stream_fault(std::cerr); 
   service.destroy(); // delete data and release memory 

   return 0;
}
#包括“soapExchangeServiceBindingProxy.h”
#包括“ExchangeServiceBinding.nsmap”
int main()
{
ExchangeServiceBindingProxy服务;
service.soap_端点=”https://outlook.office365.com/ews/exchange.asmx";
ns1__GetServerTimeZoneType请求;
__ns1__GetServerTimeZoneResponse响应;
常量std::字符串s(“东部标准时间”);
request.Ids=(ns2_uunonemptyarrayoftimezoneidtype*)&s;
if(service.GetServerTimeZones(&request,response)==SOAP\u OK){

std::cout
这段代码编译成功,但当我试图运行它时,
成功编译只意味着你的程序没有语法错误,所有函数调用都已解决。这与程序是否能根据你的要求正确运行无关。这就是调试的全部内容。
it give Segmentation fault,
哪一行给出了Segmentation fault?谢谢Paul,我想我有这个Segmentation fault是因为exchange server上的auth.用于获取数据。这看起来很可疑,而且我从未使用过gSoap:
const std::string s(“东部标准时间”);request.Ids=(ns2\uu NonEmptyArrayOfTimeZoneIdType*)&s、 
传递
std::string
的地址除了强制转换外,还需要接收者(
request.Ids
)理解
std::string
是什么,以便将其强制转换回
std::string
并正确使用。如果您的任何一个代码将“解包”,则会进行这种类型的编码
std::string的值,或者工具箱本身知道如何处理它。我看不到任何一种情况的迹象——也许你可以解释一下。如果我删除cast,我会遇到一个错误
错误:无法将赋值中的“const std::string*”转换为“ns2_unonemptyarrayoftimezoneidype*”
此代码编译成功但是当我试着运行它时,
成功编译只意味着你的程序没有语法错误,所有的函数调用都已解决。这与程序是否能按照你的要求正确运行无关。这就是调试的全部内容。
它给出了分段错误,
哪一行给出了错误分段错误是什么?谢谢Paul,我想我有这个分段错误是由于exchange server上获取数据的身份验证造成的。这看起来很可疑,而且我从未使用过gSoap:
const std::string s(“东部标准时间”);request.id=(ns2_unonemptyarrayoftimezoneidtype*)&s、 
传递
std::string
的地址除了强制转换外,还需要接收者(
request.Ids
)理解
std::string
是什么,以便将其强制转换回
std::string
并正确使用。如果您的任何一个代码将“解包”,则会进行这种类型的编码
std::string的值,或者工具箱本身知道如何处理它。我看不到任何一种情况的迹象——也许你可以解释一下。如果我删除cast,我会遇到一个错误
错误:无法将赋值中的“const std::string*”转换为“ns2_unonemptyarrayoftimezoneidype*”
此代码编译成功但是当我试着运行它时,
成功编译只意味着你的程序没有语法错误,所有的函数调用都已解决。这与程序是否能按照你的要求正确运行无关。这就是调试的全部内容。
它给出了分段错误,
哪一行给出了错误分段错误是什么?谢谢Paul,我想我有这个分段错误是由于exchange server上获取数据的身份验证造成的。这看起来很可疑,而且我从未使用过gSoap:
const std::string s(“东部标准时间”);request.id=(ns2_unonemptyarrayoftimezoneidtype*)&s、 
传递
std::string
的地址除了强制转换外,还需要接收者(
request.Ids
)理解
std::string
是什么,以便将其强制转换回
std::string
并正确使用。如果您的任何一个代码将“解包”,则会进行这种类型的编码
std::string的值,或者工具箱本身知道如何处理它。我看不到任何一种情况的迹象——也许你可以解释一下。如果我删除cast,我会遇到一个错误
error:无法将赋值中的“const std::string*”转换为“ns2\uu nonemptyarrayoftimezoneidype*”