【问题标题】:calling Axis2 web service from ATL C++ client从 ATL C++ 客户端调用 Axis2 Web 服务
【发布时间】:2010-09-20 17:26:01
【问题描述】:

我在 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 为空白。

【问题讨论】:

  • 您能否更具体一点...中间的无效元素是什么? C# 发送什么标头?您收到什么错误消息?
  • 上面贴了更多细节,中间的无效元素是“>”。

标签: c++ soap atl axis2


【解决方案1】:

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 服务。输入消息中有&lt;wsdl:part&gt; 元素吗?你能发布 WSDL 服务描述吗?

【讨论】:

    【解决方案2】:

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

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

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

    我会在它使用 szName 的地方多看一下代码,看看它是否是在哪里生成 .它不应该那样做。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-18
      • 1970-01-01
      • 2011-09-10
      • 2017-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多