Hi Experts,
I am getting "Problem processing the service" error as response, when calling getBOMTree SOAP services using axis2 in my eclipse.
If anyone knows how to resolve this please let me know.
below is the code which I tried.
---------------------------------------------------------------------------------------------
private static OMFactory fac;
private static OMNamespace omNs;
static {
fac = OMAbstractFactory.getOMFactory();
omNs = fac.createOMNamespace("
http://ofbiz.apache.org/service/", "ns1");
}
public static void main(String[] args) throws AxisFault {
ServiceClient sc = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference(
"
http://ds-sgh737qx6t:8080/webtools/control/SOAPService"));
opts.setAction("getBOMTree");
sc.setOptions(opts);
OMElement res = sc.sendReceive(createPayLoad());
System.out.println(res);
}
private static OMElement createPayLoad() {
OMElement findPartiesById = fac.createOMElement("getBOMTree", omNs);
OMElement mapMap = fac.createOMElement("map-Map", omNs);
findPartiesById.addChild(mapMap);
mapMap.addChild(createMapEntry("bomType", "Manufacturing Bill of Materials"));
mapMap.addChild(createMapEntry("productId", "GZ-BASKET"));
mapMap.addChild(createMapEntry("login.username", "admin"));
mapMap.addChild(createMapEntry("login.password", "ofbiz"));
return findPartiesById;
}
private static OMElement createMapEntry(String key, String val) {
OMElement mapEntry = fac.createOMElement("map-Entry", omNs);
// create the key
OMElement mapKey = fac.createOMElement("map-Key", omNs);
OMElement keyElement = fac.createOMElement("std-String", omNs);
OMAttribute keyAttribute = fac.createOMAttribute("value", null, key);
mapKey.addChild(keyElement);
keyElement.addAttribute(keyAttribute);
// create the value
OMElement mapValue = fac.createOMElement("map-Value", omNs);
OMElement valElement = fac.createOMElement("std-String", omNs);
OMAttribute valAttribute = fac.createOMAttribute("value", null, val);
mapValue.addChild(valElement);
valElement.addAttribute(valAttribute);
// attach to map-Entry
mapEntry.addChild(mapKey);
mapEntry.addChild(mapValue);
return mapEntry;
}
----------------------------------------------------------------------------------------------
Any help is appreciated.
Thanks,
Vedika