Hi Deepal, Thanks for your reply on my question. as my service accepts xml payload in form of string and in wsdl there is no type define for objXML hence AXIS2 automatically mapped it to OMElement type. another important note is wsdltojava tool map objXML parameter to OMElement in case of I am using ADB binding but when I generate stub using XMLBEAN databinding it map it as string.
When I debug it I found the problem is due to serialization of objXML parameter as service expects sting and AXIS2 framework serialized objectXML using xmlstreamWriter hence exception comes out from AXIS2 core jar. This are my observations and assumption that I put here to understand the actual problem hope it helps let me know if you need any other details. Regards, Rajnish Thakur On Sat, Jan 11, 2014 at 11:29 PM, Deepal jayasinghe <[email protected]>wrote: > Not sure why you want to create an OMElement, what does the WSDL says > about the method signature ? > > Deepal > > Hi, > > Can you please help me? I have got stuck for last 4 days with AXIS2 > client also have done lot of googling as well, but couldn't get help. This > is first time I am working with AXIS2. I have a .asmx service hosted over > IIS, I have generated stub using AXIS2 (WSDL2Java -uri > approvalrequestmanager.wsdl -p ne > t.approva.BizRights.Services -d adb) > > as well as have used below command and wrote client for both. > > WSDL2Java -uri approvalrequestmanager.wsdl -p net.approva.BizRights.Services > -d xmlbeans -s > > I have posted this on stackOverflow.com as well PSB link- > > http://stackoverflow.com/questions/20999991/exception-while-trying-to-execute-axis2-service-client > > I have written client using generated stub from above command. In my > client code there is method which accepts two parameters one is kind of > string and another is kind of OMElement(XML). > > When I try to send payload XML using code below: > > Create req = new Create(); > > org.apache.axiom.om.OMFactory fac = > org.apache.axiom.om.OMAbstractFactory.getOMFactory(); > org.apache.axiom.om.OMNamespace omNs = fac.createOMNamespace(" > http://www.approva.net/BizRights/Services", null); > > org.apache.axiom.om.OMElement _valueObjXML = > fac.createOMElement("approvalrequests", omNs); > > _valueObjXML.addChild(fac.createOMText(_valueObjXML, > content)); > > req.setObjXML(_valueObjXML); > > req.setObjType(WellKnownType.ApprovalRequest); > > res = stub.create(req, brSoapHeader); > > *I got exception below:* > > rg.apache.axis2.AxisFault: System.Web.Services.Protocols.SoapException: > Server was unable to process request. ---> System.InvalidCastException: > Unable to cast object of type 'System.Xml.XmlNode[]' to type > 'System.String'. > > Looking at the exception my assumption is OMelement is getting passed as > XML type and and web service expecting string type so is there any way to > handle such situation in AXIS2. > > > Thanks in advance..!! > > Regards, > Rajnish Thakur > Pune, INDIA > > > > >
