I generated the stub to call a web service deployed internally. The response
is always null with this service.
Here's my test case:

@Test
public void testGetProduct()  {
        MapMap map = new MapMap();
        map.getMapEntry().add(createEntry("userLogin", "ofbiz"));
        map.getMapEntry().add(createEntry("idToFind", "PIZZA"));
        map.getMapEntry().add(createEntry("login.username", "admin"));
        map.getMapEntry().add(createEntry("login.password", "ofbiz"));
        FindProductById productData = new FindProductById();
        productData.setMapMap(map);
        FindProductByIdStub byId;
        try {
            byId = new FindProductByIdStub();
            FindProductByIdResponse response;
            response = byId.findProductById(productData);
            assertNotNull(response);
            MapMap m1 = response.getMapMap();
            assertNotNull(m1);
        } catch (AxisFault e1) {
            e1.printStackTrace();
        } catch (RemoteException e1) {
            e1.printStackTrace();
        }
    }

The wsdl is obtained from:

 wsdl2java.sh -uri "
http://localhost:8080/webtools/control/SOAPService/findProductById?wsdl"; -d
jaxbri -o generated-code

Which is a web service from apache ofbiz. The null value for the object is
being returned from this generated code:

java.lang.Object object = fromOM(

_returnEnv.getBody().getFirstElement() ,

org.apache.ofbiz.service.FindProductByIdResponse.class,

getEnvelopeNamespaces(_returnEnv));


And this is the generate class FindProductById.java:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "mapMap"
})
@XmlRootElement(name = "findProductById")
public class FindProductById {

    @XmlElement(name = "map-Map", namespace = "", required = true)
    protected MapMap mapMap;

    /**
     * Gets the value of the mapMap property.
     *
     * @return
     *     possible object is
     *     {@link MapMap }
     *
     */
    public MapMap getMapMap() {
        return mapMap;
    }

    /**
     * Sets the value of the mapMap property.
     *
     * @param value
     *     allowed object is
     *     {@link MapMap }
     *
     */
    public void setMapMap(MapMap value) {
        this.mapMap = value;
    }

}

Thank you in advance.

Reply via email to