tags:

views:

882

answers:

2

I have a simple POJO web service published with Axis2 on Tomcat5.5 I try to consume it with ATL C++ client and it fails. Doing the same with a C# client works. The problem is that ATL client sends soap body which looks like

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

Notice the invalid element in the middle. I suspect it has something to do with UTF-8 because C# sends a header of

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

and ATL client doesn't. Also when I look into some of the ATL SOAP internals I notice that a structure has two members: szName and szwName. The first one is empty and produces the element, the second one has a valid (?) name of testResponse (the method I'm calling is called "test").

Need advice as to where to go from here?

More details: full message from ATL client:

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/"&gt;&lt;soap:Body&gt;&lt; xmlns="http://fa.test.com/xsd"&gt;&lt;/&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;

Response from 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/"&gt;&lt;soapenv:Body&gt;&lt;soapenv:Fault&gt;&lt;faultcode&gt;soapenv:Server&lt;/faultcode&gt;&lt;faultstring&gt;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>

Oh, and here is the good request coming from C# client:

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"&gt;&lt;soap:Body /></soap:Envelope>

In C# case the soap:body is blank.

A: 

I don't think it has anything to do with UTF-8.

The valid message from C# doesn't have anything inside the soap:Body, while the invalid message has . It looks like the ATL C++ client is trying to force something inside the SOAP body when there shouldn't be anything there at all.

Note also that the C# client doesn't include a testResponse element in its message.

I'd look the code some more where it uses szName and see if that's where it's generating the . It shouldn't be doing that.

David Norman
+1  A: 

ATL Server is entirely capable of generating the request correctly. Looks like there's some issue with the WSDL. My cursory test generates the request:

<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/"&gt;
  <soap:Body></soap:Body></soap:Envelope>

for an ASP.NET Web service with SoapParameterStyle.Bare. Do you have a <wsdl:part> element in the input message? Can you post the WSDL service description?

Sunlight