从ATL C++客户端调用Axis2 web服务

calling Axis2 web service from ATL C++ client

本文关键字:Axis2 web 服务 调用 客户端 ATL C++      更新时间:2023-10-16

我在Tomcat5.5上使用Axis2发布了一个简单的POJO web服务我试图用ATL C++客户端使用它,但它失败了。对C#客户端执行同样的操作是可行的。问题是ATL客户端发送的soap主体看起来像

<soap:Body>< xmlns="http://fa.test.com/xsd"></></soap:Body></soap:Envelope>

请注意在中间的无效元素。我怀疑这与UTF-8有关,因为C#发送了的头

<?xml version='1.0' encoding='utf-8'?>

而ATL客户端没有。此外,当我研究一些ATLSOAP内部时,我注意到一个结构有两个成员:szName和szwName。第一个是空的并生成元素,第二个有一个有效的(?)名称testResponse(我调用的方法称为"test")。

需要关于从这里去哪里的建议吗?

更多详细信息:来自ATL客户端的完整消息:

POST /axis2/services/EnterpriseService.EnterpriseServiceHttpSoap11Endpoint/ HTTP/1.1
Content-Length: 304
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:test"
Accept: text/xml
Host: xxxxxxx
User-Agent: Microsoft-ATL-Native/8.00
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body>< xmlns="http://fa.test.com/xsd"></></soap:Body></soap:Envelope>

轴2的响应:

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Tue, 04 Nov 2008 15:31:57 GMT
Connection: close
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '>' (code 62); expected an element name.&#xd;
 at [row,col {unknown-source}]: [1,276]</faultstring><detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>

哦,这是来自C#客户端的好请求:

POST /axis2/services/EnterpriseService.EnterpriseServiceHttpSoap11Endpoint/ HTTP/1.1
Via: 1.1 ANGEL-ISLAND
Content-Type: text/xml; charset=utf-8
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.1433)
Host: xxxxxxx:8080
SOAPAction: "urn:test"
Connection: Keep-Alive
Content-Length: 236
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body /></soap:Envelope>

在C#的情况下,soap:body是空白的。

ATL Server完全能够正确生成请求。看起来WSDL有一些问题。我的粗略测试生成了请求:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <soap:Body></soap:Body></soap:Envelope>

对于具有CCD_ 1的ASP.NET Web服务。输入消息中是否有<wsdl:part>元素?你能发布WSDL服务描述吗?

我认为这与UTF-8无关。

来自C#的有效消息在soap:Body中没有任何内容,而无效消息有。看起来ATLC++客户端试图在SOAP主体中强制执行某些内容,而根本不应该有任何内容。

还要注意,C#客户端的消息中没有包含testResponse元素。

我会进一步查看代码中使用szName的地方,看看这是否是它生成的地方。它不应该那样做。