Hi Malintha, Bingo! It worked.
Thanks, Supun On Tue, Apr 22, 2014 at 5:19 PM, Malintha Adikari <[email protected]> wrote: > > > > On Tue, Apr 22, 2014 at 5:03 PM, Supun Sethunga <[email protected]> wrote: > >> Hi Gayan, >> >> Thanks for looking in to it. >> >> So what alternations can I take instead of sending an OMElement? Does >> "anyType" accepts objects of some custom class (manually written), other >> than generic type? >> Or is it okay to send data using generic types (since it does not sound a >> very good practice)? >> >> Thanks and Regards, >> Supun >> >> >> On Tue, Apr 22, 2014 at 4:28 PM, Gayan Yalpathwala <[email protected]>wrote: >> >>> Hi Supun, >>> >>> >>> On Tue, Apr 22, 2014 at 3:08 PM, Supun Sethunga <[email protected]> wrote: >>> >>>> Hi Gayan, >>>> >>>> I went through the link, but doesn't seems to be the issue in my case. >>>> >>>> Message sent by the client does not contain the SOAP envelop. And the >>>> same method actually works when accessed using sendReceive() function. I >>>> think the issue is with the data type of the element in the wsdl, which is >>>> as below. >>>> >>>> <xs:element name="viewOrder"> >>>> <xs:complexType> >>>> <xs:sequence> >>>> <xs:element minOccurs="0" name="element" nillable="true" >>>> type="xs:*anyType"*/> >>>> </xs:sequence> >>>> </xs:complexType> >>>> </xs:element> >>>> >>> > Try replacing above part in your wsdl with following > > > <xs:element name="viewOrder"> > <xs:complexType> > <xs:sequence> > > <xs:any processContents="skip"/> > > </xs:sequence> > </xs:complexType> > </xs:element> > > Then ADB will generate code that represents the content of OriginalMessage > as an OMElement. > >> >>>> It considers the type as "anyType", thus the method in the stub is >>>> created with a input parameter of the type "java.lang.Object" rather than >>>> an OMElement. >>>> >>> >>> I found that there is a known issue here. Stub method is supposed to >>> handle any generic java object when the type is "anyType" in wsdl, but >>> throws this exception only for OMElement. There is a previous discussion >>> subjecting *"[Dev] {Need help/ AXIS2}"Unknown type can not serialize" >>> Exception"* and I can see two open issues ([1] and [2]) as well. I >>> think Dushan can shed some light on this. >>> >>> [1] https://issues.apache.org/jira/browse/AXIS2-3797 >>> [2] https://wso2.org/jira/browse/WSAS-1553 >>> >>> >>>> Not sure about a solution as yet. >>>> >>>> Thanks, >>>> Supun >>>> >>>> >>>> On Tue, Apr 22, 2014 at 2:55 PM, Gayan Yalpathwala <[email protected]>wrote: >>>> >>>>> Hi Supun, >>>>> >>>>> As far as I have identified, this can occur when the input does not >>>>> match with the expected. I think you might have sent a message wrapped by >>>>> an envelope where the method only expects the actual payload. Please refer >>>>> comments in [1]. >>>>> >>>>> [1] https://issues.apache.org/jira/browse/AXIOM-237 >>>>> >>>>> Thanks, >>>>> >>>>> >>>>> On Tue, Apr 22, 2014 at 10:13 AM, Supun Sethunga <[email protected]>wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Im trying to create a web-service in Axis2 and access the service >>>>>> from a client using the stub (which was generated using the wsdl). One of >>>>>> the methods takes a OMElement as the input parameter. Thus, when I call >>>>>> that method using the stub, I get the following Exception. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> *Exception in thread "main" java.lang.RuntimeException: Can not >>>>>> serialize OM Element Envelope at >>>>>> org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:963) >>>>>> at java.lang.String.valueOf(String.java:2854) at >>>>>> java.io.PrintStream.println(PrintStream.java:821) at >>>>>> client.SecureOrderProcessServiceStub.viewOrder(SecureOrderProcessServiceStub.java:471) >>>>>> at client.SecureOrderProcessClient.main(SecureOrderProcessClient.java:31) >>>>>> Caused by: javax.xml.stream.XMLStreamException: Unknow type can not >>>>>> serialize at >>>>>> org.apache.axis2.databinding.utils.ConverterUtil.serializeAnyType(ConverterUtil.java:1491) >>>>>> at >>>>>> client.SecureOrderProcessServiceStub$ViewOrder.serialize(SecureOrderProcessServiceStub.java:1115) >>>>>> at >>>>>> client.SecureOrderProcessServiceStub$ViewOrder.serialize(SecureOrderProcessServiceStub.java:1071) >>>>>> at >>>>>> org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:90) >>>>>> ....* >>>>>> .... >>>>>> >>>>>> >>>>>> The OMElement which is sent as the parameter, takes the following >>>>>> format. >>>>>> >>>>>> >>>>>> >>>>>> *<ns:viewOrder xmlns:ns="orderprocessorns"> >>>>>> <ns:orderId>0001</ns:orderId> </ns:viewOrder>* >>>>>> >>>>>> >>>>>> Any idea whats have been done wrong here? >>>>>> The other methods in the service stub, which takes data types >>>>>> int/string/etc as input parameters, work fine. >>>>>> >>>>>> Thanks, >>>>>> Supun >>>>>> >>>>>> -- >>>>>> *Supun Sethunga* >>>>>> Software Engineer >>>>>> WSO2, Inc. >>>>>> lean | enterprise | middleware >>>>>> Mobile : +94 716546324 >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> [email protected] >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Gayan Kaushalya Yalpathwala* >>>>> Software Engineer >>>>> WSO2 Inc.; http://wso2.com >>>>> lean.enterprise.middleware >>>>> >>>>> mobile: +94 71 8682704 <http://asia14.wso2con.com/> >>>>> >>>>> <http://asia14.wso2con.com/> >>>>> >>>> >>>> >>>> >>>> -- >>>> *Supun Sethunga* >>>> Software Engineer >>>> WSO2, Inc. >>>> lean | enterprise | middleware >>>> Mobile : +94 716546324 >>>> >>> >>> >>> Thanks, >>> >>> >>> -- >>> *Gayan Kaushalya Yalpathwala* >>> Software Engineer >>> WSO2 Inc.; http://wso2.com >>> lean.enterprise.middleware >>> >>> mobile: +94 71 8682704 <http://asia14.wso2con.com/> >>> >>> <http://asia14.wso2con.com/> >>> >> >> >> >> -- >> *Supun Sethunga* >> Software Engineer >> WSO2, Inc. >> lean | enterprise | middleware >> Mobile : +94 716546324 >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > *Malintha Adikari* > Software Engineer > WSO2 Inc.; http://wso2.com > lean.enterprise.middleware > > Mobile: +94 71 2312958 > Blog: http://malinthas.blogspot.com > Page: http://about.me/malintha > -- *Supun Sethunga* Software Engineer WSO2, Inc. lean | enterprise | middleware Mobile : +94 716546324
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
