gSoap EWS “Error 500: Internal Server Error”

前端 未结 2 958
小鲜肉
小鲜肉 2021-01-27 10:59

I have some problems with ews(gSoap).

I have next code:

ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy(endpoint.c_str());

soap *pS         


        
相关标签:
2条回答
  • 2021-01-27 11:09

    Well, i figured out how to make it works:

    //get folder
        ns1__GetFolderType *gftRoot = new ns1__GetFolderType(); 
        gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
        gftRoot->FolderIds->__size_NonEmptyArrayOfBaseFolderIdsType = 1; //there we specify how many folders elements in FolderIds array
        gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType(); //create one element of array
        gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->__union_NonEmptyArrayOfBaseFolderIdsType = 2; //this indicates, which class/structure are taken from union
        gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit; //push dfit to element
        gftRoot->FolderShape = frst;
    
        __ns1__GetFolderResponse response;
    
        int ret = proxy->GetFolder(gftRoot, response);
    
    0 讨论(0)
  • 2021-01-27 11:23

    IStar,

    First off, I'm not familiar with gSOAP nor am I familiar with this syntax. In fact, I don't expect to answer your question but I'll give it a shot. With that said, gSOAP is trying to create XML that is not supported by EWS. I think the following lines are incorrect, and there probably needs to be another line or two:

    gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
    gftRoot->FolderIds = (ns3__NonEmptyArrayOfBaseFolderIdsType*)dfit;
    

    I think that second line is instructing gSOAP to make the FolderIds element to be something it shouldn't be. It looks like there is some sort of conflation of the FolderIds and DistinguishedFolderId element structure.

    Perhaps it should look something like:

    ns3__NonEmptyArrayOfBaseFolderIdsType *fids = new ns3__NonEmptyArrayOfBaseFolderIdsType();
    fids->DistinguishedFolderId = dfit
    fids->__size_NonEmptyArrayOfBaseFolderIdsType = 1;
    gftRoot->FolderIds = fids;
    
    0 讨论(0)
提交回复
热议问题