Hi,
I am trying to make an axis2/java web service to talk with an Axis2/C client.
First, I deployed the WeatherService in
<axis2-java-1.3>/samples/pojoguide. I modified the class a bit by
adding in a simple getCount() method and changed the setWeather() to
return an int. Then I used the generated wsdl to generate the server
codes in Java and the client codes in C.
1. Generating the server skeleton:
~/tools/axis2/axis2-1.3/bin/wsdl2java.sh -uri WeatherService.wsdl -d
adb -s -wv 1.3 -ss -sd -ssi
2. Use the WeatherService.wsdl generated in step 1 (located in
resources) to generate the client stub:
~/tools/axis2/axis2-1.3/bin/axis2.sh org.apache.axis2.wsdl.WSDL2C -uri
WeatherService.xml -d adb -u
3. I added in simple implementation at the server skeleton and
deployed the server.
4. I then implemented the client and try to call the setWeather() and
getWeather().
5. The client died with a Debug assertion failed. A further look
using VC express 2005 shows that it died at
adb_setWeatherResponse_deserialize() when it is doing:
text_value =
axiom_element_get_text(current_element, env, current_node );
status =
adb_setWeatherResponse_set_return( _setWeatherResponse, env,
atoi( text_value));
The text_value is a bad pointer.
I turned on the SOAPMonitor and captured the following SOAP messages:
Request:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns3:setWeather xmlns:ns3="http://service.pojo.sample"
xmlns:ns1="http://data.pojo.sample/xsd">
<ns1:forecast>Sunny</ns1:forecast>
<ns1:howMuchRain>9.500000</ns1:howMuchRain>
<ns1:rain>true</ns1:rain>
<ns1:temperature>24.500000</ns1:temperature>
</ns3:setWeather>
</soapenv:Body>
</soapenv:Envelope>
Response:
<?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>org.apache.axis2.databinding.ADBException:
Unexpected subelement forecast</faultstring>
<detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
So the server is not able to parse the incoming message properly.
I then wrote a java client to do the same thing and it worked:
Request:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns2:setWeather xmlns:ns2="http://service.pojo.sample">
<ns2:param0>
<ns1:forecast xmlns:ns1="http://data.pojo.sample/xsd">Cloudy
with showers</ns1:forecast>
<ns1:howMuchRain
xmlns:ns1="http://data.pojo.sample/xsd">4.5</ns1:howMuchRain>
<ns1:rain xmlns:ns1="http://data.pojo.sample/xsd">true</ns1:rain>
<ns1:temperature
xmlns:ns1="http://data.pojo.sample/xsd">39.3</ns1:temperature>
</ns2:param0>
</ns2:setWeather>
</soapenv:Body>
</soapenv:Envelope>
Response:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns2:setWeatherResponse xmlns:ns2="http://service.pojo.sample">
<ns2:return>1</ns2:return>
</ns2:setWeatherResponse>
</soapenv:Body>
</soapenv:Envelope>
Have I missed sth? or is there a workaround for it? Any help will be
appreciated. :)
As a side note, the getWeather message sent from the Java client
doesn't indicate the method name anywhere in the message,
the server however is able to figure and returned the correct
response. This looks like a magic to me. Have I missed anything
again?
Request:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body />
</soapenv:Envelope>
Response:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns2:getWeatherResponse xmlns:ns2="http://service.pojo.sample">
<ns2:return>
<ns1:forecast xmlns:ns1="http://data.pojo.sample/xsd">Cloudy
with showers</ns1:forecast>
<ns1:howMuchRain
xmlns:ns1="http://data.pojo.sample/xsd">4.5</ns1:howMuchRain>
<ns1:rain xmlns:ns1="http://data.pojo.sample/xsd">true</ns1:rain>
<ns1:temperature
xmlns:ns1="http://data.pojo.sample/xsd">39.3</ns1:temperature>
</ns2:return>
</ns2:getWeatherResponse>
</soapenv:Body>
</soapenv:Envelope>
Thanks!
Lingjia
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]