用C++和gsoap开发的连接Web Service报以下错误,不知道什么原因,google之也没“见”着有帮助的信息。
求教大伙~~
2009-10-20 09:36:21:812 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:?V
2009-10-20 09:36:21:875 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:?V
2009-10-20 09:36:21:937 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:餘V
2009-10-20 09:36:22:000 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:繫V
2009-10-20 09:36:22:062 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:怢V
2009-10-20 09:36:22:125 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:`KV
2009-10-20 09:36:22:203 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:0JV
2009-10-20 10:28:35:406 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:?R
求教大伙~~
2009-10-20 09:36:21:812 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:?V
2009-10-20 09:36:21:875 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:?V
2009-10-20 09:36:21:937 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:餘V
2009-10-20 09:36:22:000 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:繫V
2009-10-20 09:36:22:062 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:怢V
2009-10-20 09:36:22:125 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:`KV
2009-10-20 09:36:22:203 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:0JV
2009-10-20 10:28:35:406 SOAP 1.1 fault: SOAP-ENV:Server [no subcode]
"BIP3113E: Exception detected in message flow HTTP Input (broker BROKER2) "
Detail:?R
开发的是客户端。
还需要其他什么信息来进一步确认这些错误原因么?对这方面不太懂,感谢指导!!!
你这是运行日志阿?
先确定以下几个问题阿:
1. 你写的是客户端,那server提供的WSDL呢?
照着那个WSDL生成你的头文件,只要能便宜运行过去,问题就不大了。
2. 如果知道你要连接的service的url,你可以用浏览器先连一下看看返回的什么结果。
- <NS1:Body>
- <NS1:Fault>
<faultstring><Exception><ExceptionData><RecoverableException><File>/build/S600_P/src/DataFlowEngine/BasicNodes/ImbRouterNode.cpp</File><Line>294</Line><Function>ImbRouterNode::evaluate</Function><Type>ComIbmRouteToLabelNode</Type><Name>main/ClientFlow#FCMComposite_1_7.main/ServerFlow#FCMComposite_1_3</Name><Label>main.ClientFlow.ServerFlow.RouteToLabel</Label><Catalog>BIPv600</Catalog><Severity>3</Severity><Number>4240</Number><Text>Invalid label name</Text><Insert><Type>5</Type><Text></Text></Insert></RecoverableException></ExceptionData><Header/><BrokerData><BrokerName>BROKER2</BrokerName><ExecutionGroupLabel>eg8</ExecutionGroupLabel><MessageFlowLabel>main.ClientFlow</MessageFlowLabel><NodeLabel>ServerFlow.ErrorHandlerFlow.Compute</NodeLabel><MsgId>414d512042524f4b4552325f514d20204abe366d208a8ee9</MsgId><ThrowTimestamp>2009-10-20 12:11:35.797345</ThrowTimestamp><Accessor>192.168.117.8</Accessor><AccessorType>SOAP-HTTP</AccessorType></BrokerData><UserData><Properties><MessageSet></MessageSet><MessageType></MessageType><MessageFormat></MessageFormat><Encoding>546</Encoding><CodedCharSetId>1208</CodedCharSetId><Transactional>FALSE</Transactional><Persistence>FALSE</Persistence><CreationTime>2009-10-15 05:01:11.070797</CreationTime><ExpirationTime>-1</ExpirationTime><Priority>0</Priority><ReplyIdentifier>000000000000000000000000000000000000000000000000</ReplyIdentifier><ReplyProtocol>SOAP-HTTP</ReplyProtocol><Topic></Topic><ContentType></ContentType></Properties><HTTPInputHeader><X-Original-HTTP-Command>GET http://192.168.130.106:9106/SuNingServiceWeb/mb HTTP/1.1</X-Original-HTTP-Command><Accept>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*</Accept><Accept-Language>zh-cn</Accept-Language><Accept-Encoding>gzip, deflate</Accept-Encoding><User-Agent>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 590; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 1.1.4322)</User-Agent><Host>192.168.130.106:9106</Host><Connection>Keep-Alive</Connection><X-Remote-Addr>192.168.117.8</X-Remote-Addr><X-Remote-Host>192.168.117.8</X-Remote-Host><X-Server-Name>192.168.130.106</X-Server-Name><X-Server-Port>9106</X-Server-Port><X-Scheme>http</X-Scheme></HTTPInputHeader></UserData></Exception></faultstring>
</NS1:Fault>
</NS1:Body>
</NS1:Envelope>
这是连service的url情况 。这个是生产机的。
这边还有一套测试机。用提供的wsdl生成相关头文件,连测试机是一直成功的,以下是测试机service url情况:- <NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">
- <NS1:Body>
- <NS1:Fault>
<faultstring><Exception><ExceptionData><RecoverableException><File>F:\build\S600_P\src\DataFlowEngine\BasicNodes\ImbRouterNode.cpp</File><Line>294</Line><Function>ImbRouterNode::evaluate</Function><Type>ComIbmRouteToLabelNode</Type><Name>main/ClientFlow#FCMComposite_1_7.main/ServerFlow#FCMComposite_1_3</Name><Label>main.ClientFlow.ServerFlow.RouteToLabel</Label><Catalog>BIPv600</Catalog><Severity>3</Severity><Number>4240</Number><Text>Invalid label name</Text><Insert><Type>5</Type><Text></Text></Insert></RecoverableException></ExceptionData><Header/><BrokerData><BrokerName>MB_BROKER</BrokerName><ExecutionGroupLabel>mbf</ExecutionGroupLabel><MessageFlowLabel>main.ClientFlow</MessageFlowLabel><NodeLabel>ServerFlow.ErrorHandlerFlow.Compute</NodeLabel><MsgId>414d51204d425f42524f4b45525f514db998b54a26c28807</MsgId><ThrowTimestamp>2009-10-20 12:10:02.864858</ThrowTimestamp><Accessor>192.168.100.53:9106</Accessor><AccessorType>SOAP-HTTP</AccessorType></BrokerData><UserData><Properties><MessageSet></MessageSet><MessageType></MessageType><MessageFormat></MessageFormat><Encoding>546</Encoding><CodedCharSetId>1208</CodedCharSetId><Transactional>FALSE</Transactional><Persistence>FALSE</Persistence><CreationTime>2009-10-19 11:59:53.585</CreationTime><ExpirationTime>-1</ExpirationTime><Priority>0</Priority><ReplyIdentifier>000000000000000000000000000000000000000000000000</ReplyIdentifier><ReplyProtocol>SOAP-HTTP</ReplyProtocol><Topic></Topic><ContentType></ContentType></Properties><HTTPInputHeader><X-Original-HTTP-Command>GET http://192.168.100.53:9106/SuNingServiceWeb/mb HTTP/1.1</X-Original-HTTP-Command><Accept>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*</Accept><Accept-Language>zh-cn</Accept-Language><Accept-Encoding>gzip, deflate</Accept-Encoding><User-Agent>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 590; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 1.1.4322)</User-Agent><Host>192.168.100.53:9106</Host><Connection>Keep-Alive</Connection></HTTPInputHeader></UserData></Exception></faultstring>
</NS1:Fault>
</NS1:Body>
</NS1:Envelope>
因为你用浏览器打开URL,所以是异常的soap信息,你贴给我的的两个就是两个服务报的异常,好像没什么太大用处,不过终于算是看懂了你的日志提示的什么东西了。看看下面的东西或许对你有帮助,应该不是使用gsoap的问题,和你配置的消息内容有关系。
http://www.ibm.com/developerworks/cn/websphere/library/techarticles/0806_crocker/0806_crocker.html
以下是连ws以及测试程序……
#include "stdafx.h"
#include "soapH.h"
#include "CrmServiceHttpBinding.nsmap"
#include<stdio.h>
#include "Common.h"int SendParamter( char *posseg, char *externalCard, char *password )
{
ns2__MBFRequestHeader header; //定义的header
ns3__verifyPasswordRequestBody body; //定义的body
ns3__verifyPasswordRequest request; //定义的request
ns3__verifyPasswordResponse response;//定义的response
_ns3__verifyPassword soapinput;// 定义的输入
_ns3__verifyPasswordResponse soapoutput;// 定义的输出
//初始化soap
struct soap soap;
soap_init ( &soap );
// const char* server = "http://192.168.100.53:9106/SuNingServiceWeb/mb";//定义测试服务器的URL
// const char* server = "http://192.168.130.106:9106/SuNingServiceWeb/mb";//定义生产服务器的URL
const char* server = "http://192.168.134.66:9106/SuNingServiceWeb/mb";//定义PRE服务器的URL
//给输入变量赋值
header.MBServiceCode = "MBF_CRM_VERIFYPASSWORD";
body.POSID = "00000017";
body.POSPWD = "123456";
body.POSSEG = posseg;
body.externalCard = externalCard;
body.password = password;
request.MbfHeader = &header;
request.MbfBody = &body;
soapinput.input1 = &request;
char *flag = new char[256]; //soap输出的值
//调用Webservice
if(soap_call___ns1__verifyPassword(&soap,server,NULL,&soapinput,&soapoutput) == SOAP_OK)
{
response = *soapoutput.output1;
strcpy(flag,response.flag);
Debug("OK");
return atoi(flag);
}
else
{
soap_print_fault(&soap, stderr); // display the SOAP fault message on the stderr stream char temp[128];
memset(temp, 0, sizeof(temp));
if (soap.error)
{
const char *c, *v = NULL, *s, **d;
d = soap_faultcode(&soap);
if (!*d)
soap_set_fault(&soap);
c = *d;
if (soap.version == 2)
v = *soap_faultsubcode(&soap);
s = *soap_faultstring(&soap);
d = soap_faultdetail(&soap);
_snprintf(temp, sizeof(temp), "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap.version ? "SOAP 1." : "Error ", soap.version ? (int)soap.version : soap.error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
}
Debug(temp);
return 2;
}
//收尾
soap_destroy(&soap); // delete deserialized class instances
soap_end(&soap); // remove deserialized data and clean up
soap_done(&soap); // detach the gSOAP environment
delete []flag;
return 0;
}int k = 0;unsigned int __stdcall ReadDatabaseThread(void *param)
{
for (int i=0; i<5000; i++)
{
SendParamter("025200904139", "025200904139", "654321");
}
k++;
return 0;
}int main(int argc, char* argv[])
{
int iThread = 0;
cout<<"输入启动线程数:";
cin>>iThread;
for (int i=0; i<iThread; i++)
{
_beginthreadex(NULL, 0, ReadDatabaseThread, NULL, 0, NULL);
} while(k<iThread)
{
Sleep(4000);
}
return 0;
}
如果对方同样的服务,只是在两个环境下面部署产生了问题,那就应该在环境上面找原因。
很可能不是你代码的问题。我写客户端,连接别人的服务(tomcat下面部署的),只要取到WSDL就能够正常联通,没出现这么多问题过。期待高手...
还是感谢哈:)这个似乎关键也是在获取WSDL文件,将之gsoap转换,……连接、传递参数/值.
我们只需要填写数据到结构体,就能通讯了,没什么差异。所以还是和环境关系比较大,呵呵。