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

时间:2008-11-04 17:19:24

标签: c++ soap atl axis2

我在Tomcat5.5上使用Axis2发布了一个简单的POJO Web服务 我尝试使用ATL C ++客户端使用它并且它失败了。对C#客户端执行相同操作。 问题是ATL客户端发送的皂体看起来像

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

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

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

和ATL客户端没有。此外,当我查看一些ATL SOAP内部时,我注意到一个结构有两个成员: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>

来自Axis2的回应:

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是空白的。

2 个答案:

答案 0 :(得分:2)

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>

用于SoapParameterStyle.Bare的ASP.NET Web服务。输入消息中是否有<wsdl:part>个元素?你可以发布WSDL服务描述吗?

答案 1 :(得分:0)

我认为它与UTF-8没有任何关系。

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

另请注意,C#客户端的消息中不包含testResponse元素。

我会在使用szName的地方看一下代码,看看它是否正在生成它。它不应该这样做。

相关问题