After applyinga few patches, I have now managed to make a
FindPartiesById web service call without errors, but I am unable to get
the response value. I am using the following code:
Can anyone see where I am going wrong?
Many thanks in advance,
Chris
-----------------
import org.apache.ofbiz.service.MapEntry;
import org.apache.ofbiz.service.MapKey;
import org.apache.ofbiz.service.MapMap;
import org.apache.ofbiz.service.MapValue;
import org.apache.ofbiz.service.StdString;
public class Main {
public static void main(String[] args) {
try {
org.apache.ofbiz.service.FindPartiesById service = new
org.apache.ofbiz.service.FindPartiesById();
org.apache.ofbiz.service.FindPartiesByIdPortType port =
service.getFindPartiesByIdPort();
MapMap myMap = new MapMap();
myMap.getMapEntry().add(makeMapEntry("idToFind", "admin"));
myMap.getMapEntry().add(makeMapEntry("login.username",
"admin"));
myMap.getMapEntry().add(makeMapEntry("login.password",
"ofbiz"));
javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap> mapMap =
new
javax.xml.ws.Holder<org.apache.ofbiz.service.MapMap>(myMap);
port.findPartiesById(mapMap);
// ACTUAL RESPONSE XML:
/*
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><axis2ns16:findPartiesByIdResponse
xmlns:axis2ns16="http://ofbiz.apache.org/service/"><map-Map>
<map-Entry>
<map-Key>
<std-String value="responseMessage"></std-String>
</map-Key>
<map-Value>
<std-String value="success"></std-String>
</map-Value>
</map-Entry>
<map-Entry>
<map-Key>
<std-String value="party"></std-String>
</map-Key>
<map-Value>
<eeval-Party createdStamp="2009-12-24 16:13:30.949"
createdTxStamp="2009-12-24 16:13:30.946" lastUpdatedStamp="2009-12-24
16:13:31.892" lastUpdatedTxStamp="2009-12-24 16:13:31.553"
partyId="admin" partyTypeId="PERSON"></eeval-Party>
</map-Value>
</map-Entry>
<map-Entry>
<map-Key>
<std-String value="partiesFound"></std-String>
</map-Key>
<map-Value>
<col-Collection></col-Collection>
</map-Value>
</map-Entry>
</map-Map></axis2ns16:findPartiesByIdResponse></soapenv:Body></soapenv:Envelope>
*/
// This map entry size is zero, but should be greater than
zero (see actual response above)
System.out.println( mapMap.value.getMapEntry().size() );
} catch (Exception ex) {
ex.printStackTrace();
}
}
private static MapEntry makeMapEntry(String key, String value) {
StdString keyString = new StdString();
keyString.setValue(key);
MapKey mapKey = new MapKey();
mapKey.setStdString(keyString);
StdString valueString = new StdString();
valueString.setValue(value);
MapValue mapValue = new MapValue();
mapValue.setStdString(valueString);
MapEntry mapEntry = new MapEntry();
mapEntry.setMapKey(mapKey);
mapEntry.setMapValue(mapValue);
return mapEntry;
}
}