java发布webservice(略)
1. Java 定义好WebService接口,生成WSDL标准接口文件。
VS2008调用:
1. 新建—-项目—-VC++—–WIN32控制台
2. 项目–右键–属性
公共语言运行支持:选择clr
3.项目–右键–添加web引用
输入url:………wsdl—前往
找到web服务后添加引用,生成一个头文件(就看这个调用了),和其他文件
最后在该用的地方调用头文件和命名空间就行了
#include "stdafx.h"
#include "localhost.h"
#include <iostream>
using namespace std;
using namespace localhost;
using namespace System;
using namespace System::Runtime::InteropServices;
int _tmain(int argc, _TCHAR* argv[])
{
DemoService ds;
String ^st=ds.GetFileOfProject("c463af14b58148d8a63b503a");
const char* str = (char*)(Marshal::StringToHGlobalAnsi(st)).ToPointer();//用到托管于一般的转换
......
return 0;