gSOAP 关于 xsd__base64Binary* 的问题

liguicheng2006 2011-05-26 09:59:02
新用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

谢谢回复。
...全文
1698 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ColaCoding 2012-12-29
  • 打赏
  • 举报
回复
关注一下.
nietsche 2011-10-24
  • 打赏
  • 举报
回复
字符串转换成base64binary直接xsd__base64Binary.__ptr = soap_malloc(...);

如果是从服务器接收base64binary数据:先soap_new_xsd__base64Binary(&soap,-1,...);然后调用:soap_call___ns3__XYZ(...);最后读取即可:soap_get_xsd__base64Binary(...)
d2lod 2011-06-01
  • 打赏
  • 举报
回复
直接给ptr和size赋值
liguicheng2006 2011-05-30
  • 打赏
  • 举报
回复
没有回复吗?Oh, no~~

8,909

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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