Note that there are some explanatory texts on larger screens.

plurals
  1. POParameters in request to POJO AXIS2 web service are not passed to the POJO
    primarykey
    data
    text
    <p>We have a POJO web service implemented in AXIS2 v1.5.2 running in Tomcat 6 behind Apache2 webserver.</p> <p>For demonstration purposes, I will focus on the validateUser message and corresponding method. All of the messages are behaving in a similar fashion.</p> <p>I have seen <a href="https://stackoverflow.com/questions/1000578/axis2-always-receives-null-parameters-even-if-soap-request-is-sent-correctly">this</a> as well as a couple of other related questions but they do not seem to get to the bottom of the issue.</p> <p>When requests are sent to the service, the parameters are being passed to the POJA as null and blank.</p> <p>First the WSDL:</p> <pre><code>&lt;wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://service.icomet.com" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax21="http://util.java/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://service.icomet.com"&gt; &lt;wsdl:types&gt; &lt;xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://util.java/xsd"&gt; &lt;xs:complexType name="Map"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="empty" type="xs:boolean"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; &lt;xs:schema xmlns:ax22="http://util.java/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.icomet.com"&gt; &lt;xs:import namespace="http://util.java/xsd"/&gt; &lt;xs:element name="validateUser"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="user" nillable="true" type="xs:string"/&gt; &lt;xs:element name="userPassword" nillable="true" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; &lt;/wsdl:types&gt; &lt;wsdl:message name="validateUserRequest"&gt; &lt;wsdl:part name="parameters" element="ns:validateUser"/&gt; &lt;/wsdl:message&gt; </code></pre> <p></p> <p>After following along in the code of org.apache.axis2.rpc.receivers.RPCMessageReceiver, org.apache.axis2.rpc.receivers.RPCUtil and org.apache.axis2.databinding.utils.BeanUtil what I see is the service getting my request with the params intact. The OMElement printed in the log from:</p> <p>BeanUtil.deserialize(OMElement response, Object[] javaTypes, ObjectSupplier objectSupplier) looks like this: deserialize(OMElement response, Object[] javaTypes, ObjectSupplier objectSupplier)</p> <p>looks like this:</p> <pre><code>&lt;SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;ns:validateUser xmlns:ns="http://service.icomet.com"&gt; &lt;ns:user&gt;test&lt;/ns:user&gt; &lt;ns:userPassword&gt;values&lt;/ns:userPassword&gt; &lt;/ns:validateUser&gt; </code></pre> <p></p> <p>After a call to get the children of the OMElement and looking at the first child of the above OMElement I see this:</p> <pre><code>&lt;ns:validateUser xmlns:ns="http://service.icomet.com"&gt; &lt;ns:user&gt;test&lt;/ns:user&gt; &lt;ns:userPassword&gt;values&lt;/ns:userPassword&gt; &lt;/ns:validateUser&gt; </code></pre> <p>Calling getText() on the above OMElement returns multiple blank lines in the log.</p> <p>I added the following method:</p> <pre><code> private static void showElement(OMElement omElement) { System.out.println("onElement class:" + omElement.getClass().getName()); System.out.println("omElement:" + omElement); System.out.println("omElement.getText:" + omElement.getText()); for (Iterator it = omElement.getChildElements(); it.hasNext();) { Object object = it.next(); System.out.println("child class name:" + object.getClass().getName()); System.out.println("child to string:" + object); } for (Iterator it = omElement.getAllAttributes(); it.hasNext();) { OMAttribute object = (OMAttribute) it.next(); System.out.println("OMAttribute:" + object.getAttributeValue()); } } </code></pre> <p>to the BeanUtil class to have better look at this OMElement. This code returns the following:</p> <pre><code>onElement class:org.apache.axiom.om.impl.llom.OMElementImpl omElement:&lt;ns:validateUser xmlns:ns="http://service.icomet.com"&gt; &lt;ns:user&gt;test&lt;/ns:user&gt; &lt;ns:userPassword&gt;values&lt;/ns:userPassword&gt; &lt;/ns:validateUser </code></pre> <blockquote> <p>omElement.getText:</p> </blockquote> <pre><code>child class name:org.apache.axiom.om.impl.llom.OMElementImpl child to string:&lt;ns:user xmlns:ns="http://service.icomet.com"&gt;test&lt;/ns:user&gt; child class name:org.apache.axiom.om.impl.llom.OMElementImpl child to string:&lt;ns:userPassword xmlns:ns="http://service.icomet.com"&gt;values&lt;/ns:userPassword&gt; </code></pre> <p>So, I am seeing the values. They are arriving and getting in the door so to speak. However, due to the fact that org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject calls getText on the OMElement and returns an empty string, the RPCUtil.processRequest method is returning an object array with an empty string and a null object and this gets passed on to the POJO.</p> <p>I know its a long question, but I figured I might as well add all this info up front. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload