string如何转换成xsd__base64Binary*

liguicheng2006 2011-05-30 02:44:25
新用gSOAP,C++也很多不记得了,请指教:
我用CXF写了services,服务正常;用gSOAP生成了客户端代码,在VS2008建立了C++工程,调用了简单的services,正常;但某些服务中的参数使用byte[],即一个二进制数组,它用来传送文件。gSOAP将这些服务的byte[]参数生成了 class SOAP_CMAC xsd__base64Binary 类(在生成代码的soapStub.h中)。

class SOAP_CMAC xsd__base64Binary
{
public:
unsigned char *__ptr;
int __size;
char *id; /* optional element of type xsd:string */
char *type; /* optional element of type xsd:string */
char *options; /* optional element of type xsd:string */
struct soap *soap; /* transient */
public:
virtual int soap_type() const { return 8; } /* = unique id SOAP_TYPE_xsd__base64Binary */
virtual void soap_default(struct soap*);
virtual void soap_serialize(struct soap*) const;
virtual int soap_put(struct soap*, const char*, const char*) const;
virtual int soap_out(struct soap*, const char*, int, const char*) const;
virtual void *soap_get(struct soap*, const char*, const char*);
virtual void *soap_in(struct soap*, const char*, const char*);
xsd__base64Binary() { xsd__base64Binary::soap_default(NULL); }
virtual ~xsd__base64Binary() { }
};

在客户端,我可以读取文件到一个string里,但怎么样将string变成xsd__base64Binary* 呢?
下面这个帖子应该是类似问题,但他说简单而无写出来
http://topic.csdn.net/u/20090211/23/E29112E8-4E36-463C-8344-4387EA3CBF04.html

谢谢回复。
...全文
598 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
十八道胡同 2012-10-10
  • 打赏
  • 举报
回复
unsigned char *__ptr; //这里存贮的是长度为__size的string
int __size;

其他的
char *id; /* optional element of type xsd:string */
char *type; /* optional element of type xsd:string */
char *options; /* optional element of type xsd:string */
struct soap *soap; /* transient */

为空就是了。
你可以试下。可以参考
aidame 2012-10-10
  • 打赏
  • 举报
回复
memset,memcpy
nietsche 2011-10-24
  • 打赏
  • 举报
回复
关注中...

65,208

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧