gSoap Exchange Web服务连接 [英] gSoap Exchange Web Services Connection

查看:242
本文介绍了gSoap Exchange Web服务连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编写一个可以与EWS代理类一起使用的应用程序。为了生成代理类,我使用gsoap(编译的OpenSSL)。
我实现了一个与EWS协同工作的库,但是。净。
问题是这样的:我不知道如何实现到服务器的连接。
执行以下操作:

I'm trying to write an application that would work with the EWS proxy classes. To generate proxy classes I used gsoap (compiled OpenSSL). I have implemented a library that works with EWS, but. Net. The problem is this: I have no idea how to implement a connection to the server. Doing the following:

ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy("https://192.168.0.49/EWS/exchange.asmx");
soap *pSoap = proxy->soap;
pSoap->userid = "user1";
pSoap->passwd = "password1";
pSoap->recv_timeout = 300;
pSoap->send_timeout = 300;

SOAP_ENV__Header *header = new SOAP_ENV__Header();
header->ns3__RequestServerVersion = new _ns3__RequestServerVersion();
header->ns3__RequestServerVersion->soap = pSoap;
header->ns3__RequestServerVersion->Version = ns3__ExchangeVersionType__Exchange2010;
pSoap->header = header;

//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;

//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;

//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;


int error = proxy->GetFolder(gftRoot, response);

结果,得到错误:SLL_ERROR。

As a result, getting the error: SLL_ERROR.

我知道,我做错了。但是什么?我应该做什么,使用代理类功能?

I know, that i`m doing something wrong. But what? What i should to do, to use proxy classes functions?

推荐答案

我自己解决:
添加到项目LibNTLM并添加到预处理器WITH_NTLM。

I resolved it by myself: Added to project LibNTLM and added to preprocessor WITH_NTLM.

也更改了一些代码:

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

soap *pSoap = proxy->soap;
pSoap->userid = "Ivan1";
pSoap->passwd = "1";
pSoap->ntlm_challenge = "";
pSoap->authrealm = "Ursa-Minor";

pSoap->ssl_flags = SOAP_SSL_NO_AUTHENTICATION;
//pSoap->keep_alive = true; 
pSoap->mode = SOAP_IO_KEEPALIVE;

//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;

//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;

//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__size_NonEmptyArrayOfBaseFolderIdsType = 1;
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderIds = (ns3__NonEmptyArrayOfBaseFolderIdsType*)dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;

int qq = proxy->GetFolder(gftRoot, response);

return true;

但现在我还有其他问题:错误500:内部伺服器错误

But now i have enother problems: Error 500: Internal Server Error

这篇关于gSoap Exchange Web服务连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆