gsoap可以在android上使用吗

gsoap可以在android上使用吗,第1张

PHP webservices 的soap的问题,发出的消息包不稳定,与gsoap无关。ndroid真机用wifi和PC 服务器连接的。

android coco2dx2.2 通过gsoap和服务器的gsoap通悉樱信睁带丛的。

服务器可以收行州到包。

这个问题的解决磨喊迟渗拆方法是:

在你的工程中添加语句 #include "xxxx.nsmap" XXXX你知道是什么的,这个是soapcpp2 xx.h后生成的命名空间瞎李文件

一、WebService在cs后台程序中的调用

A、通过命名空间和类名直接调用

示例

WebService ws = new WebService()

string s = ws.HelloWorld()

B、通过添加WEB引则态用的方式调用,首先添加WEB引用,通过URL指向WEBSERVICE,

指定WEB引用名,假设为KK

示例:

kk.WebService n = new kk.WebService()

string ss=n.HelloWorld()

二、WebService在前台页面的JS 调用方法

1、首先通过下面的方法把Webservice在前台引用进来

<asp:ScriptManager runat="server">

<Services>

<asp:ServiceReference Path="WebService.asmx" InlineScript="True" />

</Services>

</asp:ScriptManager>

2、然后就可以通过派盯亏JS程序进行调用,示例如下:

<script type="text/jscript">

function a()

{

WebService.HelloWorld(onresult)

}

//这里的onresult是回调函数

function onresult(result)

{

alert(result)

}

function b()

{

WebService.add(1,2,onreturn)

}

function onreturn(result)

{

alert(result)

}

//下面的'context'是上尘神下文,可以通过回到函数通过重载的方式获得;

function c()

{

WebService.div(1,1,onresultC,onerror,'context')

}

function onresultC(res,c)

{

alert(res)

alert(c)

}

//onerror是获得异常信息的回调函数,下面给出了获得异常信息的方法

function onerror(error)

{

var a=""

a=String.format("获取服务器端异常的具体类型:{0}\t\n获取详细的异常描述信息:{1}\t\n获取造成异常的:{2}\t\n获取服务器端异常的堆栈

跟踪信息:{3}\t\n获取一个布尔值,表示异常是否是由于网络连接超时造成的{4}",

error.get_exceptionType(),

error.get_message(),

error.get_statusCode(),

error.get_stackTrace(),

error.get_timedOut())

alert(a)

}

a()

b()

c()

</script>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/12142479.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-21
下一篇 2023-05-21

发表评论

登录后才能评论

评论列表(0条)

保存