You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by ha...@gmail.com,
ha...@gmail.com on 2018/09/27 11:35:57 UTC
Getting Cannot serialize object of class org.ofbiz.manufacturing.bom.BOMTree Error
Hi Experts,
I am getting "Cannot serialize object of class org.ofbiz.manufacturing.bom.BOMTree" error 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-sgh632ryd5:8081/webtools/control/SOAPService"));
opts.setAction("getBOMTree");
sc.setOptions(opts);
//Serializable obj = (Serializable) sc.sendReceive(createPayLoad());
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", "MANUF_COMPONENT"));
mapMap.addChild(createMapEntry("productId", "10010"));
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,
Hatim
Re: Getting Cannot serialize object of class org.ofbiz.manufacturing.bom.BOMTree
Error
Posted by Girish Vasmatkar <gi...@hotwaxsystems.com>.
Hi Hatim
Deepak's right. Since BOMTree is not serializable, you can't use it as part
of web service call. Making it serializable is not going to be an option
either because then you will have to take care of the complete
serialization chain of BOMTree as well.
Best,
Girish Vasmatkar
HotWax Systems
On Fri, Sep 28, 2018 at 10:30 AM Deepak Nigam <de...@gmail.com>
wrote:
> Hi Hatim,
>
> It seems the issue is occurring because the 'BomTree' class neither
> implements the Serializable interface not extends any class which
> implements the Serializable interface.
>
>
> Thanks & Regards
> --
> Deepak Nigam
>
>
>
> On Fri, Sep 28, 2018 at 10:23 AM hatim.bhatia@gmail.com <
> hatim.bhatia@gmail.com> wrote:
>
> > Hi Experts,
> >
> > I am getting "Cannot serialize object of class
> > org.ofbiz.manufacturing.bom.BOMTree" error 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-sgh632ryd5:8081/webtools/control/SOAPService"));
> > opts.setAction("getBOMTree");
> > sc.setOptions(opts);
> > //Serializable obj = (Serializable)
> sc.sendReceive(createPayLoad());
> > 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", "MANUF_COMPONENT"));
> > mapMap.addChild(createMapEntry("productId", "10010"));
> > 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,
> > Hatim
> >
>
Re: Getting Cannot serialize object of class org.ofbiz.manufacturing.bom.BOMTree
Error
Posted by Deepak Nigam <de...@gmail.com>.
Hi Hatim,
It seems the issue is occurring because the 'BomTree' class neither
implements the Serializable interface not extends any class which
implements the Serializable interface.
Thanks & Regards
--
Deepak Nigam
On Fri, Sep 28, 2018 at 10:23 AM hatim.bhatia@gmail.com <
hatim.bhatia@gmail.com> wrote:
> Hi Experts,
>
> I am getting "Cannot serialize object of class
> org.ofbiz.manufacturing.bom.BOMTree" error 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-sgh632ryd5:8081/webtools/control/SOAPService"));
> opts.setAction("getBOMTree");
> sc.setOptions(opts);
> //Serializable obj = (Serializable) sc.sendReceive(createPayLoad());
> 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", "MANUF_COMPONENT"));
> mapMap.addChild(createMapEntry("productId", "10010"));
> 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,
> Hatim
>
Re: Getting Cannot serialize object of class org.ofbiz.manufacturing.bom.BOMTree
Error
Posted by Deepak Dixit <de...@hotwax.co>.
Hi Hatim Bhatia,
Your email has been moderated, Please subscribe mailing list.
http://ofbiz.apache.org/mailing-lists.html
Thanks & Regards
--
Deepak Dixit
On Thu, Sep 27, 2018 at 5:05 PM, hatim.bhatia@gmail.com <
hatim.bhatia@gmail.com> wrote:
> Hi Experts,
>
> I am getting "Cannot serialize object of class org.ofbiz.manufacturing.bom.BOMTree"
> error 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-sgh632ryd5:8081/webtools/control/SOAPService"));
> opts.setAction("getBOMTree");
> sc.setOptions(opts);
> //Serializable obj = (Serializable) sc.sendReceive(createPayLoad());
> 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", "MANUF_COMPONENT"));
> mapMap.addChild(createMapEntry("productId", "10010"));
> 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,
> Hatim
>